Lukas Wirth
8b1e8197fe
Merge iter_for_each_to_for and for_to_iter_for_each assists modules
2021-09-21 10:34:11 +02:00
Lukas Wirth
8b2be8572f
Rename some assists
2021-09-21 00:54:09 +02:00
longfangsong
cd599ec202
Address comments
2021-09-20 21:37:18 +08:00
bors[bot]
f1d7f98ed0
Merge #10293
...
10293: fix: Don't bail on parse errors in macro input for builtin expansion r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8158
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 22:33:42 +00:00
Lukas Wirth
e7e87fc69d
Don't bail on parse errors in macro input for builtin expansion
2021-09-20 00:33:13 +02:00
bors[bot]
b7bedf16a1
Merge #10289
...
10289: fix: Only strip derive attributes when preparing macro input r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10246
cc https://github.com/rust-analyzer/rowan/pull/114 , follow up to https://github.com/rust-analyzer/rust-analyzer/pull/10025
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 21:46:51 +00:00
Lukas Wirth
a6dde501df
Only strip derive attributes when preparing macro input
2021-09-19 23:38:38 +02:00
Lukas Wirth
9c39363ada
Simplify
2021-09-19 23:34:07 +02:00
Lukas Wirth
3987bf5d6f
Simplify
2021-09-19 19:00:06 +02:00
Aleksey Kladov
a6181bfdb7
internal: more focused tests for const arguments
2021-09-19 16:35:10 +03:00
Aleksey Kladov
09531b703d
minor: simplify
2021-09-19 14:50:53 +03:00
hamidreza kalbasi
0777698f29
internal: definition based hover functions
2021-09-19 16:15:44 +04:30
Aleksey Kladov
0005678649
minor: simplify
2021-09-19 14:26:35 +03:00
Aleksey Kladov
f99bdf4cc0
fix: don't allow two turbo-fishes in generic arguments
2021-09-19 12:09:50 +03:00
Aleksey Kladov
8ae1f9c335
internal: add erroneous test for double turbo fish
...
We parse `f` successfully, but that is a bug.
2021-09-19 11:42:10 +03:00
Aleksey Kladov
8009ccc27d
minor: improve readability
2021-09-19 11:34:25 +03:00
Aleksey Kladov
25adc5e9f0
minor: reduce duplication
2021-09-19 11:19:31 +03:00
bors[bot]
7729473dd2
Merge #10276
...
10276: internal: parser cleanup r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-18 13:09:51 +00:00
Aleksey Kladov
fbb6a6a95b
fix: correctly handle jointness
2021-09-18 16:09:12 +03:00
Aleksey Kladov
c0556bd8c1
minor: improve readability
2021-09-18 15:56:26 +03:00
Aleksey Kladov
ed84717869
internal: better naming
2021-09-18 15:55:07 +03:00
Aleksey Kladov
3dc2aeea0f
internal: parser cleanup
2021-09-18 15:46:28 +03:00
Aleksey Kladov
af9fd37cd9
internal: minimize use_tree parser tests
...
The code here is intentionally dense and does exactly what is written.
Explaining semantic difference between Rust 2015 and 2018 doesn't help
with understanding syntax. Better to just add more targeted tests.
2021-09-18 15:22:49 +03:00
bors[bot]
dd12521ac9
Merge #10275
...
10275: internal: parser cleanups r=Veykril a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-18 12:20:55 +00:00
Aleksey Kladov
1d2e9818d6
internal: parser cleanups
2021-09-18 14:53:46 +03:00
Aleksey Kladov
aaadaa40bd
internal: more focused trait item parsing tests
2021-09-18 14:34:29 +03:00
Lukas Wirth
6465868449
Make inlay hints work in attributed items
2021-09-18 13:19:29 +02:00
Lukas Wirth
11a17c803f
Add multi-token mapping test for goto_definition
2021-09-18 12:00:12 +02:00
bors[bot]
a435e49d34
Merge #10252
...
10252: fix: make `goto_definition` multi-token mapping aware r=Veykril a=XFFXFF
Implement #10070 in [`goto_definition`](https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_definition.rs )
Co-authored-by: zhoufan <1247714429@qq.com>
2021-09-18 01:21:43 +00:00
zhoufan
227450f9b9
do comment handling on the original token
2021-09-18 08:22:57 +08:00
bors[bot]
7c03200d70
Merge #10267
...
10267: Narrow "if-let to match" assist available range r=Veykril a=rainy-me
ref: https://github.com/rust-analyzer/rust-analyzer/issues/10220
Co-authored-by: rainy-me <github@rainy.me>
2021-09-17 22:44:39 +00:00
Aleksey Kladov
3474e3b3b1
intenral: more local tests for statics
2021-09-18 01:02:43 +03:00
Aleksey Kladov
1feb8e89d5
minor: cleanup const parsing
2021-09-18 00:58:35 +03:00
Aleksey Kladov
46326b8db7
minor: better test placement
2021-09-18 00:54:03 +03:00
Aleksey Kladov
2195ecd7e7
internal: cleanup adt parsing
2021-09-18 00:50:27 +03:00
Aleksey Kladov
d890c767c4
internal: cleanup item parsing
2021-09-18 00:33:42 +03:00
Aleksey Kladov
ec2043a082
minor: parser cleanup
2021-09-18 00:14:20 +03:00
Aleksey Kladov
4d2956e775
minor: simplify
2021-09-17 23:31:37 +03:00
rainy-me
11fbafdee3
Narrow "if-let to match" assist available range
2021-09-18 05:28:52 +09:00
Aleksey Kladov
366d3d7544
minor: cleanup
2021-09-17 23:27:26 +03:00
bors[bot]
4badd2faf8
Merge #10265
...
10265: internal: parser cleanups r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-17 19:27:32 +00:00
Aleksey Kladov
329b01ca67
minor: simplify
2021-09-17 22:26:39 +03:00
Aleksey Kladov
77e8421d0f
internal: more local parsing tests for macros
2021-09-17 22:21:57 +03:00
Aleksey Kladov
073d5f7733
internal: more focused parsing tests
2021-09-17 22:15:12 +03:00
Aleksey Kladov
55078c81e0
internal: more local test for mod item
2021-09-17 21:53:24 +03:00
Aleksey Kladov
715cd8d938
internal: more local parsing tests
2021-09-17 21:49:01 +03:00
Aleksey Kladov
f632b5e481
internal: parser cleanups
2021-09-17 21:40:28 +03:00
bors[bot]
d44779f8a5
Merge #10260
...
10260: fix: fix names generation in `Generate function` r=Veykril a=iDawer
- Improve fn name computation (close #10176 ).
- Handle tuple indexing expressions in argument position (should close #10241 )
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-17 18:35:36 +00:00
Dawer
0ff271d38f
fix completion handler trying to seek outside of character boundaries.
...
With this patch, in these examples
```rust
fn main() {
"⊞$0";
}
```
```rust
struct S {
д$0 u8
}
```
entering ':' character in `$0` places shouldn't cause panics.
2021-09-17 23:04:20 +05:00
bors[bot]
00b19846c9
Merge #10257
...
10257: assists: turn while into loop r=Veykril a=agluszak
Implements an assist to turn a `while` loop into a `loop` loop, as requested in #10214 .
I'm not sure sure what the guidelines are regarding naming assists convert_x_to_y vs replace_x_with_y.
This is my first commit to rust-analyzer :D Thank you `@matklad` for your awesome Explaining rust-analyzer series <3
Closes #10214
Co-authored-by: Andrzej Głuszak <gluszak.andrzej@gmail.com>
2021-09-16 21:04:42 +00:00
Andrzej Głuszak
11a56f886b
assists: turn while into loop
2021-09-16 22:20:27 +02:00
Dawer
1d94e234d5
Handle tuple indexing expression in argument position in Generate function
2021-09-16 23:45:41 +05:00
Dawer
4dc33140a3
Imrove fn name computation in Generate function
2021-09-16 21:03:37 +05:00
teor
e0a501424c
Fix a comment typo in autoderef.rs
2021-09-16 13:47:01 +10:00
zhoufan
ea3535cefc
fix: multi-token mapping aware goto definition
2021-09-16 09:44:22 +08:00
bors[bot]
959c7ef563
Merge #10250
...
10250: internal: Improve call_hierarchy and incoming/outgoing_calls r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-16 00:26:32 +00:00
Lukas Wirth
d777eddf0d
Improve call_hierarchy and incoming/outgoing_calls
2021-09-16 02:25:02 +02:00
bors[bot]
c577e128fc
Merge #10248
...
10248: internal: remove dead code r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-15 18:23:46 +00:00
Aleksey Kladov
73b0f9dc04
internal: remove dead code
2021-09-15 21:22:06 +03:00
bors[bot]
911659a166
Merge #10048
...
10048: fix: correctly complete macro call if cursor at `!` r=Veykril a=unexge
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9904
Co-authored-by: unexge <unexge@gmail.com>
2021-09-15 18:13:09 +00:00
bors[bot]
4c9eef7ede
Merge #10233
...
10233: fix: add multi-token mapping support to hovers r=Veykril a=spookyvision
implement #10070 in [`hover`](https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/hover.rs )
Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
2021-09-15 16:36:33 +00:00
Anatol Ulrich
45090e4f4b
add multi-token mappings for hover
2021-09-15 18:05:53 +02:00
Anatol Ulrich
b251a30819
# This is a combination of 3 commits.
...
# This is the 1st commit message:
add multi-token mappings for hover
# The commit message #2 will be skipped:
# make fallback an Option instead of vec
# The commit message #3 will be skipped:
# fix indentation
2021-09-15 18:04:45 +02:00
Lukas Wirth
33cdc21832
Don't highlight unsafe traits as unsafe in safe impls
2021-09-15 15:46:45 +02:00
Lukas Wirth
64fb7be247
Revert attributed items inlay hints
2021-09-14 20:30:28 +02:00
Lukas Wirth
747f2d1719
fix: Do not wrap inlined local in parens when at block tail position
2021-09-14 18:29:34 +02:00
bors[bot]
f750eebd0d
Merge #10232
...
10232: internal: Add more tests for ide functionality in attributed items r=Veykril a=Veykril
cc https://github.com/rust-analyzer/rust-analyzer/issues/9868
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-14 12:54:00 +00:00
Lukas Wirth
0f4463e45e
fix source_to_def trying to use attribute macro calls as containers
2021-09-14 14:42:14 +02:00
Lukas Wirth
d1e489185f
Pick smaller node ancestors first when descending at offset
2021-09-14 14:10:59 +02:00
Lukas Wirth
538ac599d2
Add some more attribute ide tests
2021-09-14 03:57:29 +02:00
Lukas Wirth
6f9de71402
fix: Use original definition ranges for ide_db::search instead of the expanded ranges
2021-09-14 02:49:06 +02:00
bors[bot]
e896def412
Merge #10204
...
10204: feat: Show the type of what is being dereferenced in a deref expression. r=theo-lw a=theo-lw
Addresses issue #10106 .
In-progress - I'm trying to figure out why `hover_deref_expr_with_coercion` is failing.
Co-authored-by: Teddy_Wang <wangtheo662@gmail.com>
2021-09-14 00:41:17 +00:00
Teddy_Wang
8de5d66e25
Improve hover over derference message
2021-09-13 20:19:30 -04:00
bors[bot]
e08b3bf70b
Merge #10231
...
10231: feat: Make inlay hints work in attributed items r=Veykril a=Veykril
![image](https://user-images.githubusercontent.com/3757771/133172697-8563329f-e77e-46e4-86ab-99b50040dfd5.png )
Note the lack of chaining hints, this is currently due to macro expansion lacking the input whitespace. We might be able to recover this from the input somehow in the future.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10043
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-14 00:07:50 +00:00
Lukas Wirth
e193e3b076
feat: Make inlay hints work in attributed items
2021-09-14 01:59:45 +02:00
Teddy_Wang
4d9728ccb2
Fix hover tests
2021-09-13 19:47:53 -04:00
bors[bot]
42617231bd
Merge #10230
...
10230: fix: fix expansion order for fn-like macros and attributes in token descending r=Veykril a=Veykril
Second attempt(now with a test 🎉 ).
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10115
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-13 23:24:33 +00:00
Lukas Wirth
8f76e41e18
Enable attribte macros in ide fixtures
2021-09-14 01:23:13 +02:00
Lukas Wirth
bb946f78f6
fix: fix expansion order for fn-like macros and attributes in token descending
2021-09-14 01:20:43 +02:00
Teddy_Wang
0c6a993f59
Fix spelling
2021-09-13 19:16:10 -04:00
bors[bot]
249ebdd076
Merge #10229
...
10229: fix: do not complete builtin attributes for qualified paths r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-13 22:31:39 +00:00
Lukas Wirth
845904f0bb
fix: do not complete builtin attributes for qualified paths
2021-09-14 00:31:14 +02:00
bors[bot]
6eecd84771
Merge #10126
...
10126: feat: Speculatively expand attributes in completions r=Veykril a=Veykril
![j1OjBt5Nca](https://user-images.githubusercontent.com/3757771/133163858-91930072-1441-4ce4-9979-b0ad2727b47f.gif )
Fixes #9866
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-13 22:22:08 +00:00
Lukas Wirth
dfb94d09d4
Exclude test file from rust tidy check
2021-09-14 00:21:16 +02:00
Lukas Wirth
aa1b36dc6d
Downmap the token in attribute inputs when expanding speculatively
2021-09-14 00:04:04 +02:00
bors[bot]
bcf0072bb4
Merge #10199
...
10199: fix: Fix Cargo.toml change detection r=lnicola a=lnicola
Maybe fixes #9546
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-09-13 18:14:20 +00:00
Laurențiu Nicola
4d7a3bb5c7
Shuffle code around to avoid an allocation
2021-09-13 21:06:31 +03:00
Lukas Wirth
2b907652ee
Speculatively expand attributes in completions
2021-09-13 19:30:23 +02:00
bors[bot]
c3eb646487
Merge #10225
...
10225: internal: Add proc-macro fixture directive r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-13 17:07:23 +00:00
Lukas Wirth
a044175412
Simplify
2021-09-13 18:50:19 +02:00
Lukas Wirth
edc915fbb6
Add proc-macro fixture directive
2021-09-13 18:37:50 +02:00
Laurențiu Nicola
8875f2c8aa
Fix Cargo.toml change detection
2021-09-13 19:15:17 +03:00
Aleksey Kladov
46cdde75f8
internal: document tribal knowledge of how to assist
2021-09-13 14:19:10 +03:00
Aleksey Kladov
076c972e3b
internal: prevent possible bugs when adding magical comments
2021-09-13 13:43:13 +03:00
Aleksey Kladov
c56f041477
internal: simplify
2021-09-13 13:35:31 +03:00
Aleksey Kladov
940b3afd00
internal: fix bugs in tests by simplifying code
2021-09-13 13:29:27 +03:00
Aleksey Kladov
80991356e1
minore: improve readability
...
Tuples are hard to understand
2021-09-13 12:34:05 +03:00
Lukas Wirth
95746a99b4
Use correct file syntax node for decl_access computation in find_all_refs
2021-09-12 23:19:23 +02:00
bors[bot]
3e056b9e90
Merge #10213
...
10213: minor: Improve resilience of match checking r=flodiebold a=iDawer
In bug condition the match checking strives to recover giving false no-error diagnostic.
Suggested in https://github.com/rust-analyzer/rust-analyzer/pull/9105#discussion_r644656085
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-12 12:23:56 +00:00
Dawer
68dfe190ab
Improve resilience of match checking
...
In bug condition the match checking strives to recover giving false no-error diagnostic.
2021-09-12 16:03:12 +05:00