mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
Update a few interfaces for TS 2.6.2
This commit is contained in:
@@ -134,13 +134,13 @@ class ApplyCompletionCodeActionCommand implements Command {
|
||||
private readonly client: ITypeScriptServiceClient
|
||||
) { }
|
||||
|
||||
public async execute(file: string, codeActions: CodeAction[]): Promise<boolean> {
|
||||
public async execute(_file: string, codeActions: CodeAction[]): Promise<boolean> {
|
||||
if (codeActions.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (codeActions.length === 1) {
|
||||
return applyCodeAction(this.client, codeActions[0], file);
|
||||
return applyCodeAction(this.client, codeActions[0]);
|
||||
}
|
||||
|
||||
interface MyQuickPickItem extends QuickPickItem {
|
||||
@@ -165,7 +165,7 @@ class ApplyCompletionCodeActionCommand implements Command {
|
||||
if (!action) {
|
||||
return false;
|
||||
}
|
||||
return applyCodeAction(this.client, action, file);
|
||||
return applyCodeAction(this.client, action);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,10 +250,10 @@ export default class TypeScriptCompletionItemProvider implements CompletionItemP
|
||||
}
|
||||
|
||||
try {
|
||||
const args = {
|
||||
const args: CompletionsRequestArgs = {
|
||||
...vsPositionToTsFileLocation(file, position),
|
||||
includeExternalModuleExports: config.autoImportSuggestions
|
||||
} as CompletionsRequestArgs;
|
||||
};
|
||||
const msg = await this.client.execute('completions', args, token);
|
||||
// This info has to come from the tsserver. See https://github.com/Microsoft/TypeScript/issues/2831
|
||||
// let isMemberCompletion = false;
|
||||
|
||||
@@ -29,8 +29,7 @@ export function getEditForCodeAction(
|
||||
|
||||
export async function applyCodeAction(
|
||||
client: ITypeScriptServiceClient,
|
||||
action: Proto.CodeAction,
|
||||
file: string
|
||||
action: Proto.CodeAction
|
||||
): Promise<boolean> {
|
||||
const workspaceEdit = getEditForCodeAction(client, action);
|
||||
if (workspaceEdit) {
|
||||
@@ -38,17 +37,16 @@ export async function applyCodeAction(
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return applyCodeActionCommands(client, action, file);
|
||||
return applyCodeActionCommands(client, action);
|
||||
}
|
||||
|
||||
export async function applyCodeActionCommands(
|
||||
client: ITypeScriptServiceClient,
|
||||
action: Proto.CodeAction,
|
||||
file: string
|
||||
action: Proto.CodeAction
|
||||
): Promise<boolean> {
|
||||
if (action.commands && action.commands.length) {
|
||||
for (const command of action.commands) {
|
||||
const response = await client.execute('applyCodeActionCommand', { file, command });
|
||||
const response = await client.execute('applyCodeActionCommand', { command });
|
||||
if (!response || !response.body) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user