From 439383690de7fab29d4325a1b7db942f73897cc2 Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Wed, 19 Nov 2025 22:09:18 +0100 Subject: [PATCH] fix: don't send duplicate refactors when more than one context.only --- src/lsp-server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lsp-server.ts b/src/lsp-server.ts index d29510d4..3176611f 100644 --- a/src/lsp-server.ts +++ b/src/lsp-server.ts @@ -849,8 +849,8 @@ export class LspServer { } protected async getRefactors(fileRangeArgs: ts.server.protocol.FileRangeRequestArgs, context: lsp.CodeActionContext, features: SupportedFeatures, token?: lsp.CancellationToken): Promise { - // Make separate request for each "kind" that was specified or a single request otherwise. - const kinds = context.only || [undefined]; + // Make separate request for each refactor "kind" that was specified or a single request otherwise. + const kinds = (context.only || [undefined]).filter(kind => kind === undefined || CodeActionKind.Refactor.contains(new CodeActionKind(kind))); const responses = await Promise.all(kinds.map(async (kind) => { const args: ts.server.protocol.GetApplicableRefactorsRequestArgs = {