fix lightbulb jumping in the gutter (but like not the trash) (#227022)

* fix for flickering lightbulb

* second fix

* remove console log
pull/227027/head
Justin Chen 2024-08-28 16:15:56 -07:00 committed by GitHub
parent 59b2709194
commit c293d5af42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -180,6 +180,12 @@ export class CodeActionController extends Disposable implements IEditorContribut
return;
}
const selection = this._editor.getSelection();
if (selection?.startLineNumber !== newState.position.lineNumber) {
return;
}
this._lightBulbWidget.value?.update(actions, newState.trigger, newState.position);
if (newState.trigger.type === CodeActionTriggerType.Invoke) {

View File

@ -271,7 +271,6 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
const currLineEmptyOrIndented = isLineEmptyOrIndented(lineNumber);
const notEmpty = !nextLineEmptyOrIndented && !prevLineEmptyOrIndented;
// check above and below. if both are blocked, display lightbulb in the gutter.
if (!nextLineEmptyOrIndented && !prevLineEmptyOrIndented && !hasDecoration) {
this.gutterState = new LightBulbState.Showing(actions, trigger, atPosition, {
@ -280,7 +279,7 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
});
this.renderGutterLightbub();
return this.hide();
} else if (prevLineEmptyOrIndented || endLine || (notEmpty && !currLineEmptyOrIndented)) {
} else if (prevLineEmptyOrIndented || endLine || (prevLineEmptyOrIndented && !currLineEmptyOrIndented)) {
effectiveLineNumber -= 1;
} else if (nextLineEmptyOrIndented || (notEmpty && currLineEmptyOrIndented)) {
effectiveLineNumber += 1;