This allows fetching crate limits like `recursion_limit`. The
implementation is currently dummy and just returns the defaults.
Future work: Use this query instead of the hardcoded constant.
Future work: Actually implement this query by parsing
`#![recursion_limit = N]` attribute.
11288: Support <code> blocks from Rust docs in vscode hover r=oandrew a=oandrew
Set `"supportHtml": true` to support rendering `<code>` blocks in hovers.
e.g. 1bd4fdc943/library/std/src/fs.rs (L109)
Co-authored-by: Andrew Onyshchuk <andryk.rv@gmail.com>
11354: fix: More correct `$crate` handling in eager macros r=jonas-schievink a=jonas-schievink
Fixes a few of the additional bugs in https://github.com/rust-analyzer/rust-analyzer/issues/10300, but not yet that issue itself.
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11348: fix: Fix merge commit check for git 2.35 r=jonas-schievink a=jonas-schievink
git 2.35 introduces a [change in behavior](89bece5c8c/Documentation/RelNotes/2.35.0.txt (L330-L333)) that breaks this check.
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11347: fix: Fix resolution of eager macro contents r=jonas-schievink a=jonas-schievink
Eager macros resolve and expand any contained macro invocations before they are expanded. The logic for this was previously pretty broken: any nameres failure would be reported as a generic macro expansion error, so this didn't work correctly with the fixed-point resolution loop. This manifested as spurious errors whenever a non-legacy macro was used in an eager macro (that means *any* path with more than one segment).
After an intense staring contest with the abyss, this PR fixes the basic logic, but some bugs still remain (particularly around `$crate`). As a side-effect, this PR moves `ModPath` into `hir_expand`.
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11345: minor: fix a typo in the style guide r=Veykril a=WaffleLapkin
An example of preferring `<`/`<=` over `>`/`>=` was using `>`.
Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
11281: ide: parallel prime caches r=jonas-schievink a=jhgg
cache priming goes brrrr... the successor to #10149
---
this PR implements a parallel cache priming strategy that uses a topological work queue to feed a pool of worker threads the crates to index in parallel.
## todo
- [x] should we keep the old prime caches?
- [x] we should use num_cpus to detect how many cpus to use to prime caches. should we also expose a config for # of worker CPU threads to use?
- [x] something is wonky with cancellation, need to figure it out before this can merge.
Co-authored-by: Jake Heinz <jh@discordapp.com>
11334: fix: don't panic in semantics due to `cfg_attr` disrupting offsets r=Veykril a=Veykril
Reduces the panic in https://github.com/rust-analyzer/rust-analyzer/issues/11298 to an early return, that means we won't resolve these cases again for now, but this is better than constantly panicking in highlighting and hovering.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
11327: internal: Remove redundant `Option` from eager macro fns r=jonas-schievink a=jonas-schievink
This isn't needed since `tt::Subtree` already implements `Default`, and an empty expansion is the appropriate default here.
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11314: fix: Don't load auxiliary crates outside the workspace r=jonas-schievink a=jonas-schievink
I'm a bit unsure about this change since this might have unanticipated consequences, but this does fix https://github.com/rust-analyzer/rust-analyzer/issues/11300.
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11311: fix: insert auto-imports after header comments r=repnop a=repnop
Fixes#8607.
This commit changes the auto-import functionality and causes it to add imports after any leading comments, which are commonly license headers. This does not affect comments on items as they're considered part of the item itself and not separate.
Co-authored-by: Wesley Norris <repnop@outlook.com>
Fixes#8607.
This commit changes the auto-import functionality and causes it to add
imports after any leading comments, which are commonly license headers.
This does not affect comments on items as they're considered part of the
item itself and not separate.
11308: fix: status: output all crates a file belongs to r=jonas-schievink a=jonas-schievink
While investigating https://github.com/rust-analyzer/rust-analyzer/issues/11300 I noticed that we only output the first crate, which masks the reason for that issue – the file in question is the root of multiple crates, and one is missing dependencies.
This PR makes "Rust Analyzer: Status" include *every* crate a file is part of.
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11307: fix: Allow macros to expand to or-patterns r=jonas-schievink a=jonas-schievink
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11097
Also simplifies the diagnostic slightly.
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>