rainy-me
a58f7acc97
fix: improve parameter completion
2022-04-20 17:56:20 +09:00
bors
34c3e0b067
Auto merge of #12037 - lnicola:inlay-hint-config, r=lnicola
...
fix: Remove `rust-analyzer.inlayHints.enable` and set language scope
Closes #12036
CC https://github.com/rust-lang/rust-analyzer/issues/12027#issuecomment-1102990324
The key was left there by mistake in #12006 .
Setting the configuration scope only works if you already have it created, which is fine, but unfortunately not quite discoverable.
2022-04-20 04:38:22 +00:00
Laurențiu Nicola
ad751e08ec
Pass the language id when toggling inlay hints
2022-04-20 07:34:00 +03:00
Laurențiu Nicola
4de7793425
Actually remove rust-analyzer.inlayHints.enable
2022-04-20 07:33:26 +03:00
bors
55824021e1
Auto merge of #12032 - jonas-schievink:code-action-commands, r=jonas-schievink
...
feat: display signature help when applying "Add `::<>`" assist
Closes https://github.com/rust-lang/rust-analyzer/issues/12031
2022-04-19 16:46:33 +00:00
Jonas Schievink
c6ffffccbd
Allows triggering commands after an assist edit
2022-04-19 18:45:48 +02:00
bors
e3ec87730a
Auto merge of #12029 - xuhongxu96:master, r=lnicola
...
Fix typo "GreeNode" in syntax.md
2022-04-19 07:57:12 +00:00
Hongxu Xu
4390a8ad7c
Fix typo "GreeNode" in syntax.md
2022-04-19 15:45:03 +08:00
bors
b25e34837a
Auto merge of #12028 - lnicola:fix-changelog, r=lnicola
...
internal: Fix changelog generation after repo move
2022-04-19 06:09:32 +00:00
Laurențiu Nicola
d4dcb16a02
Fix changelog generation after repo move
2022-04-19 09:08:39 +03:00
bors
838cc9d3cc
Auto merge of #12025 - Veykril:completion-ctx, r=Veykril
...
minor: Document completion context some more
2022-04-18 14:55:31 +00:00
Lukas Wirth
f8c32df7cd
minor: Document completion context some more
2022-04-18 16:54:13 +02:00
bors
e0d41bc2a1
Auto merge of #12021 - Veykril:completion-ctx, r=Veykril
...
internal: Add a `NameContext` to `CompletionContext`, move out some ImmediateLocation variants
Continues the completion rewrite I started some time ago
(will merge tomorrow after stable since our completion tests still let a lot through)
2022-04-18 14:00:56 +00:00
bors
ebf4658ae9
Auto merge of #12024 - XFFXFF:derive_completion, r=Veykril
...
derive completions take existing derives into count
fixes #12019
The immediate reason is that when we are doing derive completion, [`ctx.existing_derives`](d1f6b4e2a0/crates/ide_completion/src/completions/attribute/derive.rs (L82)
) is empty, this is because we expand the macro when looking for the ancestors of the token to be completed. Take the following code as an example, we find the first `SyntaxNode` with kind `Attr` based on the ancestors of the token, but the parent of `Attr` is not a `Struct` as we [expect](d1f6b4e2a0/crates/hir/src/semantics.rs (L518)
).
```rust
#[derive(PartialEq, Eq, Or$0)]
struct S;
```
The ancestors of the token to be completed above.
```
NAME_REF@24..26
IDENT@24..26 "Or"
,
PATH_SEGMENT@24..26
NAME_REF@24..26
IDENT@24..26 "Or"
,
PATH@24..26
PATH_SEGMENT@24..26
NAME_REF@24..26
IDENT@24..26 "Or"
,
META@24..26
PATH@24..26
PATH_SEGMENT@24..26
NAME_REF@24..26
IDENT@24..26 "Or"
,
ATTR@21..28
POUND@21..22 "#"
WHITESPACE@22..23 " "
L_BRACK@23..24 "["
META@24..26
PATH@24..26
PATH_SEGMENT@24..26
NAME_REF@24..26
IDENT@24..26 "Or"
R_BRACK@26..27 "]"
WHITESPACE@27..28 " "
,
TUPLE_EXPR@0..32
ATTR@0..14
POUND@0..1 "#"
WHITESPACE@1..2 " "
L_BRACK@2..3 "["
META@3..12
PATH@3..12
PATH_SEGMENT@3..12
NAME_REF@3..12
IDENT@3..12 "PartialEq"
R_BRACK@12..13 "]"
WHITESPACE@13..14 " "
ATTR@14..21
POUND@14..15 "#"
WHITESPACE@15..16 " "
L_BRACK@16..17 "["
META@17..19
PATH@17..19
PATH_SEGMENT@17..19
NAME_REF@17..19
IDENT@17..19 "Eq"
R_BRACK@19..20 "]"
WHITESPACE@20..21 " "
ATTR@21..28
POUND@21..22 "#"
WHITESPACE@22..23 " "
L_BRACK@23..24 "["
META@24..26
PATH@24..26
PATH_SEGMENT@24..26
NAME_REF@24..26
IDENT@24..26 "Or"
R_BRACK@26..27 "]"
WHITESPACE@27..28 " "
L_PAREN@28..29 "("
WHITESPACE@29..30 " "
R_PAREN@30..31 ")"
WHITESPACE@31..32 " "
...
```
I make a small change to not do macro expansion when looking up the ancestors of the token.
What I don't understand is that `self.sema.token_ancestors_with_macros(self.token.clone())` doesn't seem to expand the macro if the derive completion triggered without any prefix, like `#[derive(PartialEq, Eq, $0)]`.
The ancestors of the token with `#[derive(PartialEq, Eq, $0)]`.
```
TOKEN_TREE@8..25
L_PAREN@8..9 "("
IDENT@9..18 "PartialEq"
COMMA@18..19 ","
WHITESPACE@19..20 " "
IDENT@20..22 "Eq"
COMMA@22..23 ","
WHITESPACE@23..24 " "
R_PAREN@24..25 ")"
,
META@2..25
PATH@2..8
PATH_SEGMENT@2..8
NAME_REF@2..8
IDENT@2..8 "derive"
TOKEN_TREE@8..25
L_PAREN@8..9 "("
IDENT@9..18 "PartialEq"
COMMA@18..19 ","
WHITESPACE@19..20 " "
IDENT@20..22 "Eq"
COMMA@22..23 ","
WHITESPACE@23..24 " "
R_PAREN@24..25 ")"
,
ATTR@0..26
POUND@0..1 "#"
L_BRACK@1..2 "["
META@2..25
PATH@2..8
PATH_SEGMENT@2..8
NAME_REF@2..8
IDENT@2..8 "derive"
TOKEN_TREE@8..25
L_PAREN@8..9 "("
IDENT@9..18 "PartialEq"
COMMA@18..19 ","
WHITESPACE@19..20 " "
IDENT@20..22 "Eq"
COMMA@22..23 ","
WHITESPACE@23..24 " "
R_PAREN@24..25 ")"
R_BRACK@25..26 "]"
,
STRUCT@0..39
ATTR@0..26
POUND@0..1 "#"
L_BRACK@1..2 "["
META@2..25
PATH@2..8
PATH_SEGMENT@2..8
NAME_REF@2..8
IDENT@2..8 "derive"
TOKEN_TREE@8..25
L_PAREN@8..9 "("
IDENT@9..18 "PartialEq"
COMMA@18..19 ","
WHITESPACE@19..20 " "
IDENT@20..22 "Eq"
COMMA@22..23 ","
WHITESPACE@23..24 " "
R_PAREN@24..25 ")"
R_BRACK@25..26 "]"
WHITESPACE@26..27 " "
STRUCT_KW@27..33 "struct"
WHITESPACE@33..34 " "
NAME@34..38
IDENT@34..38 "Test"
SEMICOLON@38..39 ";"
...
```
2022-04-18 13:40:18 +00:00
XFFXFF
fedd0245d1
derive completions take existing derives into count
2022-04-18 21:34:36 +08:00
bors
d1f6b4e2a0
Auto merge of #12023 - edwin0cheng:add-more-log, r=edwin0cheng
...
internal: more visibility for switch workspaces and its states
2022-04-18 07:13:30 +00:00
Edwin Cheng
72fcc66835
More visibility for switch workspaces and its states
2022-04-18 14:26:00 +08:00
Lukas Wirth
ff667c7228
internal: Add a NameContext
to CompletionContext
, move out some ImmediateLocation variants
2022-04-17 21:53:58 +02:00
bors
65fbe0a8d1
Auto merge of #12017 - lnicola:bump-deps, r=lnicola
...
minor: Bump deps
2022-04-17 16:36:36 +00:00
Laurențiu Nicola
117f902d55
Bump deps
2022-04-17 19:36:08 +03:00
bors
a45a63e577
Auto merge of #12013 - XFFXFF:associated_const_equality, r=Veykril
...
fix: support `associated_const_equality` in parser
This pr fixes #11965 . The parser now allows eq constraints on associated constants.
I've added tests for `HasCount<Count = {N}>` and `HasCount<Count = 0>`
2022-04-17 13:05:47 +00:00
Arjo Chakravarty
f75bad52d7
Update docs link
...
The current doc link was broken. replaced with the updated version as found on the front page.
2022-04-17 20:32:06 +08:00
XFFXFF
6580d75308
update parser to support associated const equality
2022-04-17 20:26:06 +08:00
bors
9c675d652f
Auto merge of #12014 - Veykril:expmacfmt, r=Veykril
...
feat: Attempt to format expand_macro output with rustfmt if possible
Fixes https://github.com/rust-lang/rust-analyzer/issues/10548
2022-04-17 12:03:27 +00:00
Lukas Wirth
3de9a42810
Disable rustfmt for expand_macro on wasm platforms
2022-04-17 14:00:19 +02:00
Lukas Wirth
895a16265c
Fix macro patterns not getting formatted properly
2022-04-17 13:46:00 +02:00
Lukas Wirth
e2f1a9a558
feat: Attempt to format expand_macro output with rustfmt if possible
2022-04-17 13:33:39 +02:00
XFFXFF
bdecd9374e
update grammer to support associated const equality
2022-04-17 12:03:52 +08:00
bors
53afd2a707
Auto merge of #12011 - iDawer:completion_detail.impl_trait, r=Veykril
...
fix: Show `impl Trait` in argument positon in completion details
Follow up for #11991
`hir`: Use `db.callable_item_signature` query more.
2022-04-16 21:13:07 +00:00
iDawer
d26deb5b9f
Show impl Trait
in argument positon in completion details
...
`hir`: Use `db.callable_item_signature` query more.
2022-04-16 19:18:42 +05:00
bors
dc6aa056fd
Auto merge of #12009 - matklad:debug-reloads, r=matklad
...
internal: more visibility into why things happen
2022-04-16 12:18:00 +00:00
Aleksey Kladov
3f4235d59b
internal: more visibility into why things happen
2022-04-16 13:17:27 +01:00
bors
74cbc20fce
Auto merge of #12008 - Veykril:patch-1, r=Veykril
...
fix: Fix proc-macro change check being inverted
2022-04-16 10:37:28 +00:00
Lukas Wirth
6f037da8cb
fix: Fix proc-macro change check being inverted
2022-04-16 12:36:31 +02:00
bors
40396b463e
Auto merge of #11991 - iDawer:completion_detail.impl_trait, r=iDawer
...
fix: completion detail shows `{unknown}` for async functions and for RPITs
Fix: completion detail shows `{unknown}` for `impl Trait` in return position.
Fix #11438 : completion detail shows `{unknown}` for return types in async functions.
#### API changes
Add `hir::Function::async_ret_type` method
2022-04-16 09:26:09 +00:00
iDawer
c53412046f
minor: address nit
2022-04-16 13:54:24 +05:00
iDawer
03c5dd1252
extract_function
: use appropriate return type for async fns
2022-04-16 13:54:24 +05:00
iDawer
9d787e1bfe
Add hir::Function::async_ret_type
method
...
Adjust completion detail for `async fn` return types
2022-04-16 13:53:22 +05:00
iDawer
f972adc201
fix: comletion detail shows {unknown}
for impl Trait
in return position
2022-04-16 13:41:10 +05:00
bors
66c232d03b
Auto merge of #12006 - lnicola:toggle-inlay-hints, r=lnicola
...
fix: Remove old inlay hints settings
Closes #11998
2022-04-16 05:10:17 +00:00
Laurențiu Nicola
f77adb3a23
Remove old inlay hints settings
2022-04-16 08:05:07 +03:00
bors
1c22537b3b
Auto merge of #12005 - Veykril:hir-ty-simplify, r=Veykril
...
internal: Remove frequent `Arc<Body>` clones in type checking
bors r+
2022-04-15 20:23:15 +00:00
Lukas Wirth
e5bf60fee2
minor: Remove frequent Arc<Body>
clones in type checking
2022-04-15 21:44:47 +02:00
Lukas Wirth
f82d230081
Simplify
2022-04-15 21:25:44 +02:00
bors
e10284a10c
Auto merge of #12003 - Veykril:hir-ty-simplify, r=Veykril
...
internal: Remove duplicated crate id field from hir::Type
2022-04-15 18:25:02 +00:00
Lukas Wirth
17691ee974
Slightly optimize Resolver::krate
2022-04-15 20:17:50 +02:00
bors
9ed459751f
Auto merge of #11997 - lnicola:es-target, r=lnicola
...
minor: Bump target JS version
2022-04-15 18:17:23 +00:00
Lukas Wirth
4b4a34327e
Remove duplicated crate id field from hir::Type
2022-04-15 20:14:35 +02:00
bors
20e6065a7a
Auto merge of #12002 - Veykril:proc-macro-change-panic, r=Veykril
...
fix: Fix source root panic in global state when checking out older git revs
Fixes https://github.com/rust-lang/rust-analyzer/issues/11357
2022-04-15 18:02:40 +00:00
Lukas Wirth
f540d1c2aa
fix: Fix source root panic in global state when checking out older git revs
2022-04-15 20:02:15 +02:00