mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
parent
4f30fd5a83
commit
8294940ac6
|
@ -29,6 +29,7 @@ import { IMarkerService } from 'vs/platform/markers/common/markers';
|
|||
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { CodeActionModel, CodeActionsState, SUPPORTED_CODE_ACTIONS } from './codeActionModel';
|
||||
import { CodeActionAutoApply, CodeActionCommandArgs, CodeActionFilter, CodeActionItem, CodeActionKind, CodeActionSet, CodeActionTrigger, CodeActionTriggerSource } from '../common/types';
|
||||
import { IdleValue } from 'vs/base/common/async';
|
||||
|
||||
function contextKeyForSupportedActions(kind: CodeActionKind) {
|
||||
return ContextKeyExpr.regex(
|
||||
|
@ -92,7 +93,7 @@ export class CodeActionController extends Disposable implements IEditorContribut
|
|||
}
|
||||
|
||||
private readonly _editor: ICodeEditor;
|
||||
private readonly _model: CodeActionModel;
|
||||
private readonly _model: IdleValue<CodeActionModel>;
|
||||
private readonly _ui: Lazy<CodeActionUi>;
|
||||
|
||||
constructor(
|
||||
|
@ -106,8 +107,14 @@ export class CodeActionController extends Disposable implements IEditorContribut
|
|||
super();
|
||||
|
||||
this._editor = editor;
|
||||
this._model = this._register(new CodeActionModel(this._editor, languageFeaturesService.codeActionProvider, markerService, contextKeyService, progressService));
|
||||
this._register(this._model.onDidChangeState(newState => this.update(newState)));
|
||||
|
||||
this._model = this._register(new IdleValue(() => {
|
||||
const model = this._register(new CodeActionModel(this._editor, languageFeaturesService.codeActionProvider, markerService, contextKeyService, progressService));
|
||||
|
||||
this._register(model.onDidChangeState(newState => this.update(newState)));
|
||||
|
||||
return model;
|
||||
}));
|
||||
|
||||
this._ui = new Lazy(() =>
|
||||
this._register(_instantiationService.createInstance(CodeActionUi, editor, QuickFixAction.Id, AutoFixAction.Id, {
|
||||
|
@ -149,7 +156,7 @@ export class CodeActionController extends Disposable implements IEditorContribut
|
|||
}
|
||||
|
||||
private _trigger(trigger: CodeActionTrigger) {
|
||||
return this._model.trigger(trigger);
|
||||
return this._model.value.trigger(trigger);
|
||||
}
|
||||
|
||||
private _applyCodeAction(action: CodeActionItem, preview: boolean): Promise<void> {
|
||||
|
|
Loading…
Reference in a new issue