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

Show deprecation warning in completion list #3480

Closed
TonalidadeHidrica opened this issue Nov 23, 2021 · 7 comments
Closed

Show deprecation warning in completion list #3480

TonalidadeHidrica opened this issue Nov 23, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@TonalidadeHidrica
Copy link

Is your feature request related to a problem? Please describe.
When I choose an item from a completion list, not until a warning is shown that I realize that the selected item is actually deprecated.

Describe the solution you'd like
I want a deprecation mark like ⚠️ shown before the item, or a strikethrough over the item name.

Describe alternatives you've considered
We may alternatively (or also) show that it is deprecated in the docs window shown when we pre-select the completion.

Additional context
Specifically I want this feature for rust-analyzer. I first asked rust-analyzer for this feature to be informed that the LSP already provides such diagnostic and is available in VSCode. (A screenshot is included in that issue.)

@oblitum
Copy link
Member

oblitum commented Nov 23, 2021

coc.nvim already does this, if it comes as diagnostics warning/info, you can check that with typescript + coc-tsserver for example.

What it doesn't do is this:

rust-analyzer uses semantic tokens and/or completion tags, and coc doesn't yet fully provide that.

@TonalidadeHidrica
Copy link
Author

I realized that I wrote a little bit confusing description, sorry for that. So let me summarize; let me know if I said something wrong.

There are at least three ways for Language Servers to tell that an item is deprecated:

  • Through diagnostics. LS points out through diagnostics that some part of a code is using deprecated function etc..
    • This can also be viewed in :CocList diagnostics.
    • You pointed out that it is already available in typescript + coc-tsserver, right? Yes, it indeed works in coc-rust-analyzer, too.
  • Through semantic tokens. That is a concept I have never heard of, but perhaps that is an additional information attached to tokens which are sent from LS as a result of its tokenization, isn't it?
  • Through completion tags. I didn't know that either, but probably this is what I want, which probably comes with each entry in completion list given from LS.

And you said that the latter two is not entirely supported by coc.nvim.

Is there already an issue that specifically ask for this kind of features in completion list? If there is, please close the issue; otherwise I'll leave it as a ticket of feature request.

@oblitum
Copy link
Member

oblitum commented Nov 23, 2021

You can keep the ticket, there isn't an specific issue that covers either of the two latter ones.

perhaps that is an additional information attached to tokens which are sent from LS as a result of its tokenization, isn't it?

Yes, it's that, and comes as "deprecated" semantic token "modifier".

You most probably is pointing for completion tag, as the semantic token modifier would present itself in source code strikethrough highlighting.

@TonalidadeHidrica
Copy link
Author

@oblitum Thanks. I additionally filed another issue on semantic tokens in #3481.

@oblitum
Copy link
Member

oblitum commented Nov 23, 2021

@TonalidadeHidrica okay. Notice a strikethrough over some pum items is in fact not possible due to vim/nvim limitation, pum doesn't support syntax highlighting. So the only way out (with pum) is by means of a glyph mark.

@oblitum
Copy link
Member

oblitum commented Nov 23, 2021

To have that with completion you have to ditch vim/nvim native completion system and reimplement it through vim-popups/nvim-floating-windows, like nvim-cmp has done.

@chemzqm
Copy link
Member

chemzqm commented Dec 21, 2021

Not too hard to implement completion pum by using float window or popup, but lots of details and break changes of how completion works.

Vote for the feature if you really like it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants