typescript: Complete function calls with snippets #11157
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.
This allows function call (i.e. snippet) completion with
typescript-language-server
. So far that didn't work, becausetypescript-language-server
doesn't respond withinsertText
when getting the completions, but only when then sendingcompletionItem/resolve
requests. See: hrsh7th/nvim-cmp#646 (comment)What this PR does is to support text edits in the response to
completionItem/resolve
, which means updating the completion item.It then enables this feature by default for
typescript-language-server
.TODOs:
Release Notes:
typescript-language-server
. This will result in parameters being added, which can then be changed and navigated with<tab>
. For this to work withtypescript-language-server
, the documentation for a given completion item needs to be resolved, meaning that if one types very quickly and accepts completion beforetypescript-language-server
could respond with the documentation, no full function completion is used.Demo:
screenshot-2024-04-29-12.39.45.mp4