bors[bot]
26f4124b26
Merge #10494
...
10494: Macro expansion tests r=matklad a=matklad
bors r+
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-10-09 12:30:27 +00:00
Aleksey Kladov
84d182c7a2
internal: docs
2021-10-09 15:29:31 +03:00
Aleksey Kladov
ef1251f696
feat: report errors in macro definition
...
Reporting macro *definition* error at the macro *call site* is a rather
questionable approach, but at least we don't erase the errors
altogether!
2021-10-09 15:23:55 +03:00
Aleksey Kladov
b3d1de93af
get organizized
2021-10-09 14:53:15 +03:00
Aleksey Kladov
8e9003447c
future proof structure
2021-10-09 14:48:38 +03:00
Aleksey Kladov
5ecda802f1
move test
2021-10-09 14:45:52 +03:00
Aleksey Kladov
f4ee0d736c
move tests
2021-10-09 14:39:24 +03:00
Aleksey Kladov
1abe3f8275
internal: move tests
2021-10-09 14:22:49 +03:00
Aleksey Kladov
49f5fecf06
internal: move test
2021-10-09 14:18:53 +03:00
Aleksey Kladov
78ca43ef3d
internal: move test
2021-10-09 13:51:02 +03:00
Aleksey Kladov
093f99b809
internal: start new macro test suite
...
I don't like our macro tests -- they are brittle and don't inspire
confidence. I think the reason for that is that we try to unit-test
them, but that is at odds with reality, where macro expansion
fundamentally depends on name resolution.
2021-10-09 13:42:32 +03:00
bors[bot]
545b068a77
Merge #10474
...
10474: feat: Support `let...else` r=jonas-schievink a=jonas-schievink
bors r+
closes https://github.com/rust-analyzer/rust-analyzer/issues/10469
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-10-07 15:09:42 +00:00
Jonas Schievink
f8acae7895
Support let...else
2021-10-07 17:06:24 +02:00
bors[bot]
4675410f07
Merge #10477 #10482
...
10477: parser: fix parsing of macro call inside generic args r=Veykril a=cynecx
10482: fix: fix `inline_call` trying to use an uncached syntax node in Semantics r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10475
bors r+
Co-authored-by: cynecx <me@cynecx.net>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-07 13:05:18 +00:00
Lukas Wirth
12465a8a3c
Expose HasSource::source through Semantics with caching behaviour
2021-10-07 15:00:14 +02:00
bors[bot]
5191fb755b
Merge #10480
...
10480: fix: Change `stdx::to_snake_case` to match rustc implementation r=Veykril a=Crauzer
Fixes #10473
Co-authored-by: crauzer <filip.quitko@gmail.com>
2021-10-07 12:56:28 +00:00
bors[bot]
fd3f4c50da
Merge #10467
...
10467: Optimize CodeLens for references/impls r=Veykril a=ericsampson
Don't do unnecessary work.
Followup to #10447 . cc `@Veykril`
Co-authored-by: Eric Sampson <esampson@eaze.com>
2021-10-06 21:47:22 +00:00
Eric Sampson
efca421c43
Refactor to eliminate a vector allocation.
2021-10-06 16:43:37 -05:00
crauzer
ba62a8a075
fix test
2021-10-06 23:37:43 +02:00
crauzer
a4f08c117f
Fix stdx::to_snake_case
2021-10-06 23:24:47 +02:00
bors[bot]
f30b62b751
Merge #10479
...
10479: fix: fix "index out of bounds" panic in name resolution r=jonas-schievink a=jonas-schievink
Closes https://github.com/rust-analyzer/rust-analyzer/issues/10084
Closes https://github.com/rust-analyzer/rust-analyzer/issues/9163
This is really just a salsa update to a version that removes the problematic code (see https://github.com/rust-analyzer/rust-analyzer/issues/10084#issuecomment-934445711 )
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-10-06 20:54:27 +00:00
bors[bot]
12d33eafaf
Merge #10476
...
10476: feat: Add `replace_try_expr_with_match` assist r=Veykril a=Crauzer
Adds the replace_try_expr_with_match assist
#10424
Co-authored-by: crauzer <filip.quitko@gmail.com>
2021-10-06 20:45:14 +00:00
Jonas Schievink
cda9668289
Update salsa
2021-10-06 22:42:54 +02:00
cynecx
07cd19dcef
parser: fix parsing of macro call inside generic args
2021-10-06 22:41:35 +02:00
bors[bot]
eb60836a39
Merge #10478
...
10478: minor: Update Cargo.lock r=Veykril a=Veykril
This causes CI to fail for some reason I think
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-06 20:36:15 +00:00
Lukas Wirth
fb27c58a04
Update Cargo.lock
2021-10-06 22:34:55 +02:00
crauzer
1161fa45af
fix tests
2021-10-06 20:45:18 +02:00
crauzer
765d7f20f9
add sourcegen
2021-10-06 20:23:22 +02:00
crauzer
05e58afde2
Add replace_try_expr_with_match assist
2021-10-06 20:11:00 +02:00
bors[bot]
94fa49c0a3
Merge #10420
...
10420: Parse outer attributes on StructPatternEtCetera r=jonas-schievink a=XFFXFF
Try to fix https://github.com/rust-analyzer/rust-analyzer/issues/8610
Related pr in ungrammer: https://github.com/rust-analyzer/ungrammar/pull/41
Co-authored-by: zhoufan <1247714429@qq.com>
2021-10-06 15:05:40 +00:00
bors[bot]
4cfe237a56
Merge #10459
...
10459: feat: Add generate constant assist r=Veykril a=longfangsong
Close #10330 .
![demo(1)](https://user-images.githubusercontent.com/13777628/135885262-c80de86f-5555-4f84-9508-822243f8a876.gif )
Co-authored-by: longfangsong <longfangsong@icloud.com>
Co-authored-by: 龙方淞 <longfangsong@icloud.com>
2021-10-06 09:38:58 +00:00
Eric Sampson
0d77be67f7
Don't do work and then throw it away.
2021-10-06 01:16:31 -05:00
longfangsong
3fde682bcf
cleanup
2021-10-06 10:14:12 +08:00
龙方淞
7228dbadca
Update crates/ide_assists/src/handlers/generate_constant.rs
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-06 10:06:51 +08:00
龙方淞
fab238adf6
Update crates/ide_assists/src/handlers/generate_constant.rs
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-06 10:06:46 +08:00
bors[bot]
5ff992465e
Merge #10447
...
10447: Add enum variant references CodeLens. r=Veykril a=ericsampson
Co-authored-by: Eric Sampson <esampson@eaze.com>
2021-10-05 22:03:23 +00:00
Eric Sampson
6d05b07f7d
Refactor according to PR comments to remove allocations.
2021-10-05 15:42:45 -05:00
bors[bot]
c409cf0e26
Merge #10458
...
10458: feat: Implement custom user snippets r=Veykril a=Veykril
![Y24dX7fOWX](https://user-images.githubusercontent.com/3757771/136059454-ceccfc2c-2c90-46da-8ad1-bac9c2e83ec1.gif )
Allows us to address the following issues:
- `.arc / .rc / .pin, similar to .box?` https://github.com/rust-analyzer/rust-analyzer/issues/7033
- `Add unsafe snippet` https://github.com/rust-analyzer/rust-analyzer/issues/10392 , would allow users to have this without the diagnostic)
- `.ok() postfix snippet is annoying` https://github.com/rust-analyzer/rust-analyzer/issues/9636 , allows us to get rid of the `ok` postfix and similar ones
- `Postfix vec completion` https://github.com/rust-analyzer/rust-analyzer/issues/7773
cc https://github.com/rust-analyzer/rust-analyzer/issues/772
Zulipd discussion: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Custom.20Postfix.20snippets
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-05 16:41:11 +00:00
Lukas Wirth
041cfbe0f4
Render the expansion of snippets as their docs
2021-10-05 18:11:22 +02:00
Lukas Wirth
77cbf4adbc
Bring the implementation closer to VSCode snippet definitions
2021-10-05 17:18:40 +02:00
bors[bot]
86c534f244
Merge #10440
...
10440: Fix Clippy warnings and replace some `if let`s with `match` r=Veykril a=arzg
I decided to try fixing a bunch of Clippy warnings. I am aware of this project’s opinion of Clippy (I have read both [rust-lang/clippy#5537 ](https://github.com/rust-lang/rust-clippy/issues/5537 ) and [rust-analyzer/rowan#57 (comment)](https://github.com/rust-analyzer/rowan/pull/57#discussion_r415676159 )), so I totally understand if part of or the entirety of this PR is rejected. In particular, I can see how the semicolons and `if let` vs `match` commits provide comparatively little benefit when compared to the ensuing churn.
I tried to separate each kind of change into its own commit to make it easier to discard certain changes. I also only applied Clippy suggestions where I thought they provided a definite improvement to the code (apart from semicolons, which is IMO more of a formatting/consistency question than a linting question). In the end I accumulated a list of 28 Clippy lints I ignored entirely.
Sidenote: I should really have asked about this on Zulip before going through all 1,555 `if let`s in the codebase to decide which ones definitely look better as `match` :P
Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-10-05 08:58:40 +00:00
Aramis Razzaghipour
9583dd5725
Replace if let
with match
where appropriate
2021-10-05 09:00:21 +11:00
Aramis Razzaghipour
f29796da61
Replace if let Some(_) = foo
with if foo.is_some()
2021-10-05 09:00:18 +11:00
Eric Sampson
160a7b097a
initialize vector to required size.
2021-10-04 16:14:01 -05:00
Lukas Wirth
2b17da60db
Resolve macros in snippet require items
2021-10-04 22:53:02 +02:00
Lukas Wirth
ca1fdd75f1
Regen docs
2021-10-04 22:13:12 +02:00
Lukas Wirth
1f7e14e78b
Fix multiple imports acting on files on separately
2021-10-04 22:05:30 +02:00
Lukas Wirth
d0c8777a44
Regen generated_config.adoc
2021-10-04 21:47:02 +02:00
Lukas Wirth
454ecd167c
Make multiple import edits work for completions
2021-10-04 21:44:33 +02:00
Lukas Wirth
046c85ef0c
Add custom non-postfix snippets
2021-10-04 19:22:41 +02:00