-
-
Notifications
You must be signed in to change notification settings - Fork 330
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
All completion items are shown as snippets #992
Comments
The real reason is that I am lazy. |
@sumneko Are you saying that only some completion items should be marked with insertTextFormat set to 2, but you just set every completion item's insertTextFormat to 2, instead of only the items that are actually snippets, because its easier? |
These changes seemed to fix it:
and
|
Or, for
|
Yes, because I assume that if the text does not have any |
- snipData.kind = define.CompletionItemKind.Snippet
+ -- snipData.kind = define.CompletionItemKind.Snippet Why modify this line? |
That line, if not commented, will have the completion popup show the item as a snippet, rather than, say, a function. At least with https://github.com/prabirshrestha/asyncomplete.vim. The items have a '~' after them to indicate they are a snippet, and it will show, to the right of the item in the completion popup, "function", "snippet", "method", etc. In other words, with that patch, instead of the functions in asyncomplete showing up as snippets, they will show up as functions, but a '~' will indicate anything that is expandable. I am not sure how this change will effect other lsp clients. I didn't look into the code too much, so you'll have to verify these changes. |
Actually, perhaps that should not be commented. The problem is that if 'Lua.completion.callSnippet' is set to 'Replace', then it shows as a snippet, which is correct behavior. But there is no way of knowing if it is a function, method, etc, as it will show up as just "snippet". If setting it to "Both", then it shows the function and the snippet, which works, but seems like a lot of extra items. I found a solution. With the following, the kind will only be set to
For example, with asyncomplete, Completion popup for original
|
Let me know if you want me to make a pull request. |
This sounds good, you can make a PR about it, thank you! About ...
writeText(getCursorPos(), getItemText())
setCursorPos(getCursorPos() + #getItemText())
if insertTextFormat == 2 then
local cursorMap = resolveSnipPos()
if cursorMap then
setCursorPosByMap(cursorMap)
end
end
... |
@yoshi1123 |
The issue in the title was resolved, but the issue brought up in the initial post's body text was not. I have a PR here: #3005 |
Describe the bug
The language server seems to send
"insertTextFormat": 2
for all completion items, in a response to 'textDocument/completion' requests.For example,
insertTextFormat
should be set to '1' because '2' is for snippets (https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#insertTextFormat). Thus the client might display all completions as snippets.The text was updated successfully, but these errors were encountered: