-
Notifications
You must be signed in to change notification settings - Fork 411
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
Tsserver now provides snippet completion, does this unblock arg ghost-test in completions? #646
Comments
Looking at the linked pull request to the TS repository (microsoft/TypeScript#43149), I'm inclined to believe that there has been a misunderstanding here. TSServer currently implements snippet completions only for autoimports, and not for filling out function call parameters. Here's the closest I could find to a "tracking issue" for support of snippets in TSServer: microsoft/TypeScript#25207, and it says that "method completions are currently implemented by VSCode manually" (a look into the built-in VSCode extension for Typescript confirms that: 1, 2, 3). So yeah, right now typescript-language-server does, in fact, support snippets in completion, just not the kind of snippets you were hoping for. |
@dmitmel Please ignore my ignorance, JS is a complicated ecosystem. I have seen this release a while ago and tried to set it up with no success. I am referring to second item on the list:
That's different to tsserver, isn't it? But isn't it what |
Oh, I think I have found the issue. The PR you mentioned, typescript-language-server/typescript-language-server#303, does implement this functionality, and typescript-language-server does return snippets for function calls if you set the setting |
Thanks @dmitmel |
Hm... The LSP spec seems to define the resolvable properties in capabilities. OK. I'll add it. |
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: - [x] Make this work over collab - [x] Test that this doesn't break existing language server support - [x] 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: https://github.com/zed-industries/zed/assets/1185253/c23ebe12-5902-4b50-888c-d9b8cd32965d
According to neovim/nvim-lspconfig#1259 tsserver supports snippet completion now. Does this mean that ghost-text for args can now work? Is there something that needs to be set in capabilities to get it working?
Apologies if I'm misunderstanding the issue.
Previously closed issue for reference:
The ghost text content is determined by the LSP server (or custom source).
For example, gopls will show the function arguments as ghost text. So it is depending on the your server. I can't support it in nvim-cmp. Sorry.
Originally posted by @hrsh7th in #503 (comment)
The text was updated successfully, but these errors were encountered: