Commit graph

14104 commits

Author SHA1 Message Date
Lukas Wirth
ca4baa6e55 Use FileAstId<ast::Adt> in nameres where appropriate instead 2022-01-07 14:20:27 +01:00
Lukas Wirth
08adce61a1 Better interface for doc comment and attribute processing 2022-01-07 14:14:33 +01:00
Lukas Wirth
69dbfc7754 Generate AnyHasDocComments node 2022-01-07 12:38:18 +01:00
bors[bot]
2fb6f5e46a
Merge #11218
11218: fix: Correct has_ref detection, avoiding duplicate &mut insertion on parameter completion r=Veykril a=weirane

The original code fails to detect there's a ref in scenarios such as `&mut s` and `& s` because `WHITESPACE` and `IDENT` got reversed.

Closes #11199.

Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2022-01-06 23:17:51 +00:00
Wang Ruochen
3a57f700d8
Correct has_ref detection 2022-01-06 11:46:28 -08:00
Laurențiu Nicola
e14d9208f5 Move pretty-printing test out of assist 2022-01-06 16:38:25 +02:00
bors[bot]
5c47eb6bf8
Merge #11216
11216: internal: Support registered tools and attributes in ide layer r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-06 13:57:17 +00:00
Lukas Wirth
dc135cc076 internal: Support registered tools and attributes in ide layer 2022-01-06 14:56:50 +01:00
Lukas Wirth
dd20a6f701 feat: poke user when supplying faulty configurations 2022-01-06 14:24:19 +01:00
bors[bot]
8887d2016f
Merge #11193
11193: feat: Add config to replace specific proc-macros with dummy expanders r=Veykril a=Veykril

With this one can specify proc-macros from crates to expand into their input as a (temporary) workaround for the current completion problems with some of the bigger attribute proc-macros like `async_trait`.

This could've been done by just not expanding these macros, but that would require fiddling with nameres. I felt like this approach was simpler to pull off while also keeping the behaviour of the attributes/proc-macro in that they still expand instead of being dead syntax to us.

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11052

Usage(`async_trait` as example):
```jsonc
    "rust-analyzer.procMacro.dummies": {
        "async-trait": [ // crate name(as per its cargo.toml definition, not the dependency name)
            "async_trait" // exported proc-macro name
        ]
    },
```

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-06 12:53:49 +00:00
Lukas Wirth
f6eba28ef8 Adjust config name 2022-01-06 13:50:35 +01:00
Lukas Wirth
dd4b53402d Regenrate docs and package.json 2022-01-06 13:50:24 +01:00
Lukas Wirth
aecf26d09b feat: Add config to replace specific proc-macros with dummy expanders 2022-01-06 13:50:18 +01:00
Jonas Schievink
b1d6aea394 Fix parsing of #[derive] paths 2022-01-06 13:39:20 +01:00
Jonas Schievink
9dd42cd1e1 Useconst _ instead of mod __ 2022-01-06 12:55:33 +01:00
bors[bot]
7585127b92
Merge #11208
11208: feat: expand attribute macros on impl and trait items r=jonas-schievink a=jonas-schievink

fixes https://github.com/rust-analyzer/rust-analyzer/issues/11104

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-01-06 11:31:19 +00:00
Jonas Schievink
3ff68f25b8 Expand attribute macros on impl and trait items 2022-01-06 12:30:16 +01:00
Jonas Platte
c90c88b083
Always put a space after impl in macro pretty-printing
… regardless of whether the next symbol is punctuation or not.
2022-01-06 11:33:08 +01:00
bors[bot]
2e33bf23c9
Merge #11204
11204: fix: `replace_qualified_name_with_use` does not use full item path for replacements r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-05 22:47:30 +00:00
Lukas Wirth
2d33cdf188 fix: replace_qualified_name_with_use does not use full item path for replacements 2022-01-05 23:46:58 +01:00
bors[bot]
ada51f2ac4
Merge #11195 #11202
11195: Correctly pass through reference modifiers when extracting a variable r=Veykril a=Vannevelj

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10034

This will parse the field expression and look at whether it is marked `&` or `&mut` and include a modifier if appropriate. The original issue only mentions `&mut params` but I've found that this issue also occurs for `&mut locals` as well as `&params` and `&locals` so I've also added tests for them.

I'd definitely be interested in hearing where I can make my code more idiomatic for Rust.

11202: fix: Fix `apply_demorgan` assist hanging for certain binary expressions r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10963
bors r+

Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-05 21:30:50 +00:00
Lukas Wirth
b92ed115c1 fix: Fix apply_demorgan assist hanging for certain binary expressions 2022-01-05 22:30:19 +01:00
Jeroen Vannevel
035a373a6a
removed double matching 2022-01-05 21:16:24 +00:00
Jeroen Vannevel
771c87f890
no PathExpr arm 2022-01-05 21:12:09 +00:00
Jeroen Vannevel
8c0b848694
.clone() over .to_owned() 2022-01-05 21:10:03 +00:00
Jeroen Vannevel
2724b35490
less wordy ref_kind assignment 2022-01-05 21:08:46 +00:00
bors[bot]
735b542146
Merge #11201
11201: fix: Fix completions not considering ancestor items for attribute search r=Veykril a=Veykril

Turns out we never filled the `CompletionContext` with the attribute expansion of attributed impls and traits when typing in the assoc items, as we were only considering the assoc item to have an attribute to expand.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-05 20:45:27 +00:00
Lukas Wirth
bd91327079 fix: Fix completions not considering ancestor items for attribute search 2022-01-05 21:44:56 +01:00
bors[bot]
149981fbfc
Merge #11200
11200: Always put a space after dyn in macro pretty-printing r=Veykril a=jplatte

Fixes #11100.

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-01-05 20:04:49 +00:00
Jonas Platte
b8f4667aa9
Always put a space after dyn in macro pretty-printing
… regardless of whether the next symbol is punctuation or not.
Fixes issue 11100.
2022-01-05 18:06:50 +01:00
Jonas Platte
f5b789b1dc
Add failing test case for issue 11100 2022-01-05 18:04:36 +01:00
Jonas Schievink
3eddda6f4c simplify 2022-01-05 17:26:34 +01:00
Aaron Hill
04cb85032f
Remove unused lifetime 2022-01-05 10:19:10 -05:00
Jeroen Vannevel
053ae2452c
removed trailing whitespace 2022-01-05 02:16:22 +00:00
Jeroen Vannevel
abab0154b6
comment 2022-01-05 01:48:57 +00:00
Jeroen Vannevel
fa0afb9576
additional test for a reference local (on top of mutable reference local) 2022-01-05 01:36:04 +00:00
Jeroen Vannevel
4c1a1b2570
failing test for a reference local 2022-01-05 01:27:15 +00:00
Jeroen Vannevel
cd5ad4e500
Don't include a ref if none was declared 2022-01-05 01:18:55 +00:00
Jeroen Vannevel
817f47828c
support ref params as well 2022-01-05 01:15:54 +00:00
Jeroen Vannevel
056e18fcbd
correctly handle mutable references 2022-01-05 01:03:27 +00:00
bors[bot]
c5049bdcda
Merge #11190
11190: fix(completions): improve fn_param r=dbofmmbt a=dbofmmbt

- insert commas around when necessary
- only suggest `self` completions when param list is empty
- stop suggesting completions for identifiers which are already on the param list

Closes #11085 

Co-authored-by: Eduardo Canellas <eduardocanellas98@gmail.com>
2022-01-04 22:40:10 +00:00
Eduardo Canellas
a973e5a9db refactor: apply review suggestions 2022-01-04 19:30:57 -03:00
bors[bot]
ac3ea3e81c
Merge #11112
11112: Evaluate constants in array repeat expression r=HKalbasi a=HKalbasi

cc #8655 

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-01-04 21:51:37 +00:00
hkalbasi
75c2acae6e Evaluate constants in array repeat expression 2022-01-05 01:17:01 +03:30
Eduardo Canellas
30b7e92afa remove forgotten dbg macro 2022-01-04 15:37:10 -03:00
Eduardo Canellas
838944b387 improve logic for trailing comma addition 2022-01-04 15:30:30 -03:00
Eduardo Canellas
a9612666f8 fix(completions): improve fn_param
- insert commas around when necessary
- only suggest `self` completions when param list is empty
- stop suggesting completions for identifiers which are already on the param list
2022-01-04 15:03:46 -03:00
Lukas Wirth
c5a9985fc5 Remove lossy Definition::from_token/Definition::from_node methods 2022-01-04 18:29:53 +01:00
bors[bot]
68bc12c3b8
Merge #11157
11157: internal: Remove `SemanticScope::speculative_resolve_as_mac` r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11132

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-04 16:49:47 +00:00
Laurențiu Nicola
c934a99fd3 Rename and use the 1.55 ABI for 1.54 2022-01-04 14:06:26 +02:00