vuejs / vetur

Vue tooling for VS Code.
https://vuejs.github.io/vetur/
MIT License
5.74k stars 592 forks source link

Question: how to trigger additionalTextEdits ? #839

Closed roxma closed 6 years ago

roxma commented 6 years ago

I'm testing vls, LanguageClient-neovim and ncm2, with either ncm2-snipmate or ncm2-ultisnips

Currently snippets like attr="$1"$0 works well

But I want to add additionalTextEdits supports too. I don't know how to trigger this kind of completion. So I'm asking here for a use case that I can start to work with.

octref commented 6 years ago

Check out lsp-sample:

https://github.com/Microsoft/vscode-extension-samples/blob/master/lsp-sample/server/src/server.ts#L180-L198

You can add additionalTextEdits in onCompletion or onCompletionResolve. Or are you saying vls should provide some additionalTextEdits?

roxma commented 6 years ago

@octref

Thaks for the reply.

are you saying vls should provide some additionalTextEdits?

I'm saying when vls will send additionalTextEdits for completion. I need a specific user-end use case.

I noticed that there's autoImport in vetur configuration. Perhaps this is what additionalTextEdits is used for. But I don't know how to trigger autoImport. Where can I find the demo for this feature?

                "completion": {
                    "autoImport": true,
                    "useScaffoldSnippets": true
                },
octref commented 6 years ago

I see. Here's a gif. You can try it in this project: https://github.com/Microsoft/language-server-protocol-inspector

autoimport

Meanwhile you might find this Inspector useful: https://microsoft.github.io/language-server-protocol/inspector

You can set vetur.trace.server: "verbose" and save the log somewhere, then load it in the inspector to analyze it.

roxma commented 6 years ago

@octref Thanks for your help

This is what I've been working on:

https://github.com/autozimu/LanguageClient-neovim/pull/514

octref commented 6 years ago

@roxma Very nice, the only thing I'm missing from VS Code is consistent Vim commands :p