Commit Graph

14248 Commits

Author SHA1 Message Date
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
Côme ALLART
c2d3f90886 fix: remove brackets if no generic types 2022-01-06 01:51:04 +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
Côme ALLART
4a5341e044 fix(gen-doc-assist): remove lifetimes in description of new 2022-01-05 00:23:36 +01: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
Benjamin Coenen
336c899a07 add better default behavior on fill struct fields diagnostic
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-04 15:59:00 +01:00
Laurențiu Nicola
c934a99fd3 Rename and use the 1.55 ABI for 1.54 2022-01-04 14:06:26 +02:00
bors[bot]
dbb1c1b4b1
Merge #11184
11184: Correctly pass through mutable parameter references when extracting a function r=Veykril a=Vannevelj

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

I have based this investigation based on my understanding of [the Borrowing chapter](https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html) but I wasn't able to debug the test runs or see it in action in an IDE. I'll try to figure out how to do that for future PRs but for now, the tests seem to confirm my understanding. I'll lay out my hypothesis below.

Here we define the parameters for the to-be-generated function: 

7409880a07/crates/ide_assists/src/handlers/extract_function.rs (L882)

Three values in particular are important here: `requires_mut`, `is_copy` and `move_local`. These will in turn be used here to determine the kind of parameter:

7409880a07/crates/ide_assists/src/handlers/extract_function.rs (L374-L381)

and then here to determine what transformation is needed for the calling argument:

7409880a07/crates/ide_assists/src/handlers/extract_function.rs (L383-L390)

which then gets transformed here:

7409880a07/crates/syntax/src/ast/make.rs (L381-L383)

What I believe is happening is that 
* `requires_mut` is `false` (it already is marked as mutable), 
* `is_copy` is `false` (`Foo` does not implement `Copy`), and 
* `move_local` is `false` (it has further usages)

According to the pattern matching in `fn kind()`, that would lead to `ParamKind::SharedRef` which in turn applies a transformation that prepends `&`.

However if I look at the chapter on borrowing then we only need to mark an argument as a reference if we actually own it. In this case the value is passed through as a reference parameter into the current function which means we never had ownership in the first place. By including the additional check for a reference parameter, `move_local` now becomes `true` and the resulting parameter is now `ParamKind::Value` which will avoid applying any transformations. This was further obscured by the fact that you need further usages of the variable or `move_local` would be considered `true` after all.

I didn't follow it in depth but it appears this idea applies for both the generated argument and the generated parameter.
There are existing tests that account for `&mut` values but they refer to local variables for which we do have ownership and as such they didn't expose this issue.

Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2022-01-04 10:19:37 +00:00
Jeroen Vannevel
ec61abbe93 reduced the tests to their bare essence 2022-01-04 10:11:04 +00:00
bors[bot]
22edf2e8a0
Merge #11186
11186: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-04 09:57:22 +00:00
Lukas Wirth
5fbdf20765 minor: Simplify 2022-01-04 10:56:28 +01:00
Jeroen Vannevel
5beddf93e7 additional test without further usages 2022-01-04 02:12:53 +00:00
Jeroen Vannevel
95cabfd722 Correctly pass through mutable references when extracting a function 2022-01-04 01:48:08 +00:00
bors[bot]
7409880a07
Merge #11061
11061: Support "move if to guard" for if else chains r=weirane a=weirane

The idea is to first parse the if else chain into a vector of `(Condition, BlockExpr)`s until we reach an iflet branch, an else branch, or the end (the tail). Then add the match arms with guard for the vector, and add the tail with no if guard.

Because the whole original match arm is replaced and the generated code doesn't have redundent commas, I removed redundent commas in some test cases.

Closes #11033.

Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2022-01-03 17:59:00 +00:00
Wang Ruochen
95145d5ab6
Update generated tests 2022-01-03 09:48:50 -08:00
Wang Ruochen
a19a32488d
Don't add pattern if there is a catch all afterwards 2022-01-03 09:38:45 -08:00
bors[bot]
b14af5cc6f
Merge #11115
11115: internal: refactor: avoid separate traversal in replace filter map next with find map r=Veykril a=rainy-me

fix: #7428

Co-authored-by: rainy-me <github@yue.coffee>
2022-01-03 16:00:05 +00:00
Lukas Wirth
19f1ff5c70 give resolve_derive_ident a more robust api 2022-01-03 16:00:45 +01:00
bors[bot]
1ba9a924d7
Merge #11180
11180: minor: add missing test r=matklad a=matklad

