Florian Diebold
4ed5fe1554
Fix assoc type shorthand from method bounds
...
In code like this:
```rust
impl<T> Option<T> {
fn as_deref(&self) -> T::Target where T: Deref {}
}
```
when trying to resolve the associated type `T::Target`, we were only
looking at the bounds on the impl (where the type parameter is defined),
but the method can add additional bounds that can also be used to refer
to associated types. Hence, when resolving such an associated type, it's
not enough to just know the type parameter T, we also need to know
exactly where we are currently.
This fixes #11364 (beta apparently switched some bounds around).
2022-02-03 13:15:02 +01:00
bors[bot]
9cb6e3a190
Merge #11394
...
11394: feat: Deprioritize completions of private but editable definitions r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-02 11:42:40 +00:00
bors[bot]
d20ff92747
Merge #11395
...
11395: fix: Fix and re-enable format string completions r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-02 11:20:38 +00:00
Lukas Wirth
6f974cf477
fix: Fix and re-enable format string completions
2022-02-02 12:20:10 +01:00
Lukas Wirth
7267749f6b
Cleanup Completions
api a bit
2022-02-02 12:19:43 +01:00
Lukas Wirth
5c41f5d165
feat: Deprioritize completions of private but editable definitions
2022-02-02 02:05:49 +01:00
Lukas Wirth
d7a544e69a
fix: Complete functions and methods from block level impls
2022-02-01 23:29:40 +01:00
Lukas Wirth
fcdced115e
Deprioritize ops function completions for non-method calls
2022-02-01 12:33:55 +01:00
Lukas Wirth
6194092086
Complete local fn and closure params from surrounding locals scope
2022-01-31 11:56:42 +01:00
Laurențiu Nicola
c504518775
Temporarily disable format string completions
2022-01-17 09:30:35 +02:00
Lukas Wirth
82fccb971e
feat: Add very simplistic ident completion for format_args! macro input
2022-01-15 12:23:26 +01:00
Lukas Wirth
2c36102722
internal: Decrease PartialOrd and PartialEq trait methods completion relevance
2022-01-15 11:05:13 +01:00
bors[bot]
fc331fe831
Merge #11282
...
11282: fix: Properly cache files in Semantics when ascending macros r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11280
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-14 10:08:27 +00:00
Lukas Wirth
2f8dd64830
Replace HasSource usages with Semantics equivalent
2022-01-14 10:59:27 +01:00
Laurențiu Nicola
84c59a1f9f
Reformat code
2022-01-13 21:07:17 +02:00
bors[bot]
4fe10b7bfe
Merge #11265
...
11265: fix: Fix postfix completion panic r=lnicola a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11233
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-12 12:30:41 +00:00
Lukas Wirth
09ce5d81d0
fix: Fix postfix completion panic
2022-01-12 13:07:16 +01:00
bors[bot]
de50ef4bea
Merge #11263
...
11263: fix: Fix don't drop param completions when fully typing out a pattern r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-12 11:37:18 +00:00
Lukas Wirth
314b199e3c
fix: Fix don't drop param completions when fully typing out a pattern
2022-01-12 12:36:46 +01:00
Lukas Wirth
51419c1931
Don't complete attributes with existing expressions
2022-01-11 19:03:21 +01:00
Lukas Wirth
4901ea3eef
Lookup lang attribute on assoc item trait directly
2022-01-11 10:28:38 +01:00
Lukas Wirth
94b369faa3
Update tests
2022-01-11 09:26:53 +01:00
Lukas Wirth
ca0633c808
feat: Deprioritize ops methods in completion
2022-01-11 09:26:53 +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
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
Eduardo Canellas
a973e5a9db
refactor: apply review suggestions
2022-01-04 19:30:57 -03:00
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
5fbdf20765
minor: Simplify
2022-01-04 10:56:28 +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
Aleksey Kladov
bfc263f1f9
introduce hacks module
2021-12-28 18:57:13 +03:00
Aleksey Kladov
726da9884b
avoid speculation when completing macros
2021-12-28 16:52:15 +03:00
Aleksey Kladov
42ff46c1e8
minor
2021-12-27 21:45:42 +03: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
5360c9bd22
fix: Do not complete Drop::drop
, complete std::mem::drop
instead
2021-12-22 02:25:38 +01: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
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