Merge branch 'main' into organizeImportsSettingsFix

This commit is contained in:
Isabel Duan
2024-10-30 15:50:10 -07:00
committed by GitHub
21 changed files with 118 additions and 172 deletions

View File

@@ -16,7 +16,7 @@ export class TSServerRequestCommand implements Command {
private readonly lazyClientHost: Lazy<TypeScriptServiceClientHost>
) { }
public execute(requestID: keyof TypeScriptRequests, args?: any, config?: any) {
public execute(command: keyof TypeScriptRequests, args?: any, config?: any) {
// A cancellation token cannot be passed through the command infrastructure
const token = nulToken;
@@ -36,8 +36,11 @@ export class TSServerRequestCommand implements Command {
'completionInfo'
];
if (!allowList.includes(requestID)) { return; }
return this.lazyClientHost.value.serviceClient.execute(requestID, args, token, config);
if (!allowList.includes(command) || command.startsWith('_')) {
return;
}
return this.lazyClientHost.value.serviceClient.execute(command, args, token, config);
}
}

View File

@@ -70,12 +70,10 @@ export function register(
if (!file) {
return { entries: [] };
}
// @ts-expect-error until ts5.7
const response = await client.execute('copilotRelated', { file, }, token) as Proto.CopilotRelatedResponse;
if (response.type !== 'response' || !response.body) {
return { entries: [] };
}
// @ts-expect-error until ts5.7
return { entries: response.body.relatedFiles.map(f => client.toResource(f)), traits: [] };
}));
}

View File

@@ -19,18 +19,5 @@ declare module '../../../../node_modules/typescript/lib/typescript' {
interface Response {
readonly _serverType?: ServerType;
}
//#region PreparePasteEdits
interface PreparePasteEditsRequest extends FileRequest {
command: 'preparePasteEdits';
arguments: PreparePasteEditsRequestArgs;
}
interface PreparePasteEditsRequestArgs extends FileRequestArgs {
copiedTextSpan: TextSpan[];
}
interface PreparePasteEditsResponse extends Response {
body: boolean;
}
//#endregion
}
}

View File

@@ -77,7 +77,6 @@ interface StandardTsServerRequests {
'getMoveToRefactoringFileSuggestions': [Proto.GetMoveToRefactoringFileSuggestionsRequestArgs, Proto.GetMoveToRefactoringFileSuggestions];
'linkedEditingRange': [Proto.FileLocationRequestArgs, Proto.LinkedEditingRangeResponse];
'mapCode': [Proto.MapCodeRequestArgs, Proto.MapCodeResponse];
// @ts-expect-error until ts5.7
'copilotRelated': [Proto.FileRequestArgs, Proto.CopilotRelatedResponse];
'getPasteEdits': [Proto.GetPasteEditsRequestArgs, Proto.GetPasteEditsResponse];
'preparePasteEdits': [Proto.PreparePasteEditsRequestArgs, Proto.PreparePasteEditsResponse];