Skip to content

Commit 20d7e37

Browse files
committed
Fix completion text for clients which don’t support TextEdit
We could set the `Label` to `CompletionText` as the fallback, but that then makes the list of completions in fancier clients not as accurate (since PowerShell explicitly provides `ListItemText` for this purpose). Instead, we set usually unused field `InsertText` with the same information we provided for more advanced clients in `TextEdit`.
1 parent 78f8fb7 commit 20d7e37

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PowerShellEditorServices/Services/TextDocument/Handlers/CompletionHandler.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ internal static CompletionItem CreateCompletionItem(
185185
// Retain PowerShell's sort order with the given index.
186186
SortText = $"{sortIndex:D4}{result.ListItemText}",
187187
FilterText = result.CompletionText,
188-
TextEdit = textEdit // Used instead of InsertText.
188+
// Used instead of Label when TextEdit is unsupported
189+
InsertText = result.CompletionText,
190+
// Used instead of InsertText when possible
191+
TextEdit = textEdit
189192
};
190193

191194
return result.ResultType switch

0 commit comments

Comments
 (0)