Commit Graph

163 Commits

Author SHA1 Message Date
Lukas Wirth
741b2f531f Don't take the parent kind of trailing attributes in attr completion 2021-05-31 15:35:22 +02:00
Lukas Wirth
971b0836ef Use Names instead of Strings in the completion rendering api 2021-05-31 14:15:15 +02:00
bors[bot]
92b9e5ef3c
Merge #9068
9068: Move more `CompletinoContext` fields to `ImmediateLocation` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-30 19:37:29 +00:00
Lukas Wirth
5660408f0a Move more fields to ImmediateLocation 2021-05-30 21:35:01 +02:00
Lukas Wirth
c5cd25d755 Fix incorrect prefer_inner calls on some attribute completions 2021-05-30 17:13:00 +02:00
Jonas Schievink
39533ad7dd Only complete derive proc macros in #[derive] 2021-05-29 21:18:14 +02:00
Lukas Wirth
c9598a4cbf Add some lint completion tests 2021-05-29 17:19:49 +02:00
bors[bot]
247faf271b
Merge #9027
9027: feat: Attribute completion is context aware r=Veykril a=Veykril

This splits off the `lint` and `derive` completions into their own submodules of `attribute`.

The idea is to create a lazy global hashmap that maps `SyntaxKind` to attribute names(`&[&str]`) in which we index with the syntax kind of the "thing" we are attributing giving us the attributes back that are valid for this kind. Then we use this name to do a binary search on the attribute list to fetch and build the corresponding completion item.


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-29 12:14:16 +00:00
Lukas Wirth
c9f0f47bbb simplify 2021-05-29 14:02:06 +02:00
Lukas Wirth
e42c448077 More completion pattern tests 2021-05-28 22:19:52 +02:00
Lukas Wirth
47ad752e6c Implement prev sibling determination for CompletionContext 2021-05-28 22:03:31 +02:00
Lukas Wirth
a6b92a8cc0 simplify 2021-05-28 20:46:09 +02:00
Lukas Wirth
439ae17e1b Don't label derive macros with their banged_name 2021-05-28 14:59:24 +02:00
Lukas Wirth
1894db49b1 Complete keywords in (Assoc)ItemList with leading attribute 2021-05-28 03:20:55 +02:00
Lukas Wirth
9e71dd9799 Only complete modules in empty use-statements 2021-05-28 02:42:47 +02:00
Lukas Wirth
411eee7614 Add another attribute completion test 2021-05-28 01:09:22 +02:00
Lukas Wirth
0724bd0f21 Add attribute completion tests 2021-05-28 01:02:41 +02:00
Lukas Wirth
594270be49 tt muncher time 2021-05-28 00:35:21 +02:00
Lukas Wirth
ab9c6ea4dd Split attribute completion module into attribute, derive and lint modules 2021-05-27 23:40:33 +02:00
Lukas Wirth
fc37e2f953 Attribute completion is context aware 2021-05-27 23:28:14 +02:00
Lukas Wirth
ea251cbd4a Complete modules in item lists 2021-05-27 21:12:50 +02:00
Lukas Wirth
7ad378fec0 Complete modules in assoc item lists 2021-05-27 20:53:38 +02:00
Lukas Wirth
3a16950fd9 Cleanup ImmediateLocation determination 2021-05-27 18:16:39 +02:00
Lukas Wirth
f41c983424 Don't complete non-macro item paths in impls and modules 2021-05-27 12:23:36 +02:00
Lukas Wirth
30948e1ecb simplify 2021-05-27 03:47:20 +02:00
Lukas Wirth
6ec4ea8d9e simplify 2021-05-27 03:15:48 +02:00
Lukas Wirth
7de925b8ab Collapse more CompletionContext booleans into enums 2021-05-27 02:54:49 +02:00
Lukas Wirth
1f897f7319 Set record_pat_syntax more precisely in CompletionContext 2021-05-26 23:46:00 +02:00
bors[bot]
666fc1cec1
Merge #9015
9015: Merge pattern completion related bools into an enum r=Veykril a=Veykril

