hamidreza kalbasi
e803bd25c4
add hover
2021-09-26 10:04:02 +03:30
hamidreza kalbasi
1103e390e0
cfg unix for tests with unix path
2021-09-26 10:04:02 +03:30
hamidreza kalbasi
5163201847
use utf16 instead of utf8
2021-09-26 10:04:02 +03:30
hamidreza kalbasi
557210a688
Begining of lsif
2021-09-26 10:04:02 +03:30
Aleksey Kladov
56964c9bd3
feat: allow attributes on all expressions
...
Attrs are syntactically valid on any expression, even if they are not
allowed semantically everywhere yet.
2021-09-25 22:19:27 +03:00
Aleksey Kladov
7dc331faef
fix: correct extend_to logic in parser
...
Previously we swapped to events in the buffer, but that might be wrong
if there aer `forward_parent` links pointing to the swapped-out node.
Let's do the same via parent links instead, keeping the nodes in place
2021-09-25 22:09:50 +03:00
Lukas Wirth
1ccb21a0ca
feat: Implement inline callers assist
2021-09-25 18:39:43 +02:00
bors[bot]
d401f2a062
Merge #10211
...
10211: assists: Promote module to folder r=jonas-schievink a=longfangsong
Close part of #10143 .
This PR adds a assist to promote module to directory, which means make a .rs file module into a directory style module with the same name.
![未命名(1)](https://user-images.githubusercontent.com/13777628/132958377-14555d6f-a64a-4b9b-9154-90a3b86fd685.gif )
Co-authored-by: longfangsong <longfangsong@icloud.com>
2021-09-25 15:32:00 +00:00
Aleksey Kladov
6997adfee7
simplify attribute parsing
2021-09-25 18:07:51 +03:00
longfangsong
22abbe86f3
Address comments
2021-09-25 22:48:57 +08:00
bors[bot]
0cb9ee2054
Merge #10346
...
10346: minor: align code with code-style r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-25 11:56:23 +00:00
Aleksey Kladov
5767f31cbf
minor: align code with code-style
2021-09-25 14:55:42 +03:00
Aleksey Kladov
929fca5adc
minore: improve consistency
2021-09-25 14:36:46 +03:00
Aleksey Kladov
f27cda6865
minor: more condensed tests
2021-09-25 14:24:57 +03:00
Aleksey Kladov
f692be853b
minor: link my own pratt parsing article :-)
2021-09-25 14:20:34 +03:00
Aleksey Kladov
d72f7cf3af
internal: add => () rule; emphasize n_items
rule
2021-09-25 14:10:25 +03:00
Aleksey Kladov
1567bbb73e
minor: more focusted tests
2021-09-25 14:04:27 +03:00
Aleksey Kladov
a6f17f7436
minor: more readable code
2021-09-25 13:27:53 +03:00
Jonas Schievink
7860d6ade6
Fix item-level lazy macro errors
2021-09-24 21:17:25 +02:00
Jonas Schievink
5967f3d3a9
Fix diagnostics in unnamed consts
2021-09-24 20:41:24 +02:00
bors[bot]
8b08666343
Merge #10334
...
10334: Give rustfmt spawn error context. r=jonas-schievink a=aDotInTheVoid
This mean if you misconfigure to
```json
{
"rust-analyzer.rustfmt.overrideCommand": [
"./nonono"
]
}
```
The error message is
```
[Error - 17:54:33] Request textDocument/formatting failed.
Message: Failed to spawn "./nonono"
Code: -32603
```
instead of
```
[Error - 17:56:12] Request textDocument/formatting failed.
Message: No such file or directory (os error 2)
Code: -32603
```
I'm not sure how to test this, or if it needs a test.
Co-authored-by: Nixon Enraght-Moony <nixon.emoony@gmail.com>
2021-09-24 17:07:18 +00:00
Jonas Schievink
b8eb63f2b2
Avoid some Arc
cloning
2021-09-24 18:57:08 +02:00
Nixon Enraght-Moony
720a3da4ac
Give rustfmt spawn error context.
2021-09-24 17:51:47 +01:00
bors[bot]
eb17e90eba
Merge #10105
...
10105: RfC: Use `todo!()` instead of `()` for missing fields r=jonas-schievink a=jo-so
Most commonly a field of a struct can be initialized with its default value than an empty tuple.
Co-authored-by: Jörg Sommer <joerg@jo-so.de>
2021-09-24 15:12:17 +00:00
bors[bot]
377476ac45
Merge #10332
...
10332: minor: Allow overwriting RUST_BACKTRACE for the server manually r=jonas-schievink a=Veykril
Trying to figure out why we aren't getting backtraces for windows builds from CI, this let's one set the backtraces to `FULL`
Might be cc https://github.com/rust-lang/rust/issues/87481
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-24 14:59:02 +00:00
bors[bot]
2117ba0235
Merge #10331
...
10331: minor: Include macro path in eager macro resolve error r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-24 14:51:19 +00:00
Lukas Wirth
983e19c868
Allow setting RUST_BACKTRACE for the server manually
2021-09-24 15:38:00 +02:00
Jonas Schievink
af3d6a4b61
Include macro path in eager macro resolve error
2021-09-24 15:34:57 +02:00
Carlos Menezes
0c49e3883c
Fix link to "Auto Import"
2021-09-24 13:59:44 +01:00
Lukas Wirth
bd8c95a580
Fix incorrect mod.rs handling in unlinked_file fixes
2021-09-24 14:20:43 +02:00
Lukas Wirth
e60f3d265f
Split the hover module up
2021-09-23 20:36:15 +02:00
Lukas Wirth
22c6f0a8a5
Support goto_def for intra-doc-links in macro invocations
2021-09-23 19:17:29 +02:00
Lukas Wirth
d99adc5738
Make hover work for intra doc links in macro invocations
2021-09-23 17:32:39 +02:00
Lukas Wirth
42eb4efb5b
Cleanup
2021-09-23 16:28:03 +02:00
bors[bot]
8a82e6c492
Merge #10284
...
10284: internal: definition based hover functions r=Veykril a=HKalbasi
This is part of #10181 but since it is blocked and `hover.rs` is moving quickly so will cause conflicts, I submitted this PR.
This PR extract some parts of `hover` to `find_definition` (maybe this need to be moved to some other file?) and `hover_for_definition`, with those functions I will be able to calculate definition of every token, and calculate hover (and probably other queries) for each definition only once.
Co-authored-by: hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
2021-09-22 15:23:23 +00:00
hamidreza kalbasi
589c1dfa04
move function to defs.rs
2021-09-22 18:35:54 +03:30
hamidreza kalbasi
18e6b508dd
remove dead code
2021-09-22 11:44:23 +03:30
hamidreza kalbasi
569ac5bee1
use find_definition in go to
2021-09-22 11:37:26 +03:30
zhoufan
8690cfb868
Change the style of the code
2021-09-22 06:32:23 +08:00
zhoufan
7912d3a4b3
Generate function assist creates bad param names for const/static item args
2021-09-22 00:15:57 +08:00
hamidreza kalbasi
887b7ddc37
fix derive hover in macro
2021-09-21 19:55:57 +04:30
Lukas Wirth
83e97adfff
Simplify
2021-09-21 16:15:30 +02:00
Lukas Wirth
b36f12dba5
Simplify
2021-09-21 16:05:21 +02:00
Lukas Wirth
6d6e0b8f21
Generate ast nodes for each ast trait
2021-09-21 15:52:11 +02:00
Lukas Wirth
ba84b91e78
Add a mirror function-like proc-macro expander for tests
2021-09-21 14:55:54 +02:00
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
Florian Diebold
a2d9f7d7bb
Avoid type inference panic on bitslice methods
...
Should fix #10090 , #10046 , #10179 .
This is only a workaround, but the proper fix requires some bigger
refactoring (also related to fixing #10058 ), and this at least prevents
the crash.
2021-09-12 10:49:40 +02:00
bors[bot]
317059985a
Merge #10202
...
10202: fix: Type param hover shows correct sized bounds. r=flodiebold a=iDawer
Closes #9949
This adds implicit `: Sized` bound to type parameters at lowering step.
Hovering on type parameter does not show it's `: Sized` bound be it set explicitly or implicitly. This is because it doesn't track that the bound was set implicitly.
### Perf
```rust
./target/rust-analyzer-baseline-3dae94bf -q analysis-stats --memory-usage .
Database loaded: 4.51s, 311minstr, 110mb (metadata 1.08s, 22minstr, 743kb; build 3.20s, 8730kinstr, -237kb)
crates: 38, mods: 770, decls: 17173, fns: 12835
Item Collection: 29.63s, 85ginstr, 372mb
exprs: 353460, ??ty: 364 (0%), ?ty: 232 (0%), !ty: 144
Inference: 118.25s, 284ginstr, 601mb
Total: 147.88s, 370ginstr, 973mb
./target/rust-analyzer-hover-ty-param-dfb15292 -q analysis-stats --memory-usage .
Database loaded: 4.53s, 311minstr, 110mb (metadata 1.10s, 22minstr, 743kb; build 3.20s, 8672kinstr, -189kb)
crates: 38, mods: 770, decls: 17173, fns: 12835
Item Collection: 29.59s, 85ginstr, 372mb
exprs: 353460, ??ty: 364 (0%), ?ty: 232 (0%), !ty: 144
Inference: 121.69s, 296ginstr, 601mb
Total: 151.28s, 382ginstr, 974mb
```
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-12 07:54:56 +00:00
longfangsong
cafc7e3501
Fix doc test
2021-09-12 11:20:28 +08:00
longfangsong
3edc25dc26
Add docs strings
2021-09-12 10:53:56 +08:00
longfangsong
fede1a3beb
Add promote_mod_file assist
2021-09-12 10:45:14 +08:00
Aleksey Kladov
9b2bac621e
minor: make code clearer with ControlFlow
2021-09-11 20:49:10 +03:00
bors[bot]
abdb75912c
Merge #10207
...
10207: minor: improve readability r=matklad a=matklad
It's important that module interface doesn't depend on features. Better
hide features in bodies.
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-11 15:46:36 +00:00
Aleksey Kladov
e5b813b566
minor: improve readability
...
It's important that module interface doesn't depend on features. Better
hide features in bodies.
2021-09-11 18:42:38 +03:00
Teddy_Wang
1d4d9a1e1a
Fix tests by importing core::ops::Deref
2021-09-11 11:40:16 -04:00
Giles Cope
15312aab58
removing seemingly unused dev deps.
2021-09-11 16:26:36 +01:00
Giles Cope
4ccd90af81
remove unused deps
2021-09-11 16:20:04 +01:00
Dawer
964c7b3211
minor: fix tests.
2021-09-10 23:02:37 +05:00
Dawer
dfb15292c2
fix: Type param hover shows correct sized bounds.
2021-09-10 20:48:39 +05:00
Dawer
9ce3c075ad
internal: add implicit : Sized
bound to type parameters.
2021-09-10 20:41:53 +05:00
bors[bot]
07fb5db3dc
Merge #10177
...
10177: fix: Treat path dependencies like workspace members r=jonas-schievink a=jonas-schievink
Closes https://github.com/rust-analyzer/rust-analyzer/issues/9070
Fixes diagnostics not showing up in path dependencies.
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-10 14:14:02 +00:00
Teddy_Wang
67a9c457e6
Add tests. The tests with coercion fail, but I have no clue why.
2021-09-09 23:31:13 -04:00
Jonas Schievink
9a320bcf38
Support the new rustc_builtin_macro
syntax
2021-09-09 21:32:41 +02:00
bors[bot]
8e47e359fa
Merge #10190
...
10190: minor: Bump deps r=lnicola a=lnicola
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-09-09 18:13:26 +00:00
Laurențiu Nicola
c930dcca13
Bump chalk
2021-09-09 21:12:38 +03:00
Jörg Sommer
c87b860d3d
Use todo!()
instead of ()
for missing fields
...
The generated code with `()` doesn't compile in most of the cases. To signal
the developer there's something to do, fill in `todo!()`.
Because the file *missing_fields.rs* contains the string `todo!()` it needs
an exception for the test *check_todo*.
2021-09-09 18:04:50 +02:00
bors[bot]
92ce768ea3
Merge #10188
...
10188: fix: add multi-token mapping support to runnables r=jonas-schievink a=lnicola
Closes #10184
changelog fix (first contribution) add multi-token mapping support to runnables
Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
2021-09-09 15:07:43 +00:00
Anatol Ulrich
5d08ac20d9
implement #10070 in runnables
...
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-09 18:02:53 +03:00
Teddy_Wang
cf696c0ed6
Show the type of what is being dereferenced in a deref expression
2021-09-08 22:28:52 -04:00
Jonas Schievink
85993171e5
minor: include ImplLoc
in panic context
2021-09-09 02:20:55 +02:00
bors[bot]
6a8062092b
Merge #10174
...
10174: fix: path display error when start with `crate` r=flodiebold a=dzvon
Fixes #10172
Co-authored-by: Dezhi Wu <wu543065657@163.com>
2021-09-08 14:40:54 +00:00
Yotam Ofek
ebb891246c
Split and document array method resolution logic.
2021-09-08 13:15:40 +03:00
Yotam Ofek
9593fe684d
Fix resolution of inherent array methods.
2021-09-08 11:49:05 +03:00
Yotam Ofek
1785493cae
Add (failing) test for inherent array method resolution.
2021-09-08 11:00:55 +03:00
Jonas Schievink
e241015a75
Rename is_member
to is_local
2021-09-07 17:29:58 +02:00
Jonas Schievink
8a4c35a068
Treat path dependencies like workspace members
2021-09-07 17:26:21 +02:00
Dezhi Wu
87436a08fa
fix super
path wrong display
2021-09-07 17:49:46 +08:00
Dezhi Wu
880af425d4
fix path wrong display
2021-09-07 16:54:02 +08:00
Dezhi Wu
6d2154e409
cargo fmt
2021-09-07 14:50:33 +08:00
Dezhi Wu
82ae228d98
fix: path display error when start with crate
2021-09-07 14:44:30 +08:00
Aleksey Kladov
682fbbbd5a
minor: modernize
2021-09-06 18:54:16 +03:00
Aleksey Kladov
104cd0ce88
internal: make name consistent with usage
2021-09-06 18:34:03 +03:00
bors[bot]
7d9eb4fd73
Merge #10167
...
10167: minor: Avoid extra allocation in completion rendering r=lnicola a=lnicola
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-09-06 15:15:10 +00:00
Laurențiu Nicola
d27ed8c243
Avoid extra allocation in completion rendering
2021-09-06 17:55:07 +03:00
David Barsky
184fbf24f0
update to tracing-tree 0.1.10, which does not pull in syn.
2021-09-06 10:33:08 -04:00
bors[bot]
cbc13ae6bd
Merge #10152
...
10152: feat: Add completion for raw identifiers r=matklad a=nabakin
![rust_analyzer_pr](https://user-images.githubusercontent.com/894305/132110362-c21b713d-acaf-4a6d-9749-ff812172cbce.gif )
Adds support for valid Rust completion of raw identifiers.
Previously, code completion of fields made via raw identifiers would not re-insert those raw identifiers, resulting in invalid Rust code. Now, code completion of fields made via raw identifiers do re-insert those raw identifiers, resulting in valid Rust code.
The same is true for all code completion instances for fields and compatible Rust identifiers.
Co-authored-by: Blake Wyatt <894305+nabakin@users.noreply.github.com>
2021-09-06 10:54:18 +00:00
bors[bot]
0bc8e2acb8
Merge #10154
...
10154: feat: Complete `#![recursion_limit = "N"]` instead of `#![recursion_limit = N]` r=lnicola a=hkmatsumoto
Currently ra emits `#![recursion_limit = 128]`, but this should rather be `#![recursion_limit = "128"]`
Co-authored-by: Hirochika Matsumoto <git@hkmatsumoto.com>
2021-09-06 10:38:41 +00:00
Jonas Schievink
8e736da456
Recover from statement macro expansion errors
2021-09-06 00:16:12 +02:00
Aleksey Kladov
dbb702cfc1
internal: remove accidental code re-use
...
FragmentKind played two roles:
* entry point to the parser
* syntactic category of a macro call
These are different use-cases, and warrant different types. For example,
macro can't expand to visibility, but we have such fragment today.
This PR introduces `ExpandsTo` enum to separate this two use-cases.
I suspect we might further split `FragmentKind` into `$x:specifier` enum
specific to MBE, and a general parser entry point, but that's for
another PR!
2021-09-05 22:36:36 +03:00
Jonas Schievink
d6a12b491f
Don't dump DefMap
s to build the panic context
2021-09-05 20:42:22 +02:00
Jonas Schievink
7d67c71c34
Add panic info for impl_trait
/trait_data
2021-09-05 19:19:34 +02:00
bors[bot]
487078feb5
Merge #10155
...
10155: Minor: replace old name `CrateDefMap` in comments r=jonas-schievink a=toyboot4e
This PR replaces the old name `CrateDefMap` in comments with the new name `DefMap`. The renaming was done in [57a82fb0
](https://github.com/rust-analyzer/rust-analyzer/commit/57a82fb0 ) (Jan 2021).
I didn't touch the working code ([CrateDefMapQueryQuery][QQ]). Thank you.
[QQ]: https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_db/src/apply_change.rs#L126
Co-authored-by: toyboot4e <toyboot4e@gmail.com>
2021-09-05 16:57:46 +00:00
Jonas Schievink
65bb5d7511
Add crate name to nameres panic context
2021-09-05 18:48:34 +02:00
toyboot4e
89e46b40c3
Minor: replace old name CrateDefMap
2021-09-05 19:22:34 +09:00
Hirochika Matsumoto
1f238b3bb5
Complete #![recursion_limit = "N"]
over #![recursion_limit = N]
2021-09-05 18:05:06 +09:00
Blake Wyatt
6c51ecad5b
Add completion for raw identifiers
2021-09-04 19:28:59 -04:00
bors[bot]
fd30bd179c
Merge #10146
...
10146: fix: use placeholder as default type in `Generate function` and `Extract into function`. r=matklad a=iDawer
Closes #10123
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-04 14:04:30 +00:00
bors[bot]
5fb2eb2314
Merge #10147
...
10147: fix: don't panic if the client sends invalid request r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-04 13:56:47 +00:00
Aleksey Kladov
2d2c4e7c22
internal: deduplicate
2021-09-04 16:56:23 +03:00
Dawer
535761e63f
minor: update test
2021-09-04 15:19:44 +05:00
Aleksey Kladov
33199b7e43
fix: don't panic if the client sends invalid request
2021-09-04 12:27:27 +03:00