This test kills the following mutant:

diff --git a/crates/mbe/src/tt_iter.rs b/crates/mbe/src/tt_iter.rs
index 9d2b1da9a..055d9a733 100644
--- a/crates/mbe/src/tt_iter.rs
+++ b/crates/mbe/src/tt_iter.rs
`@@` -134,7 +134,7 `@@` impl<'a> TtIter<'a> {
         self.inner = self.inner.as_slice()[res.len()..].iter();
         let res = match res.len() {
             1 => Some(res[0].cloned()),
-            0 => None,
+            // 0 => None,
             _ => Some(tt::TokenTree::Subtree(tt::Subtree {
                 delimiter: None,
                 token_trees: res.into_iter().map(|it| it.cloned()).collect(),

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2022-01-03 14:22:37 +00:00
Aleksey Kladov
b688d84a4b minor: add missing test
This test kills the following mutant:

diff --git a/crates/mbe/src/tt_iter.rs b/crates/mbe/src/tt_iter.rs
index 9d2b1da9a..055d9a733 100644
--- a/crates/mbe/src/tt_iter.rs
+++ b/crates/mbe/src/tt_iter.rs
@@ -134,7 +134,7 @@ impl<'a> TtIter<'a> {
         self.inner = self.inner.as_slice()[res.len()..].iter();
         let res = match res.len() {
             1 => Some(res[0].cloned()),
-            0 => None,
+            // 0 => None,
             _ => Some(tt::TokenTree::Subtree(tt::Subtree {
                 delimiter: None,
                 token_trees: res.into_iter().map(|it| it.cloned()).collect(),
2022-01-03 17:21:43 +03:00
bors[bot]
120d76e0a3
Merge #11179
11179: minor: simplify mbe matcher r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2022-01-03 13:28:56 +00:00
Aleksey Kladov
303814189a simplify 2022-01-03 16:27:16 +03:00
Aleksey Kladov
966983c707 simplify 2022-01-03 16:22:41 +03:00
Dániel Buga
2e472bb746 Fix replace_match_with_if_let removing blocks with modifiers
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2022-01-03 14:07:34 +01:00
bors[bot]
8e9ccbf97a
Merge #11177
11177: internal: dont descend into comments r=Veykril a=jhgg

fixes #11176

Co-authored-by: Jake Heinz <jh@discordapp.com>
2022-01-03 02:03:03 +00:00
Jake Heinz
04decd5e6b internal: dont descend into comments 2022-01-03 01:53:58 +00:00
bors[bot]
abbc7e3a0e
Merge #11088
11088: closes #10446 hide type inlay hints r=Veykril a=Heinenen

Passes tests as described in #10446
Works for all happy cases, there may be some cases that I forgot as I am not that familiar with Rust and r-a (yet).

Co-authored-by: Heinenen <th.m.heinen@gmail.com>
2022-01-03 00:51:08 +00:00
bors[bot]
d89a4f0e93
Merge #11173
11173: Allow adding partially resolved types r=Veykril a=SomeoneToIgnore

Sometimes when writing something like `let foo = Arc::new(Mutex::new(CrazyGenerics::new(HashMap::new())))`, I want/have to specify an explicit type for the expression.
Using turbofish isn't very readable and not always appreciated by guidelines, so `let foo: T` has to be filled.

To ease that, the PR enables the `add_explicit_type` assist on types that contain unknown types and some generics.
Fully unresolved types, arrays with unknown types and other known cases behave the same.

`_` placeholder was chosen to replace an unknown type:

```rust
let foo = HashMap::new();
// after assist usage, turns into
let foo: HashMap<_, _> = HashMap::new();
```

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2022-01-03 00:40:30 +00:00
Lukas Wirth
087122ad1a fix: Fix highlighting hack for self-params 2022-01-03 01:32:03 +01:00
Kirill Bulatov
03291db801 Allow adding partially resolved types 2022-01-03 01:34:33 +02:00
Lukas Wirth
44b0fe8ec7 cleanup 2022-01-02 23:44:26 +01:00
Lukas Wirth
aeb5d64912 Implement ToDef for ast::Attr 2022-01-02 23:44:26 +01:00
Lukas Wirth
6b7b09d329 internal: Record unresolved derive invocations in hir 2022-01-02 23:44:23 +01:00
bors[bot]
989c06b25d
Merge #11171
11171: fix: Fix tool module classification not working correctly r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-02 22:15:30 +00:00
Lukas Wirth
762a3b3030 Fix tool module classification not working correctly 2022-01-02 23:14:18 +01:00
bors[bot]
35737eb896
Merge #11170
11170: minor: Cleanup syntax highlighting r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-02 21:24:07 +00:00
Lukas Wirth
19d894cdec minor: Cleanup syntax highlighting 2022-01-02 22:23:05 +01:00
bors[bot]
e1099aaa57
Merge #11169
11169: internal: Handle macro calls better in highlighting r=Veykril a=Veykril

Introduces a new semantic highlighting tag for the `!` character of macro calls.

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-02 18:27:16 +00:00
Lukas Wirth
22160c418b fix NameRefClass misclassifying proc-macros 2022-01-02 19:20:10 +01:00
Lukas Wirth
9eed85b171 fix syntactic highlighting for macros 2022-01-02 19:10:23 +01:00
Lukas Wirth
3a525c831f internal: Handle macro calls better in highlighting 2022-01-02 19:10:10 +01:00
bors[bot]
2e7170e07b
Merge #11166
11166: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-02 16:49:40 +00:00
Lukas Wirth
f31863b189 minor: Simplify 2022-01-02 17:37:16 +01:00
Aleksey Kladov
3836b195dd minor: replace panics with types 2022-01-02 19:05:37 +03:00
Aleksey Kladov
174c439c56 minor: drop dead code 2022-01-02 19:03:38 +03:00
Aleksey Kladov
2e34a5e2e9 add empty input tests 2022-01-02 18:50:32 +03:00
Aleksey Kladov
c72908a201 more intuitive order 2022-01-02 18:46:01 +03:00
Aleksey Kladov
d846afdeef check top level entry point invariants 2022-01-02 18:41:32 +03:00
Aleksey Kladov
fa049d94d1 add top-level tests for expressions 2022-01-02 17:52:05 +03:00
Aleksey Kladov
640cc27ff0 add top level tests for types 2022-01-02 17:45:18 +03:00
Aleksey Kladov
e78424846e enforce parsing invariant for patterns 2022-01-02 17:32:15 +03:00
Aleksey Kladov
7989d567e2 internal: more macro tests 2022-01-02 17:18:21 +03:00
Aleksey Kladov
7de4b964a9 add test for macro items 2022-01-02 16:48:10 +03:00
Aleksey Kladov
bebfb83fd0 split prefix/top tests 2022-01-02 15:18:34 +03:00
Aleksey Kladov
2bd7c74706 add tests for macro statements 2022-01-02 15:17:32 +03:00
Aleksey Kladov
f2ea7853ee start top-level entry point tests 2022-01-02 15:15:04 +03:00
Aleksey Kladov
e366b3c730 minor: generalize 2022-01-02 15:01:20 +03:00
Lukas Wirth
8fad24d3c2 minor: Simplify 2022-01-02 12:40:46 +01:00
Laurențiu Nicola
53ddf48df4 Avoid collect_vec from itertools 2022-01-02 12:06:14 +02:00
Laurențiu Nicola
fdf1136e79 Replace folds with for loops 2022-01-02 12:05:35 +02:00
Lukas Wirth
65a1538dd1 internal: Use basic NonEmptyVec in mbe::syntax_bridge 2022-01-02 03:48:19 +01:00
Lukas Wirth
a0e0e4575b Simplify 2022-01-02 02:39:14 +01:00
Lukas Wirth
809461cc42 fix: Enable completions for <_>::$0 2022-01-01 22:20:03 +01:00
Lukas Wirth
44d61766b5 internal: Record unresolved derive invocations in hir 2022-01-01 20:43:25 +01:00
bors[bot]
0e5d8883cc
Merge #11153
11153: internal: add more prefix entry point tests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2022-01-01 17:04:29 +00:00
Aleksey Kladov
e36f557e4d internal: add more prefix entry point tests 2022-01-01 20:04:09 +03:00
bors[bot]
3f2edc72cd
Merge #11136
11136: Turbo fish assist supports multiple type arguments r=matklad a=Vannevelj

This fixes #11135 (changelog: bug).

I've only started using Rust a few days ago but saw this issue on the top of the list when I looked at this repo. I based myself on [this blog post](https://techblog.tonsser.com/posts/what-is-rusts-turbofish) to understand what a "turbo fish" is so let me know if I missed anything.

Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2022-01-01 16:42:22 +00:00
bors[bot]
9c210a49b6
Merge #11151
11151: feat: correctly fallback to notify if the clinet-side file watching is not supported r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2022-01-01 16:17:39 +00:00
Aleksey Kladov
a1c33c2e1a test: force client-side watching
The direct reason for this is to fix CI on windows, which seems to fail
for some reason after we fixed the watcher-selection logic which (I
think) changed the tests behavior to use notify rather than client.

But this patch seems to make sense in general -- file watching is
notoriously finicky, so controlling it explicitly leads to less fragile
tests.
2022-01-01 19:16:25 +03:00
Aleksey Kladov
7c4276b3e1 add path tests 2022-01-01 19:02:47 +03:00
Aleksey Kladov
287e748aa9 add expr tests 2022-01-01 18:58:30 +03:00
Aleksey Kladov
58fa7ce782 tests for ty 2022-01-01 18:58:30 +03:00
Aleksey Kladov
5ca83a5fb3 internal: add tests for patterns 2022-01-01 18:58:30 +03:00
Aleksey Kladov
0d1e23e968 better error message 2022-01-01 18:55:53 +03:00
Aleksey Kladov
b9417f3483 feat: correctly fallback to notify if the clinet-side file watching is not supported 2022-01-01 17:26:54 +03:00
Benjamin Coenen
df6fa50f92 feat(diagnostics): add new config to fill default expression
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-12-31 16:29:08 +01:00
Benjamin Coenen
0435463439 feat(diagnostics): use Default::default() expression instead of todo! when missing fields
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-12-30 15:49:31 +01:00
bors[bot]
22ccb1a104
Merge #11141
11141: internal: add tests for extra parser entry points r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-12-30 10:30:28 +00:00
Ariel Davis
d4262f4af8 Migrate to SyntaxNodePtr in new rowan 2021-12-29 23:48:53 -08:00
Aleksey Kladov
2f3237912d restore invariatns 2021-12-29 20:37:08 +03:00
Aleksey Kladov
b5369927d7 parse empty statemet as statemetn 2021-12-29 20:04:36 +03:00
Aleksey Kladov
841cd30b45 Add test 2021-12-29 19:37:35 +03:00
Aleksey Kladov
f5cfc0504e rename 2021-12-29 19:18:34 +03:00
Aleksey Kladov
8234a85d15 compress 2021-12-29 18:51:05 +03:00
Aleksey Kladov
ad4b02ecc0 add automated semicolon insertion test 2021-12-29 18:37:06 +03:00
Aleksey Kladov
3f5fc05d66 internal: add tests for extra parser entry points 2021-12-29 18:28:11 +03:00
Jeroen Vannevel
b04c4e76df formatting 2021-12-28 18:52:12 +00:00
Jeroen Vannevel
e299fd5475 turbo fish supports multiple type arguments 2021-12-28 18:41:34 +00:00
Aleksey Kladov
ea96c376c8 compress 2021-12-28 19:17:34 +03:00
Aleksey Kladov
660cf34d8c dead code 2021-12-28 19:13:30 +03:00
Aleksey Kladov
bfc263f1f9 introduce hacks module 2021-12-28 18:57:13 +03:00
Aleksey Kladov
aa1788dc71 clarify semantics of doc links 2021-12-28 17:00:55 +03:00
Aleksey Kladov
f9e06e6524 last use of parse api in ssr 2021-12-28 17:00:55 +03:00
Aleksey Kladov
45bba40079 dead code 2021-12-28 17:00:55 +03:00
Aleksey Kladov
55f1564101 remove fragments from syntax 2021-12-28 17:00:55 +03:00
Aleksey Kladov
dacbc6a69a move the rest of ssr parsing to fragments 2021-12-28 17:00:55 +03:00
Aleksey Kladov
7e9c74d20b drop dead code 2021-12-28 17:00:55 +03:00
Aleksey Kladov
2cbfcf431e add ssr fragment for statements 2021-12-28 17:00:55 +03:00
Aleksey Kladov
df2a996cb0 add ssr fragment for expressions 2021-12-28 17:00:55 +03:00
Aleksey Kladov
2d373dc53c verify during parse 2021-12-28 17:00:55 +03:00
Aleksey Kladov
b8b9655236 add test 2021-12-28 17:00:55 +03:00
Aleksey Kladov
f0fefde401 remove Item::parse 2021-12-28 17:00:55 +03:00
Aleksey Kladov
b468bd6645 internal: start isolating ssr-related parsing APIs to SSR 2021-12-28 17:00:55 +03:00
Aleksey Kladov
634c7682c9 add missing test 2021-12-28 17:00:55 +03:00
Aleksey Kladov
8794892432 dead code 2021-12-28 17:00:55 +03:00
Aleksey Kladov
afffa096f6 add TopEntryPoint 2021-12-28 17:00:55 +03:00
Aleksey Kladov
8e7fc7be65 simplify 2021-12-28 17:00:55 +03:00
Aleksey Kladov
369001615f move path 2021-12-28 17:00:55 +03:00
Aleksey Kladov
c5d8a9b341 move expr 2021-12-28 17:00:55 +03:00
Aleksey Kladov
04ae18de29 move ty 2021-12-28 17:00:55 +03:00
Aleksey Kladov
5636bef2ec move pat to prefix entry points 2021-12-28 17:00:55 +03:00
Aleksey Kladov
f10f51833c move stmt to entry points 2021-12-28 17:00:55 +03:00
Aleksey Kladov
519ee21bcb internal: move block to prefix entry point 2021-12-28 17:00:55 +03:00
Aleksey Kladov
350d5dc152 internal: move visibility to a prefix entry point 2021-12-28 17:00:55 +03:00
Aleksey Kladov
abc658aad0 internal: add prefix entry points 2021-12-28 17:00:55 +03:00
Aleksey Kladov
d3ba55bd06 cleanup imports 2021-12-28 17:00:55 +03:00
Aleksey Kladov
23ce31e836 simplify 2021-12-28 17:00:55 +03:00
bors[bot]
4d3ad04a9c
Merge #11131
11131: internal: avoid speculation when completing macros r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-12-28 13:52:52 +00:00
Aleksey Kladov
177a183e85 minor: simplify 2021-12-28 16:52:15 +03:00
Aleksey Kladov
56b51852c2 minor: dedup 2021-12-28 16:52:15 +03:00
Aleksey Kladov
726da9884b avoid speculation when completing macros 2021-12-28 16:52:15 +03:00
Aleksey Kladov
621ba1c2d3 import style 2021-12-28 13:52:40 +03:00
Aleksey Kladov
42ff46c1e8 minor 2021-12-27 21:45:42 +03:00
Aleksey Kladov
8e9734e18f fix line endings 2021-12-26 18:46:21 +03:00
Aleksey Kladov
b360ea91f2 internal: move inline parser tests to parser crate 2021-12-26 18:19:09 +03:00
Aleksey Kladov
0f74758fea internal: move outlined parser tests 2021-12-26 17:58:33 +03:00
Aleksey Kladov
f4cb0ff9be internal: move ws attachment logic to the parser crate
This has to re-introduce the `sink` pattern, because doing this purely
with iterators is awkward :( Maaaybe the event vector was a false start?

But, anyway, I like the current factoring more -- it sort-of obvious
that we do want to keep ws-attachment business in the parser, and that
we also don't want that to depend on the particular tree structure. I
think `shortcuts` module achieves that.
2021-12-26 16:47:10 +03:00
Aleksey Kladov
f692fafee8 rename 2021-12-25 22:03:57 +03:00
Aleksey Kladov
74de79b1da internal: rename 2021-12-25 22:02:26 +03:00
Aleksey Kladov
d0d05075ed internal: replace TreeSink with a data structure
The general theme of this is to make parser a better independent
library.

The specific thing we do here is replacing callback based TreeSink with
a data structure. That is, rather than calling user-provided tree
construction methods, the parser now spits out a very bare-bones tree,
effectively a log of a DFS traversal.

This makes the parser usable without any *specifc* tree sink, and allows
us to, eg, move tests into this crate.

Now, it's also true that this is a distinction without a difference, as
the old and the new interface are equivalent in expressiveness. Still,
this new thing seems somewhat simpler. But yeah, I admit I don't have a
suuper strong motivation here, just a hunch that this is better.
2021-12-25 22:02:26 +03:00
rainy-me
d77d3234ce refactor: avoid filter map next with find map separate traversal 2021-12-25 09:08:13 +09:00
hkalbasi
e6139cf47b show values of constants in hover 2021-12-23 17:53:46 +03:30
Heinenen
05abfc77f5 hide type inlay hints 2021-12-23 12:56:38 +01:00
Heinenen
d7dfe93fc3 hide type inlay hints for enum variant constructors and tuple struct constructors 2021-12-23 12:56:38 +01:00
Petr Nevyhoštěný
d9b3242bcd Fix generic type substitution in impl trait with assoc type 2021-12-23 10:16:24 +01:00
Wang Ruochen
be5205170c
Update comment 2021-12-22 14:17:43 -08:00
Wang Ruochen
44edf63edd
Add pattern when there's no else branch 2021-12-22 10:18:37 -08:00
bors[bot]
578269e613
Merge #11093
11093: fix: Do not complete `Drop::drop`, complete `std::mem::drop` instead r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-22 01:48:31 +00:00
Lukas Wirth
85ed5a3182 Make hover test not relient on minicore structure 2021-12-22 02:36:31 +01:00
Lukas Wirth
5360c9bd22 fix: Do not complete Drop::drop, complete std::mem::drop instead 2021-12-22 02:25:38 +01:00
Wang Ruochen
2bd2960fda
Don't support if-let branches 2021-12-21 16:51:26 -08:00
Wang Ruochen
d0986cd96b
Move variables into the closure 2021-12-21 16:48:02 -08:00
bors[bot]
d4c5bf7828
Merge #11092
11092: internal: Directly use self param in completions instead of searching r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-21 23:20:16 +00:00
Lukas Wirth
276687a6ee internal: Directly use self param in completions instead of searching 2021-12-22 00:18:39 +01:00
bors[bot]
47fad0ed73
Merge #11071 #11090
11071: feat: Build and publish pre-release Code extension versions r=matklad a=lnicola

Closes #11026

11090: internal: Deduplicate lower ctx hygiene field r=Veykril a=Veykril

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-21 17:37:56 +00:00
Lukas Wirth
e76e0e843d Simplify 2021-12-21 18:28:04 +01:00
Lukas Wirth
0b1c434d53 Deduplicate lower ctx hygiene field 2021-12-21 18:27:54 +01:00
Lukas Wirth
60dfe8ceed Replace a few String instances with SmolStr in completions 2021-12-21 16:57:16 +01:00
Lukas Wirth
7f7a3644b3 Fully render type alias completions from hir 2021-12-21 16:36:23 +01:00
Lukas Wirth
40d5c58a80 Fully render const item completions from hir 2021-12-21 16:35:51 +01:00
Lukas Wirth
929cae74b1 fmt +stable 2021-12-21 15:48:12 +01:00
Lukas Wirth
95ae67b0b0 Simplify type alias rendering, remove constructor structs 2021-12-21 15:37:43 +01:00
Lukas Wirth
97f7865c56 Simplify macro rendering, remove constructor structs 2021-12-21 15:20:15 +01:00
Lukas Wirth
2b60d80eaf Simplify const rendering, remove constructor structs 2021-12-21 15:04:19 +01:00
Lukas Wirth
e99ed3e407 Simplify enum variant rendering, remove constructor structs 2021-12-21 15:01:52 +01:00
Lukas Wirth
a720fc8e3a Simplify function rendering, remove constructor structs 2021-12-21 14:51:06 +01:00
Lukas Wirth
22b2c2fdf7 Simplify 2021-12-21 14:07:48 +01:00
Lukas Wirth
539b0c2582 fix: Fix inline local assist not working in let stmt initializer 2021-12-21 14:03:59 +01:00
Lukas Wirth
8e084132f8 internal: Do less work in hir::Semantics 2021-12-21 13:38:58 +01:00
Laurențiu Nicola
01143c6600 Fix typo in reformat number assist label 2021-12-21 09:45:20 +02:00
bors[bot]
851af5a52b
Merge #11074
11074: Bump default CHALK_SOLVER_MAX_SIZE to 150 r=lnicola a=lnicola

Fixes #11072

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-20 18:38:47 +00:00
Laurențiu Nicola
3f3aee53b4 Bump default CHALK_SOLVER_MAX_SIZE to 150 2021-12-20 20:35:45 +02:00
bors[bot]
c5722a66c5
Merge #11073
11073: fix: Fix windows not finding the pdb file r=lnicola a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 18:20:08 +00:00
Lukas Wirth
4a5c8c6ad2 fix: Fix windows not finding the pdb file 2021-12-20 19:17:31 +01:00
bors[bot]
d3aa2579cc
Merge #11069
11069: fix: Partially fix `ide_db::search` for crate roots r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 16:50:35 +00:00
Lukas Wirth
5206946674 fix: Partially fix ide_db::search for crate roots 2021-12-20 17:48:47 +01:00