fix: incorrect formatting of hover actions
fix#12728.
### Changes
- Use ` | ` as the separator for actions. (I'm not sure why we use `___` previously)
- Reorder actions to match codelens
fix: do not resolve prelude within block modules
fix#17338 (continuing from #17251).
In #17251, we injected preludes into non-top-level modules, which leading to r-a to directly resolve names in preludes in block modules. This PR fix it by checking whether the module is a pseudo-module introduced by blocks. (similar to what we do for extern preludes)
Changed package.json so vscode extension settings have submenus
There are a lot of options that are a part of rust-analyzer, sometimes it can be hard to find an option that you are looking for. To fix this I have put all configurations into categories based on their names. I have also changed the schema in `crates/rust-analyzer/src/config.rs` to reflect this.
Currently for each generated entry the title is redeclared, this does function but I am prepared to change this if it is a problem.
fix: Highlight unlinked files consistently with inactive files
Currently, rust-analyzer highlights the entire region when a `cfg` is inactive (e.g. `#[cfg(windows)]` on a Linux machine). However, unlinked files only highlight the first three characters of the file.
This was introduced in #8444, but users have repeatedly found themselves with no rust-analyzer support for a file and unsure why (see e.g. #13226 and the intentionally prominent pop-up added in PR #14366).
(Anecdotally, we see this issue bite our users regularly, particularly people new to Rust.)
Instead, highlight the entire inactive file, but mark it as all as unused. This allows users to hover and run the quickfix from any line.
Whilst this is marginally more prominent, it's less invasive than a pop-up, and users do want to know why they're getting no rust-analyzer support in certain files.
Before (note the subtle grey underline is only at the beginning of the first line):
![Screenshot 2024-06-05 at 5 41 17 PM](https://github.com/rust-lang/rust-analyzer/assets/70800/96f5d778-612e-4838-876d-35d9647fe2aa)
After (user can hover and fix from any line):
![Screenshot 2024-06-05 at 5 42 13 PM](https://github.com/rust-lang/rust-analyzer/assets/70800/6af90b79-018c-42b9-b3c5-f497de2ccbff)
chore: Update Cargo.lock to avoid yanked version
Building rust-analyzer currently generates a warning because libc 0.2.154 has been yanked. Update to 0.2.155 in Cargo.lock.
Currently, rust-analyzer highlights the entire region when a `cfg` is
inactive (e.g. `#[cfg(windows)]` on a Linux machine). However,
unlinked files only highlight the first three characters of the file.
This was introduced in #8444, but users have repeatedly found
themselves with no rust-analyzer support for a file and unsure
why (see e.g. #13226 and the intentionally prominent pop-up added in
PR #14366).
(Anecdotally, we see this issue bite our users regularly, particularly
people new to Rust.)
Instead, highlight the entire inactive file, but mark it as all as
unused. This allows users to hover and run the quickfix from any line.
Whilst this is marginally more prominent, it's less invasive than a
pop-up, and users do want to know why they're getting no rust-analyzer
support in certain files.
Feat: hide double underscored symbols from symbol search
Fixes#17272 by changing the default behavior of query to skip results that start with `__` (two underscores).
Not sure if this has any far reaching implications - a review would help to understand if this is the right place to do the filtering, and if it's fine to do it by default on the query.
If you type `__` as your search, then we'll show the matching double unders, just in case you actually need the symbol.
internal: Improve `find_path` performance
cc https://github.com/rust-lang/rust-analyzer/issues/17339, db80216dac should fix a case where we don't reduce our search space appropriately. This also adds a fuel system which really shouldn't ever be hit, hence why it warns
Don't mark `#[rustc_deprecated_safe_2024]` functions as unsafe
`std::env::set_var` will be unsafe in edition 2024, but not before it. I couldn't quite figure out how to check for the span properly, so for now we just turn the false positives into false negatives, which are less bad.
Add `Function::fn_ptr_type(…)` for obtaining name-erased function type
The use case of this function if being able to group functions by their function ptr type.
cc `@flodiebold`
fix: Only generate snippets for `extract_expressions_from_format_string` if snippets are supported
Part of #17332
Fixes `extract_expressions_from_format_string` so that it doesn't generate snippets if the client doesn't support it.