The two bools can never both be set so this is basically just a tri-state enum.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-26 20:43:53 +00:00
Lukas Wirth
7d865ef071 Merge pattern completion related bools into an enum 2021-05-26 22:39:47 +02:00
bors[bot]
8389510f8d
Merge #9012
9012: feat: add tab stops for keyword completions r=matklad a=eduardocanellas

Add tab stops for all the keywords that I judged fit. I also introduced some line breaks and spaces, following the pattern I saw in the `postfix` module.

Co-authored-by: Eduardo Canellas <eduardocanellas98@gmail.com>
2021-05-26 20:29:52 +00:00
Lukas Wirth
26e784a575 simplify 2021-05-26 21:09:27 +02:00
Eduardo Canellas
052df3deb7 feat: add tab stops for keyword completions 2021-05-26 14:24:54 -03:00
Eduardo Canellas
ce36746035 fix: remove undesired completions from trait/impl blocks 2021-05-26 13:21:27 -03:00
Eduardo Canellas
e31a762c63 fix: don't show pd/ppd completions where it shouldn't be 2021-05-25 11:53:11 -03:00
Aleksey Kladov
45112aa8c0 internal: rename hypothetical -> speculative
Lets steal this good naming from Roslyn before I forget about it yet
again.
2021-05-24 22:21:25 +03:00
Florian Diebold
b8262099cc Get rid of field_type again 2021-05-23 23:54:35 +02:00
Florian Diebold
e65803748d Infer correct expected type in closure
Sadly currently only works if the closure body isn't completely missing.
2021-05-23 18:45:44 +02:00
Florian Diebold
7a0c93c58a Infer correct expected type for generic struct fields 2021-05-23 18:45:44 +02:00
Florian Diebold
4a6cdd776d Record method call substs and use them in call info 2021-05-23 18:24:21 +02:00
Florian Diebold
34a3bc4196 Paper over #8931 a bit more
The problem was the skipping of binders in
`resolve_method_call_as_callable`; this still doesn't use the _correct_
substitution, but at least it doesn't return a type with free variables
in it.

Fixes #8931.
2021-05-23 13:00:14 +02:00
Florian Diebold
a5d85a6356 Add test for #8931 and better checking 2021-05-23 12:52:41 +02:00
Florian Diebold
48c492af7e Fix compilation of hir and ide crates 2021-05-21 17:48:34 +02:00
Lukas Tobias Wirth
b4fe479236 Replace ImportGranularity::Guess with guessing boolean flag 2021-05-19 15:57:10 +02:00
Lukas Tobias Wirth
64f7072c25 MergeBehavior -> ImportGranularity 2021-05-18 19:53:20 +02:00
Lukas Wirth
5b247780d4 simplify 2021-05-15 01:09:53 +02:00
bors[bot]
77f0c92fd8
Merge #8794
8794: Give MergeBehaviour variants better names r=Veykril a=Veykril

I never really liked the variant names I gave this enum from the beginning and then I found out about rustfmt's `imports_granularity` config:

> imports_granularity
>
> How imports should be grouped into use statements. Imports will be merged or split to the configured level of granularity.
> 
>     Default value: Preserve
>     Possible values: Preserve, Crate, Module, Item
>     Stable: No

I personally prefer using `crate` over `full` and `module` over last, they seem more descriptive. Keeping these similar between tooling also seems like a good plus point to me.

We might even wanna take over the entire enum at some point if we have a `format/cleanup imports` assists in the future which would probably want to also have the `preserve` and `item` options.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-10 20:10:59 +00:00
Lukas Wirth
6a8d47e7f0 Give MergeBehaviour variants better names 2021-05-10 21:14:59 +02:00
mixio
aa9002c68a
Corrected 2 typos on line 83 2021-05-10 20:05:32 +02:00
Lukas Wirth
174f043c8d Add = to pattern recovery 2021-05-08 23:14:08 +02:00