mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-20 20:10:11 -04:00
Merge from vscode 52dcb723a39ae75bee1bd56b3312d7fcdc87aeed (#6719)
This commit is contained in:
@@ -117,8 +117,8 @@ function getCodeActionProviders(
|
||||
}
|
||||
|
||||
registerLanguageCommand('_executeCodeActionProvider', async function (accessor, args): Promise<ReadonlyArray<CodeAction>> {
|
||||
const { resource, range, kind } = args;
|
||||
if (!(resource instanceof URI) || !Range.isIRange(range)) {
|
||||
const { resource, rangeOrSelection, kind } = args;
|
||||
if (!(resource instanceof URI)) {
|
||||
throw illegalArgument();
|
||||
}
|
||||
|
||||
@@ -127,9 +127,19 @@ registerLanguageCommand('_executeCodeActionProvider', async function (accessor,
|
||||
throw illegalArgument();
|
||||
}
|
||||
|
||||
const validatedRangeOrSelection = Selection.isISelection(rangeOrSelection)
|
||||
? Selection.liftSelection(rangeOrSelection)
|
||||
: Range.isIRange(rangeOrSelection)
|
||||
? model.validateRange(rangeOrSelection)
|
||||
: undefined;
|
||||
|
||||
if (!validatedRangeOrSelection) {
|
||||
throw illegalArgument();
|
||||
}
|
||||
|
||||
const codeActionSet = await getCodeActions(
|
||||
model,
|
||||
model.validateRange(range),
|
||||
validatedRangeOrSelection,
|
||||
{ type: 'manual', filter: { includeSourceActions: true, kind: kind && kind.value ? new CodeActionKind(kind.value) : undefined } },
|
||||
CancellationToken.None);
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ export class CodeActionWidget extends Disposable {
|
||||
private readonly _delegate: CodeActionWidgetDelegate,
|
||||
) {
|
||||
super();
|
||||
this._visible = false;
|
||||
}
|
||||
|
||||
public async show(codeActions: CodeActionSet, at?: IAnchor | IPosition): Promise<void> {
|
||||
|
||||
@@ -59,8 +59,8 @@ suite('CodeAction', () => {
|
||||
command: {
|
||||
abc: {
|
||||
command: new class implements modes.Command {
|
||||
id: '1';
|
||||
title: 'abc';
|
||||
id!: '1';
|
||||
title!: 'abc';
|
||||
},
|
||||
title: 'Extract to inner function in function "test"'
|
||||
}
|
||||
@@ -69,7 +69,7 @@ suite('CodeAction', () => {
|
||||
bcd: {
|
||||
diagnostics: <IMarkerData[]>[],
|
||||
edit: new class implements modes.WorkspaceEdit {
|
||||
edits: modes.ResourceTextEdit[];
|
||||
edits!: modes.ResourceTextEdit[];
|
||||
},
|
||||
title: 'abc'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user