From fc903594df7a33505009b0afe13d022b0b9dd9e2 Mon Sep 17 00:00:00 2001 From: Kunall Banerjee Date: Wed, 8 Apr 2026 01:14:41 -0400 Subject: [PATCH] address feedback --- crates/project/src/lsp_store.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index ae7fe6abba61f094977b73155f11969c459ad28c..17d00354b3bafe5f182d7bdc4c71cc82dc154add 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -6587,9 +6587,16 @@ impl LspStore { **lsp_completion = resolved_completion; *resolved = true; - // Re-derive new_text from the resolved completion. Some servers - // (e.g. vtsls with completeFunctionCalls) update insertText/textEdit - // during resolve to add snippet content like function call parentheses. + // We must not use any data such as sortText, filterText, insertText and textEdit to edit `Completion` since they are not supposed to change during resolve. + // Refer: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_completion + // + // We still re-derive new_text here as a workaround for the specific + // VS Code TypeScript completion resolve flow that vtsls wraps: + // https://github.com/microsoft/vscode/blob/838b48504cd9a2338e2ca9e854da9cec990c4d57/extensions/typescript-language-features/src/languageFeatures/completions.ts#L218 + // + // Some servers (e.g. vtsls with completeFunctionCalls) update + // insertText/textEdit during resolve to add snippet content like + // function call parentheses. // // vtsls resolve flow: // https://github.com/yioneko/vtsls/blob/fecf52324a30e72dfab1537047556076720c1a5f/packages/service/src/service/completion.ts#L228-L244