Commit Graph

18909 Commits

Author SHA1 Message Date
Johann Hemmann
bfc2e568dd Add tests for intra-doc links
The first one succeeds because the functionality is already implemented.
The second one fails and represents the functionality to be implemented
in this PR.
2024-01-18 12:59:43 +01:00
Johann Hemmann
f913d4f4b7 Refactor if-else 2024-01-18 12:59:43 +01:00
bors
1ab8c7fd27 Auto merge of #16349 - Young-Flash:use_error_recovery, r=Veykril
fix: add error recovery for use_tree_list parsing

This PR adds error recovery for USE_TREE_LIST parsing, avoid the wrong USE_TREE_LIST making the rest parsing incorrectly.

before

![before](https://github.com/rust-lang/rust-analyzer/assets/71162630/c6643690-f25c-4ad9-93d9-e661ba5b1dc3)

after

![after](https://github.com/rust-lang/rust-analyzer/assets/71162630/30a58c40-2711-48d2-b2e5-fb208fc8636c)

close https://github.com/rust-lang/rust-analyzer/issues/16227
2024-01-18 09:52:37 +00:00
Young-Flash
1c61326ca0 add use_tree_completion test 2024-01-18 17:35:01 +08:00
bors
2dfa9b86d0 Auto merge of #16384 - Veykril:smolstr, r=Veykril
minor: Make use of some new `SmolStr` improvements
2024-01-18 09:30:45 +00:00
roife
04ce4ce440 internal: speedup LineEndings calculation using 'memchr' 2024-01-18 17:03:29 +08:00
davidsemakula
84a3b52a10 properly order raw idents when ordering use trees 2024-01-17 21:46:19 +03:00
Lukas Wirth
83591268ab minor: Make use of some new SmolStr improvements 2024-01-17 13:47:15 +01:00
bors
5b62ebc23f Auto merge of #16383 - Veykril:progress, r=Veykril
fix: Fix progress reporting getting stuck

Fixes https://github.com/rust-lang/rust-analyzer/issues/16382
2024-01-17 12:24:43 +00:00
Lukas Wirth
0bdbf497b6 fix: Fix progress reporting getting stuck 2024-01-17 13:23:00 +01:00
Johann Hemmann
76c67dd229 Fix test 2024-01-17 12:49:58 +01:00
Johann Hemmann
5916da2c29 Handle macro_rules! as MACRO_CALL
It's a call of the third token is neither IDENT or TRY
2024-01-17 12:07:17 +01:00
bors
2b02df27c5 Auto merge of #16380 - Veykril:sysroot-ci, r=Veykril
Run metadata on sysroot for CI metrics
2024-01-17 09:33:14 +00:00
bors
f4fec4ff65 Auto merge of #16378 - roife:fix/issue-15470, r=Veykril
fix: better handling of SelfParam in assist 'inline_call'

fix #15470.

The current `inline_call` directly translates `&self` into `let ref this = ...;` and `&mut self` into `let ref mut this = ...;`. However, it does not handle some complex scenarios.

This PR addresses the following transformations (assuming the receiving object is `obj`):

- `self`: `let this = obj`
- `mut self`: `let mut this = obj`
- `&self`: `let this = &obj`
- `&mut self`
  + If `obj` is `let mut obj = ...`, use a mutable reference: `let this = &mut obj`
  + If `obj` is `let obj = &mut ...;`, perform a reborrow: `let this = &mut *obj`
2024-01-17 08:43:13 +00:00
Lukas Wirth
21723cb051 Run metadata on sysroot for CI metrics 2024-01-17 09:43:04 +01:00
roife
920e99aacb test: add tests for variant kinds of SelfParam in inline_call 2024-01-17 14:19:57 +08:00
roife
d48498f360 fix: better handling of SelfParam in inline_call 2024-01-17 13:49:07 +08:00
Lukas Wirth
0a75a8c061 Notable traits for type info hovers 2024-01-16 20:15:31 +01:00
Lukas Wirth
ffeaee84af Goto type actions for notable trait hovers 2024-01-16 19:59:55 +01:00
Lukas Wirth
82e8355492 feat: Show notable trait impls on hover 2024-01-16 19:17:33 +01:00
roife
7c94c29648 fix: make let_stmts inserted in inline_call correctly indented 2024-01-16 21:42:29 +08:00
Lukas Wirth
384488c157 feat: Hover for literals showing additional value information 2024-01-16 14:28:47 +01:00
Lukas Wirth
6584e63506 minor: Simplify 2024-01-16 13:36:07 +01:00
bors
0a8c7841e0 Auto merge of #16352 - davidsemakula:rustfmt-import-sort-algo, r=Veykril
internal: Follow rustfmt's algorithm for ordering imports when ordering and merging use trees

Updates use tree ordering and merging utilities to follow rustfmt's algorithm for ordering imports.
The [rustfmt implementation](6356fca675/src/imports.rs) was used as reference.
2024-01-16 11:23:03 +00:00
bors
63c4e6993f Auto merge of #16367 - Veykril:value-ty, r=Veykril
fix: Make `value_ty` query fallible
2024-01-16 11:11:31 +00:00
Lukas Wirth
8f4f5a6cce fix: Make value_ty query fallible 2024-01-16 12:09:40 +01:00
davidsemakula
1f91c487a2 move is_upper_snake_case to stdx 2024-01-16 13:37:22 +03:00
davidsemakula
5b2a2bc3fb remove unnecessary ref patterns 2024-01-16 13:26:49 +03:00
bors
2d5ce888de Auto merge of #16366 - Veykril:transp-queries, r=Veykril
internal: Make data queries transparent over their diagnostics variant

And a few other QoL things
2024-01-16 10:09:05 +00:00
Lukas Wirth
f675b5ead8 Don't early exit on panics in rustc_tests command 2024-01-16 11:05:50 +01:00
Lukas Wirth
54f2111f69 internal: Make data queries transparent over their diagnostics variant 2024-01-16 10:47:54 +01:00
Lukas Wirth
90a1b484f7 Render AstIds in item-tree view 2024-01-16 10:47:28 +01:00
Lukas Wirth
cf905cff76 Put layout comment to the top of hovers 2024-01-16 10:46:53 +01:00
Lukas Wirth
659d4f91e4 Impl fmt::Display for Span 2024-01-16 10:46:09 +01:00
bors
c9afd41219 Auto merge of #15636 - 9999years:show-which-roots-are-scanned, r=Veykril
Show which roots are being scanned in progress messages

This changes the `Roots Scanned` message to include the directory being scanned.

Before: `Roots Scanned 206/210 (98%)`
After: `Roots Scanned 206/210: .direnv (98%)`

This makes it a lot easier to tell that `rust-analyzer` isn't crashed, it's just trying to scan a huge directory.

See: #12613
2024-01-16 09:44:56 +00:00
Lukas Wirth
398150827f Rename Message::Progress::file field to dir 2024-01-16 10:43:33 +01:00
bors
87e609aa9c Auto merge of #15868 - wasd96040501:fix/symlink2, r=Veykril
fix: failed to infer OUT_DIR when workspace root contains symlink

fix #15867
2024-01-16 09:23:54 +00:00
bors
5df53c9612 Auto merge of #16351 - Veykril:eager-enum-variant, r=Veykril
internal: Eagerly lower enum variants in CrateDefMap construction
2024-01-16 08:39:13 +00:00
Moritz Hedtke
fe35447617 fix: rename generator to coroutine also in dependencies
Follow the rename in nightly (see https://blog.rust-lang.org/inside-rust/2023/10/23/coroutines.html)
2024-01-15 12:24:48 +01:00
Moritz Hedtke
f937673ce2 fix: rename generator to coroutine
Follow the rename in nightly (see https://blog.rust-lang.org/inside-rust/2023/10/23/coroutines.html)
2024-01-15 12:24:47 +01:00
Moritz Hedtke
a356172f92 internal: re-generate lints.rs 2024-01-15 12:24:47 +01:00
Lukas Wirth
180e9b2bbf Cleanup 2024-01-15 12:22:51 +01:00
Lukas Wirth
1669344b2a Thinner DefDiagnostics 2024-01-15 11:07:26 +01:00
Lukas Wirth
2d72ec71ec Deduplicate 2024-01-15 10:58:05 +01:00
Lukas Wirth
d80d2fcae0 Eagerly lower enum variants in CrateDefMap construction 2024-01-15 10:24:14 +01:00
Lukas Wirth
c7eb52dd7b internal: Add unstable config for loading the sysroot sources via cargo metadata 2024-01-15 09:59:32 +01:00
davidsemakula
d4b43d5a51 improve ordered use tree merging implementation 2024-01-14 19:49:50 +03:00
davidsemakula
db3f0f1761 improve use tree simple path comparison logic 2024-01-12 18:23:58 +03:00
davidsemakula
22ae5f49ba order merged use trees 2024-01-12 17:05:23 +03:00
Young-Flash
6033b66ce0 test: correct expected test result 2024-01-12 17:42:18 +08:00