Lukas Wirth
136dadac9a
Add completion module tailored towards visibility modifiers
2022-02-03 15:52:03 +01:00
Lukas Wirth
661d721e20
Add completion module tailored towards use trees
2022-02-03 15:51:57 +01:00
Lukas Wirth
6940cca760
Move attribute path completions into attribute completion module
2022-02-03 15:50:14 +01:00
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
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
bors[bot]
8dc3a270f6
Merge #11067
...
11067: internal: Store function param names in ItemTree r=Veykril a=Veykril
This prevents us reparsing source files for completions, sometimes slowing them down massively if the source file is not cached at the expense of a slightly bigger memory usage.
related info https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Completion.20performance
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 14:43:39 +00:00
Lukas Wirth
cd9d76e0ca
internal: Store function param names in ItemTree
2021-12-20 15:24:37 +01:00
bors[bot]
f46731a230
Merge #11028
...
11028: Bump MSRV (1.57) r=Veykril a=iDawer
This bumps MSRV on all crates to 1.57 except `la-arena`
#10986 requires >=1.57
Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2021-12-20 13:45:35 +00:00
Lukas Wirth
f609efff87
Simplify
2021-12-20 14:38:22 +01:00
bors[bot]
81d0096000
Merge #11035
...
11035: Include clippy lint groups in autocomplete r=Veykril a=k-nasa
## Why
close: https://github.com/rust-analyzer/rust-analyzer/issues/11027
## Proof
I confirmed that complement candidates are coming out.
https://user-images.githubusercontent.com/23740172/146465758-bc7d5cdd-e2fb-48d6-abf7-804ba859c9b1.mov
Co-authored-by: k-nasa <htilcs1115@gmail.com>
2021-12-18 17:59:29 +00:00
k-nasa
71ac246bd4
refactor: chain iter
2021-12-18 23:19:29 +09:00
bors[bot]
6674756c07
Merge #11041
...
11041: minor: Fix some clippy lints r=lnicola a=lnicola
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-17 15:52:53 +00:00
bors[bot]
04b0b19cdb
Merge #10527
...
10527: internal: Remove a few snippet completions, replace them with user snippets definitions in VSCode r=Veykril a=Veykril
Closes https://github.com/rust-analyzer/rust-analyzer/issues/9636
cc https://github.com/rust-analyzer/rust-analyzer/issues/7033#issuecomment-939959905
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-17 15:44:48 +00:00
Lukas Wirth
2a88b76041
Update tests
2021-12-17 16:39:21 +01:00
Laurențiu Nicola
fb9529626d
Spelling nits
2021-12-17 17:26:35 +02:00
Lukas Wirth
9fe0f0d1d9
Add a few default snippets for VSCode
2021-12-17 16:24:29 +01:00
Lukas Wirth
d3e538638a
fix: Don't duplicate attribute completions
2021-12-17 15:22:53 +01:00
k-nasa
7643e08962
Add clippy lint group to attribute auto compleme
2021-12-17 08:34:08 +09:00
iDawer
676744be6e
Bump MSRV (1.57)
2021-12-16 01:56:12 +05:00
Lukas Wirth
901c7c7277
match_ast!
takes a pattern to allow underscore usage
2021-12-14 12:44:31 +01:00
bors[bot]
3f550d2e38
Merge #11000
...
11000: fix: insert whitespaces into assoc items for assist when macro generated r=Veykril a=Veykril
This is obviously only a temporary hack which still produces ugly looking items, but as long as the syntax is valid one can at least have rustfmt fix the formatting again.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6588
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-13 15:43:12 +00:00
Lukas Wirth
749eeef3e7
fix: insert whitespaces into assoc items for assist when macro generated
2021-12-13 16:35:32 +01:00
Lukas Wirth
328419534d
Move ws insert rendering for macro expansion into ide_db
2021-12-13 15:55:13 +01:00
Florian Diebold
d599f819e0
Fix expected type calculation in struct literal if followed by comma
2021-12-11 18:47:45 +01:00
bors[bot]
48cd733c9e
Merge #10956 #10986
...
10956: minor: Bump deps r=Veykril a=lnicola
bors r+
10986: fix: Fix lint completions not working for unclosed attributes r=Veykril a=Veykril
Fixes #10682
Uses keywords and nested `TokenTree`s as a heuristic to figure out when to stop parsing in case the attribute is unclosed which should work pretty well as attributes are usually followed by either of those.
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-11 14:58:07 +00:00
Lukas Wirth
0001a42570
fix: Fix lint completions not working for unclosed attributes
2021-12-11 15:55:25 +01:00
bors[bot]
d97f2f6b9b
Merge #10976
...
10976: fix: Show case-insensitive exact matches instead of fuzzy flyimport for short paths r=Veykril a=Veykril
And raise the fuzzy trigger from 2 to 3 chars. This way we keep the ability of flyimporting short names like `Rc`.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6917
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-11 13:50:55 +00:00
Lukas Wirth
143a30aa51
Show case-insensitive exact matches instead of fuzzy flyimport for short paths
2021-12-11 14:47:11 +01:00
Lukas Wirth
c81aa68afe
Don't show trait flyimports for impl trait and placeholders
2021-12-10 19:18:21 +01:00
Lukas Wirth
a7fc2061ea
Show enum completions for single variant enums in irrefutable patterns
2021-12-10 18:25:54 +01:00
bors[bot]
77f2d34930
Merge #10950
...
10950: internal: completion: split out more PathKinds from ImmediateLocation r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-07 21:57:59 +00:00
Lukas Wirth
ae0c7268f7
internal: completion: split out more PathKinds from ImmediateLocation
2021-12-07 22:49:42 +01:00
Lukas Wirth
e09d410dcd
Simplify
2021-12-07 15:06:56 +01:00
bors[bot]
6f84bbfa1e
Merge #10943
...
10943: feat: Enable completions for attributes r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-05 15:14:10 +00:00
Lukas Wirth
1f254dd855
feat: Enable flyimport completions for attributes
2021-12-05 15:57:28 +01:00
Laurențiu Nicola
bff377c712
Clean up some unused cross-crate dependencies
2021-12-05 13:54:49 +02:00
Lukas Wirth
e4f2d0e3a8
Introduce SymbolKind::Derive
2021-12-04 18:18:09 +01:00
Lukas Wirth
642c1eb720
Introduce SymbolKind::Attribute
2021-12-04 18:01:22 +01:00
Lukas Wirth
d174158abc
Rename things: Tool -> ToolModule
2021-12-03 17:15:19 +01:00
Lukas Wirth
d1677f3286
Remove syntax highlighting hack for builtin attrs
2021-12-03 16:54:34 +01:00
bors[bot]
4ca6233bd2
Merge #10847
...
10847: fix: derive attr path handling in `replace_derive_with_manual_impl` r=rainy-me a=rainy-me
partially fixes #10666
renaming issues mentioned in https://github.com/rust-analyzer/rust-analyzer/issues/10666#issuecomment-955671021 doesn't seem to be fixable at this moment since it's not searchable?(not recorded?) by name.
<del>I'm not sure if it's appropriate to move `parse_comma_sep_paths` function to a method in `ast/node_ext`, maybe `ide_db::helpers` also make sense.</del> put into `ide_db::` instead.
Co-authored-by: rainy-me <github@yue.coffee>
2021-11-24 15:33:00 +00:00
rainy-me
0bb08ccb8f
fix: derive path handling
2021-11-25 00:21:29 +09:00
Lukas Wirth
0c98a01b3e
Remove possible multiline details in completions
2021-11-24 16:08:11 +01:00
Andrew Leverette
7f15537fa9
Add optimization for not allocating in case of no module path for struct literal
2021-11-23 14:41:31 -06:00
Andrew Leverette
ce7a141110
Add support for qualified struct names
2021-11-23 10:57:29 -06:00
Lukas Wirth
77f08d0fc3
Split parts of ide_db::call_info
off into ide
2021-11-22 13:23:34 +01:00
Lukas Wirth
f2f89618b7
minor: Simplify
2021-11-16 19:28:32 +01:00
zhoufan
5666046ec9
fix: flyimport triggers on enum variant declarations
2021-11-14 12:16:21 +08:00
Lukas Wirth
dea973089c
Simplify
2021-11-10 18:26:18 +01:00