-
Notifications
You must be signed in to change notification settings - Fork 37.4k
Closed
Labels
*dev-questionVS Code Extension Development QuestionVS Code Extension Development Questioninfo-neededIssue requires more information from posterIssue requires more information from poster
Description
I raised this previous in #66860, see there for details. The suggested fix was to prefix filterText on CompletionItems with spaces, however this doesn't work correctly because it results in the space being removed when you accept the completion:
context.subscriptions.push(vs.languages.registerCompletionItemProvider("markdown", {
provideCompletionItems(document: vs.TextDocument, position: vs.Position, token: vs.CancellationToken, context: vs.CompletionContext): vs.CompletionItem[] {
const item = new vs.CompletionItem("test");
item.filterText = " test"; // Prefix with space so it doesn't vanish if the user wants a space after the trigger character like `foo: test`
return [item];
},
}, ":"));Then the user types foo: and the completion opens. The press space, and the test item remains visible (good), but then they accept the completion and the space vanishes - they get foo:test (bad).
I used to have <space> as a trigger character, but it caused other bugs when users were typing quickly, and it also significantly increases the number of times the completion opens unexpectedly.
Metadata
Metadata
Assignees
Labels
*dev-questionVS Code Extension Development QuestionVS Code Extension Development Questioninfo-neededIssue requires more information from posterIssue requires more information from poster