Skip to content

Add ~ to completion items when insert-text #3209

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ericdallo
Copy link
Member

@ericdallo ericdallo commented Nov 14, 2021

This is a simple modification to enhance completion doing the same neovim does, showing a ~ on the end of the completion item if it will insert some kind of text rather than just the label, this is useful to user know that this completion item will do something other than just complete with the label.

Note: We can't rely only on snippet kind since it's possible and IMO makes sense for example to return a completion item saying that an item is of type function but will insert some other kind of text like clojure and rust, example:

lsp-mode
image

neovim
image

c/c @kiennq @yyoncho

For curiosity, I realized that on this issue

@ericdallo ericdallo changed the title Add to completion items when insert-text Add ~ to completion items when insert-text Nov 14, 2021
@yyoncho
Copy link
Member

yyoncho commented Nov 15, 2021

Can you have this behind a flag and turned off by default? I haven't seen anything like that in other ides and I don't think that neovim can be our UE guideline. We tend to follow the VSCode.

@kiennq
Copy link
Member

kiennq commented Nov 15, 2021

Can we use company-mode annotation for this instead?
That would also had better performance since we only adding the annotations for visible candidates instead of the whole list

@ericdallo
Copy link
Member Author

I didn't know about annotation, sounds good, I'll change it

@kiennq
Copy link
Member

kiennq commented Nov 16, 2021

Also, if we're using :annotation-function then we can do more accurate comparisons there, i.e,: compare the label to insert-text to make sure the display and the inserted is not the same, compare the edit-text as well if possible.

@diaevd
Copy link

diaevd commented Feb 2, 2022

I didn't know about annotation, sounds good, I'll change itI

I'm make similar changes with the company-transform function. Why change something at the lsp-completion level? For me this change will be breaking change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants