Don't show lightbulb if we only have a selection

Removes code action trigger proposal

Fixes #52070
This commit is contained in:
Matt Bierner
2018-06-15 11:07:39 -07:00
parent 74ae993e2f
commit ab77235bfb
3 changed files with 8 additions and 29 deletions
@@ -189,7 +189,7 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
return false;
}
return rangeOrSelection instanceof vscode.Selection && (!rangeOrSelection.isEmpty || context.triggerKind === vscode.CodeActionTrigger.Manual);
return rangeOrSelection instanceof vscode.Selection;
}
private static getKind(refactor: Proto.RefactorActionInfo) {
@@ -12,6 +12,7 @@ import 'vs/css!./lightBulbWidget';
import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition } from 'vs/editor/browser/editorBrowser';
import { TextModel } from 'vs/editor/common/model/textModel';
import { CodeActionsComputeEvent } from './codeActionModel';
import { CodeActionKind } from 'vs/editor/contrib/codeAction/codeActionTrigger';
export class LightBulbWidget implements IDisposable, IContentWidget {
@@ -114,9 +115,14 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
const { token } = this._futureFixes;
this._model = value;
const selection = this._model.rangeOrSelection;
this._model.actions.done(fixes => {
if (!token.isCancellationRequested && fixes && fixes.length > 0) {
this._show();
if (selection.isEmpty() && fixes.every(fix => fix.kind && CodeActionKind.Refactor.contains(fix.kind))) {
this.hide();
} else {
this._show();
}
} else {
this.hide();
}
-27
View File
@@ -566,33 +566,6 @@ declare module 'vscode' {
}
//#endregion
//#region mjbvz: Code action trigger
/**
* How a [code action provider](#CodeActionProvider) was triggered
*/
export enum CodeActionTrigger {
/**
* Provider was triggered automatically by VS Code.
*/
Automatic = 1,
/**
* User requested code actions.
*/
Manual = 2,
}
interface CodeActionContext {
/**
* How the code action provider was triggered.
*/
triggerKind?: CodeActionTrigger;
}
//#endregion
//#region Matt: WebView Serializer
/**