mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Update a few interfaces for TS 2.6.2
This commit is contained in:
parent
2bbdabd97e
commit
3200d2afa6
|
@ -84,7 +84,7 @@ export function getJavascriptMode(documentRegions: LanguageModelCache<HTMLDocume
|
|||
doComplete(document: TextDocument, position: Position): CompletionList {
|
||||
updateCurrentTextDocument(document);
|
||||
let offset = currentTextDocument.offsetAt(position);
|
||||
let completions = jsLanguageService.getCompletionsAtPosition(FILE_NAME, offset);
|
||||
let completions = jsLanguageService.getCompletionsAtPosition(FILE_NAME, offset, { includeExternalModuleExports: false });
|
||||
if (!completions) {
|
||||
return { isIncomplete: false, items: [] };
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue