Commit Graph

190 Commits

Author SHA1 Message Date
bors[bot]
c6133fe51c
Merge #9195
9195: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-09 21:45:35 +00:00
Lukas Wirth
20d26bd109 Simplify 2021-06-09 23:45:12 +02:00
Lukas Wirth
ae8d74ab2c Implement dummy expansions for builtin attributes 2021-06-09 18:27:08 +02:00
bors[bot]
b6199de706
Merge #9181 #9182
9181: Don't complete values in type position r=jonas-schievink a=Veykril

Will add some proper tests in a bit

9182: fix: don't complete derive macros as fn-like macros r=jonas-schievink a=jonas-schievink

Part of https://github.com/rust-analyzer/rust-analyzer/issues/8518

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-08 19:09:13 +00:00
Lukas Wirth
1a26af15ef Add tests checking no value completion in type pos 2021-06-08 20:27:25 +02:00
Jonas Schievink
ee374ff1ee fix: don't complete derive macros as fn-like macros 2021-06-08 17:31:47 +02:00
Lukas Wirth
1d74ef1d98 Don't complete values in type position 2021-06-08 16:50:10 +02:00
Lukas Wirth
2987e05f15 simplify 2021-06-07 20:45:17 +02:00
Lukas Wirth
b29e8ed994 Remove unnecessary completion::macro_in_item_position 2021-06-07 19:46:25 +02:00
Lukas Wirth
aa29364f83 Reorder CompletionContext fields 2021-06-07 19:06:03 +02:00
Lukas Wirth
4eabcb2c01 Move more things into PathCompletionContext 2021-06-07 14:08:05 +02:00
Lukas Wirth
e475bcdcc6 Simplify CompletionContext by introducing a path CallKind enum 2021-06-06 20:02:26 +02:00
bors[bot]
ad9234fef2
Merge #9140
9140: feat: Render documentation for derive completion r=Veykril a=Veykril

![eEzGiq2wNa](https://user-images.githubusercontent.com/3757771/120847308-9c5a3300-c573-11eb-958d-e0f22f4757ed.gif)

Nothing fancy as all the std derives aren't really documented though maybe some 3rd party crates document them equally to their trait counterparts.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-05 17:23:40 +00:00
Lukas Wirth
abc941d2c8 Fix incorrect list nesting in format_like feature description 2021-06-05 12:43:45 +02:00
Lukas Wirth
544eca10d6 Complete third-party attributes 2021-06-04 21:07:19 +02:00
Lukas Wirth
7524850831 Render documentation for derive completion 2021-06-04 20:58:12 +02:00
Lukas Wirth
343df88ac7 Generate default lint completions 2021-06-04 18:35:19 +02:00
Lukas Wirth
5d17b6a687 Implement hover for lints 2021-06-04 17:03:18 +02:00
Matthias Krüger
9452dfaac7 NFC: remove redundant clones (clippy::perf) 2021-06-03 15:32:46 +02:00
Lukas Wirth
76fd1b316f Remove obsolete is_new_item field on CompletionContext 2021-06-02 17:12:36 +02:00
Lukas Wirth
9271941a95 Add MethodCall and FieldAccess variants to ImmediateLocation 2021-06-02 15:21:18 +02:00
Jonas Schievink
f96c1a0414 Implement per-edition preludes 2021-06-01 13:39:19 +02:00
bors[bot]
c460baeaf3
Merge #9079
9079: Don't take the parent kind of trailing attributes in attr completion r=Veykril a=Veykril

bors r+
fixes https://github.com/rust-analyzer/rust-analyzer/issues/9076

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-31 13:38:32 +00:00
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
fb7105a580 Add config setting for self-on-the-fly 2021-05-31 15:14:56 +02:00
Lukas Wirth
4507382f2e Move unprefixed field/method completion to dot 2021-05-31 15:10:20 +02:00
Lukas Wirth
d346f5bf75 Less strings, more hir::Names 2021-05-31 14:55:16 +02:00
Lukas Wirth
ca49fbe0a1 Complete self. prefixed fields and methods inside methods 2021-05-31 14:52:55 +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