Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hide AI fix div if no fixes [IDE-753] #555

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ declare const acquireVsCodeApi: any;
const diffTopElem = document.getElementById('diff-top') as HTMLElement;
const diffElem = document.getElementById('diff') as HTMLElement;
const noDiffsElem = document.getElementById('info-no-diffs') as HTMLElement;

if (noDiffsElem) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is temporary until new LS is released

noDiffsElem.innerText = "We couldn't determine any fixes for this issue.";
}
const diffNumElem = document.getElementById('diff-number') as HTMLElement;
const diffNum2Elem = document.getElementById('diff-number2') as HTMLElement;

Expand All @@ -292,11 +294,20 @@ declare const acquireVsCodeApi: any;
}

function showCurrentDiff() {
if (!suggestion?.diffs?.length) {
toggleElement(noDiffsElem, 'show');
toggleElement(diffTopElem, 'hide');
toggleElement(diffElem, 'hide');
toggleElement(applyFixButton, 'hide');
return;
}

if (!suggestion?.diffs?.length || diffSelectedIndex < 0 || diffSelectedIndex >= suggestion.diffs.length) return;

toggleElement(noDiffsElem, 'hide');
toggleElement(diffTopElem, 'show');
toggleElement(diffElem, 'show');
toggleElement(applyFixButton, 'show');

diffNumElem.innerText = suggestion.diffs.length.toString();
diffNum2Elem.innerText = suggestion.diffs.length.toString();
Expand Down