You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enter the keystrokes shown in the following animation:
In the first part of the recording, when the ( specified in commitCharacters accepts the suggestion notice how VSCode injects that character into the first field of the insertText snippet. This is unwanted.
In contrast, see how the CompletionItem behaves as intended if the suggestion is accepted by pressing 'Tab'.
I acknowledge that altering this behaviour would result in a breaking change. So I propose enhancing commitCharacters to accept as an alternative an array of objects structured as {character: string, inject: boolean}
Another strategy might be to add an insertSnippet method to TextEdit (equivalent to that method that already exists on TextEditor). Then my CompletionItem could invoke this via additionalTextEdits and specify a suitably-shortened snippet e.g.
new vscode.SnippetString('${1:expr}, ${2:dlm}, ${3:int})$0')
Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.
@jrieken thanks for finding the dup. What do you think of my proposal about enhancing commitCharacters? Would you accept a PR? I'm asking here rather than on #42544 because that one is locked despite being open.
Ops, unlocked. Yeah, the proposal does seem reasonable but I didn't spend too much time thinking of it. Tho, it won't be easy to implement because commit characters work with a typing listener that has no chance of preventing. Some "delete that character before inserting the snippet" logic will be needed...
Issue Type: Bug
In the first part of the recording, when the
(
specified incommitCharacters
accepts the suggestion notice how VSCode injects that character into the first field of theinsertText
snippet. This is unwanted.In contrast, see how the CompletionItem behaves as intended if the suggestion is accepted by pressing 'Tab'.
I acknowledge that altering this behaviour would result in a breaking change. So I propose enhancing
commitCharacters
to accept as an alternative an array of objects structured as{character: string, inject: boolean}
@jrieken what do you think?
VS Code version: Code 1.37.1 (f06011a, 2019-08-15T16:17:55.855Z)
OS version: Windows_NT x64 10.0.17134
The text was updated successfully, but these errors were encountered: