Add optional command to onAutoInsert response #7073
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The response item for this message is currently defined like this:
The purpose of this message is similar to inserting completions. However, it's lacking one thing that completion items provide - the ability to provide an optional command to retrigger completions for example.
This is especially useful for markup languages like XAML where you would use = as a trigger character to automatically insert the attribute quotes and place the caret in between, so that you would end up with this ="|". The expectation though is to offer completions for attribute values at this point, but there is currently no way to automatically trigger completions. This is made even more painful in VS Code where the default editor setting does not even trigger completions within strings.
I propose the following addition to the response item in the same way it exists for CompletionItem, which should be ignorable by any client that does not support the optional parameter:
I have a local prototype for the vscode-csharp extension that works just beautifully like this.