Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript: Complete function calls with snippets #11157

Merged
merged 8 commits into from May 2, 2024
Merged

Conversation

mrnugget
Copy link
Member

@mrnugget mrnugget commented Apr 29, 2024

This allows function call (i.e. snippet) completion with typescript-language-server. So far that didn't work, because typescript-language-server doesn't respond with insertText when getting the completions, but only when then sending completionItem/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:

  • Make this work over collab
  • Test that this doesn't break existing language server support
  • Refactor duplicated code

Release Notes:

  • Added support for function call completion when using typescript-language-server. This will result in parameters being added, which can then be changed and navigated with <tab>. For this to work with typescript-language-server, the documentation for a given completion item needs to be resolved, meaning that if one types very quickly and accepts completion before typescript-language-server could respond with the documentation, no full function completion is used.

Demo:

screenshot-2024-04-29-12.39.45.mp4

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Apr 29, 2024
@mrnugget mrnugget changed the title Mrn/ts ls snippets typescript: complete function calls with snippets Apr 29, 2024
@maxdeviant maxdeviant changed the title typescript: complete function calls with snippets typescript: Complete function calls with snippets Apr 29, 2024
@mrnugget mrnugget marked this pull request as ready for review May 2, 2024 08:47
@mrnugget mrnugget merged commit c812304 into main May 2, 2024
9 checks passed
@mrnugget mrnugget deleted the mrn/ts-ls-snippets branch May 2, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant