Commit graph

472 commits

Author SHA1 Message Date
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