-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: Don't suggest unstable items on stable toolchain #14549
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
feat: Don't suggest unstable items on stable toolchain #14549
Conversation
This happens with a lot of additions we'd want, its a bit unfortunate but I am unsure how we can restructure things to prevent that so it's fine. Also related issue to the PR #3021 |
@bors r+ |
☀️ Test successful - checks-actions |
!ctx.is_item_hidden(&import.item_to_import) | ||
&& !ctx.is_item_hidden(&import.original_item) | ||
let item = &import.item_to_import; | ||
!ctx.is_item_hidden(item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you want to do !ctx.is_item_hidden(&import.original_item)
here?
The preview window doesn't show it but you're doing !ctx.is_item_hidden(item)
twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, you're right! Thanks for catching this. Will file another PR shortly!
&& !ctx.is_item_hidden(&import.original_item) | ||
let item = &import.item_to_import; | ||
!ctx.is_item_hidden(item) | ||
&& !ctx.is_item_hidden(item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here as well
…=Veykril Fix faulty variable extraction Followup to #14549 Fixes #14549 (comment) and #14549 (comment)
@lowr no idea why, I have a vanilla rustup setup. |
Closes #3020
This PR implements stability check in
ide-completion
so that unstable items are only suggested if you're on nightly toolchain.It's a bit unfortunate
CompletionContext::check_stability()
is spammed all over the crate, but we should call it before buildingCompletionItem
as you cannot get attributes on the item it's completing from that struct. I looked up every callsite ofBuilder::add_to()
,Completions::add[_opt]()
, andCompletions::add_all()
and inserted the check wherever necessary.The tests are admittedly incomplete in that I didn't add tests for every kind of item as I thought that would be too big and not worthwhile. I copy-pasted some existing basic tests in every test module and adjusted them.