Lukas Wirth
189440c7b5
Add a Union to the base item completion test fixture
2021-07-23 17:02:39 +02:00
Jonas Schievink
c8d915e2ea
Fix formatting and use Iterator::any
2021-07-23 16:45:14 +02:00
Lukas Wirth
8de3f7ee53
Move out unqualified_path completion tests
2021-07-23 16:37:19 +02:00
Lukas Wirth
ea72a5136c
Add functions to base items completion test fixture
2021-07-23 16:12:09 +02:00
Jonas Schievink
b0f7aac72f
Respect #[doc(hidden)]
in dot-completion
2021-07-23 15:36:43 +02:00
Lukas Wirth
1f558faa8d
Describe the current lifetime/label completion specifics
2021-07-22 20:18:46 +02:00
Lukas Wirth
d5947d9d48
Clarify what the outline test module is for
2021-07-22 20:03:29 +02:00
Lukas Wirth
2d696b9c9e
Move out record completion tests
2021-07-22 19:38:49 +02:00
bors[bot]
0bee7cb716
Merge #9453
...
9453: Add first-class limits. r=matklad,lnicola a=rbartlensky
Partially fixes #9286 .
This introduces a new `Limits` structure which is passed as an input
to `SourceDatabase`. This makes limits accessible almost everywhere in
the code, since most places have a database in scope.
One downside of this approach is that whenever you query limits, you
essentially do an `Arc::clone` which is less than ideal.
Let me know if I missed anything, or would like me to take a different approach!
Co-authored-by: Robert Bartlensky <bartlensky.robert@gmail.com>
2021-07-22 10:33:05 +00:00
Lukas Wirth
03efb50ae8
Move out fn_param tests
2021-07-21 21:39:40 +02:00
Lukas Wirth
9485d6efba
Fix some clippy lints in ide_completion
2021-07-21 19:52:10 +02:00
Lukas Wirth
ccde0bcd1f
Only complete ancestors and self in visibility path completions
2021-07-21 18:54:12 +02:00
Lukas Wirth
3956a5b757
Simplify
2021-07-21 18:34:43 +02:00
Tom Dohrmann
7b20904e8b
hide keyword suggestions in non trivial paths
2021-07-21 12:53:50 +02:00
Lukas Wirth
c83e37c001
cov-mark
2021-07-20 19:00:52 +02:00
bors[bot]
33972da625
Merge #9651
...
9651: Restrict completions inside visibility modifiers r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-20 16:38:40 +00:00
Lukas Wirth
f6cb42fdb8
Restrict completions inside visibility modifiers
2021-07-20 18:37:52 +02:00
mahdi-frms
65839f4069
add 'use' prefix for any auto-import
2021-07-20 18:35:19 +04:30
Robert Bartlensky
0b3d0cde8b
Add Limit
struct.
...
Fixes #9286 .
2021-07-19 13:26:11 +01:00
Aleksey Kladov
15f11dce4a
feat: improve parser error recovery for function parameters
2021-07-17 22:41:04 +03:00
Lukas Wirth
efc96b2c60
Add regression test fo #7222
2021-07-15 22:23:34 +02:00
Lukas Wirth
317b0c2e6d
Move attribute completion tests
2021-07-15 16:27:01 +02:00
Levente Gyozo Lenart
a3f0197454
Update tests
2021-07-14 18:20:01 +02:00
Levente Gyozo Lenart
a0bc236adf
Add true and false as completion suggestions when expecting an expression
2021-07-14 18:19:47 +02:00
bors[bot]
87621de2b9
Merge #9567 #9568
...
9567: remove unneded special case r=matklad a=matklad
bors r+
🤖
9568: feat: add 'for' postfix completion r=lnicola a=mahdi-frms
![Peek 2021-07-11 16-45](https://user-images.githubusercontent.com/62165556/125194692-a0aaf780-e267-11eb-952a-81de7955d9a1.gif )
adds #9561
used ```ele``` as identifier for each element in the iteration
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2021-07-11 12:51:33 +00:00
mahdi-frms
7bae9c9187
add 'for' postfix completion
2021-07-11 17:10:57 +04:30
vi_mi
1338ddbe80
add: Adding self keyword completion in complete_fn_param
2021-07-10 16:11:15 +05:30
Lukas Wirth
2e8f3fee3f
Add test for trait completion label edit
2021-07-07 19:54:58 +02:00
Lukas Wirth
68f68534c6
Don't add the trait name to the insert text in completions
2021-07-07 19:42:09 +02:00
Lukas Wirth
9f9cc72ee5
Complete crate
, super
and self
in non-usetree paths
2021-07-07 19:08:37 +02:00
mahdi-frms
6ac54319ea
show 'as' or 'use' before label traits
2021-07-05 16:44:44 +04:30
bors[bot]
b52306ed37
Merge #9493
...
9493: minor: drop dummy authors field r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-05 11:20:21 +00:00
Aleksey Kladov
86720f2953
minor: drop dummy authors field
2021-07-05 14:19:41 +03:00
mahdi-frms
02d33c9856
eliminate find_use_path and show 'as' and 'use'
2021-07-05 02:15:31 +04:30
mahdi-frms
486bffc23e
show imported trait on autocompletion of associated items
2021-07-05 02:13:49 +04:30
Aleksey Kladov
9b3292541c
internal: improve feedback for relevance tests
2021-07-04 17:03:28 +03:00
Aleksey Kladov
fbb9d69758
feat: always prefer postfix snippets if there's exact textual match
...
Note that, while we don't currently have a fuzzy-matching score, it
makes sense to special-case postfix templates -- it's very annoying when
`.not()` gets sorted before `.not`. We might want to move this infra to
fuzzy matching, once we have that!
2021-07-04 16:50:02 +03:00
Aleksey Kladov
6e9780c005
internal: make CompletionItem and SourceChange consistent
...
Before this PR, SourceChange used a bool and CompletionItem used an enum
to signify if edit is a snippet. It makes sense to use the same pattern
in both cases. `bool` feels simpler, as there's only one consumer of
this API, and all producers are encapsulated anyway (we check the
capability at the production site).
2021-07-04 15:44:03 +03:00
Aleksey Kladov
e9d52c23b3
minor: fix lint completion sourcegen
2021-07-04 11:30:56 +03:00
Aleksey Kladov
660930623e
feat: regenrate lint completions
2021-07-03 22:24:36 +03:00
Aleksey Kladov
58d2ece88a
internal: overhaul code generation
...
* Keep codegen adjacent to the relevant crates.
* Remove codgen deps from xtask, speeding-up from-source installation.
This regresses the release process a bit, as it now needs to run the
tests (and, by extension, compile the code).
2021-07-03 22:11:03 +03:00
bors[bot]
c8d0ca8080
Merge #9398
...
9398: minor: Complete `macro_use` attribute on modules r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-24 20:21:20 +00:00
Lukas Wirth
63b1394b70
Complete macro_use
attribute on modules
2021-06-24 22:20:56 +02:00
Lukas Wirth
85736f2dc9
Fix incorrect base fixture in ide_completion tests
2021-06-23 19:13:27 +02:00
Lukas Wirth
9abd28ac37
Restrict type bound completions to traits, modules and macros
2021-06-23 19:10:03 +02:00
Lukas Wirth
d4877ae992
Add predicate tests for ide_completions
2021-06-23 18:58:19 +02:00
Lukas Wirth
dc4876d33d
Lift out base item fixture for ide_completion tests
2021-06-23 18:37:47 +02:00
Jamie Cunliffe
ae823aa23f
Move features into potential_cfg_options
2021-06-21 17:54:05 +01:00
Jamie Cunliffe
284483b347
Improve completion of cfg attributes
...
The completion of cfg will look at the enabled cfg keys when
performing completion.
It will also look crate features when completing a feature cfg
option. A fixed list of known values for some cfg options are
provided.
For unknown keys it will look at the enabled values for that cfg key,
which means that completion will only show enabled options for those.
2021-06-21 17:47:00 +01:00
bors[bot]
c69f762f26
Merge #9356
...
9356: internal: Move out and regroup more completion tests r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-21 13:15:12 +00:00
Lukas Wirth
0729913525
Various keyword completion fixes
2021-06-21 15:14:28 +02:00
Lukas Wirth
b9d85f55b7
Move out completion type position tests
2021-06-21 15:00:53 +02:00
Lukas Wirth
f835279b3a
Move out completion pattern tests
2021-06-21 13:48:25 +02:00
Aleksey Kladov
9a3eae8755
fix: don't add duplicate &
during completion
2021-06-20 19:37:58 +03:00
bors[bot]
d9666ce509
Merge #9334
...
9334: feat: Allow to disable import insertion on single path glob imports r=Veykril a=Veykril
On by default as I feel like this is something the majority would prefer.
Closes #8490
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-18 21:23:22 +00:00
Lukas Wirth
2ee090faaf
Allow to disable import insertion on single path glob imports
2021-06-18 23:11:56 +02:00
Aleksey Kladov
a9623f3165
minor: use minicore
2021-06-18 23:38:19 +03:00
Aleksey Kladov
cc73abf72c
minor: use minicore
2021-06-18 23:33:01 +03:00
Aleksey Kladov
89a0e58393
internal: use minicore deref more
2021-06-18 22:47:02 +03:00
Aleksey Kladov
2e4df27132
minor: use minicore
2021-06-18 22:25:35 +03:00
rdambrosio
b3e5c648e0
Lift ast -> hir out of the for_each
2021-06-18 12:42:13 -04:00
rdambrosio
23e3354ae0
Remove extra whitespace
2021-06-18 02:14:00 -04:00
rdambrosio
8e08b86304
Feat: inline generics in const and func trait completions
2021-06-17 19:54:28 -04:00
bors[bot]
0d863ccea9
Merge #9313
...
9313: fix: Don't complete keywords in attributes inside expressions r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-17 22:30:30 +00:00
Lukas Wirth
c1bf1f88ad
Complete repr
attribute parameters
2021-06-17 21:15:49 +02:00
Aleksey Kladov
08c220ab2c
internal: add default to minicore
2021-06-17 20:49:49 +03:00
bors[bot]
ce926aebc4
Merge #9315
...
9315: Nest all the or-patterns! r=Veykril a=Veykril
`cargo +nightly clippy --fix -Z unstable-options --allow-dirty -- -A clippy::all -D clippy::unnested_or_patterns`
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-17 16:22:32 +00:00
Lukas Wirth
95c8c65139
Nest all the or-patterns!
2021-06-17 17:37:14 +02:00
Lukas Wirth
2ac03ef1d6
Don't complete keywords in attributes inside expressions
2021-06-17 16:02:51 +02:00
Lukas Wirth
2a48b53220
Correct completions in items tests
2021-06-17 15:43:21 +02:00
Lukas Wirth
a9a77671f2
Move item specific completion tests
2021-06-17 15:32:34 +02:00
Lukas Wirth
9df848c580
Less filtering in completion tests
2021-06-17 15:10:25 +02:00
Lukas Wirth
9353f36516
Fix incorrect completions in empty braced use statement
2021-06-17 13:59:31 +02:00
Lukas Wirth
2225db2eb4
Refine self
, super
and crate
completion in use paths
2021-06-17 13:56:55 +02:00
Lukas Wirth
e14f5cfff0
Move out and rewrite UseTree completion tests
2021-06-17 13:13:12 +02:00
Lukas Wirth
aa644b5585
Move test_utils into tests module
2021-06-16 21:51:52 +02:00
Lukas Wirth
11115ebad8
Don't complete paths after attributes
2021-06-16 21:51:21 +02:00
Lukas Wirth
9ea6ee6b27
Don't show incorrect completions after unsafe or visiblity node
2021-06-16 21:51:20 +02:00
Lukas Wirth
1a8f76a224
Don't complete visibility accessors after existing ones
2021-06-16 21:51:20 +02:00
Lukas Wirth
d338a80394
Start refactoring ide_completion tests
2021-06-16 21:51:20 +02:00
bors[bot]
f38770cd26
Merge #9302
...
9302: internal: Add builtin derives to attribute completion fixtures r=Veykril a=Veykril
bors R+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-16 17:28:13 +00:00
Lukas Wirth
a92ed1eef4
Don't complete already used derive attributes
2021-06-16 19:27:06 +02:00
Lukas Wirth
8f936c5571
Add builtin derives to attribute completion fixtures
2021-06-16 19:25:09 +02:00
Lukas Wirth
66b701ed3e
Simplify
2021-06-16 15:51:01 +02:00
bors[bot]
1c034c084d
Merge #9299
...
9299: minor: Filter out non-type completions in the respective completions modules instead r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-16 13:10:44 +00:00
Lukas Wirth
354ad29493
Filter out non-type completions in the respective completions modules instead
2021-06-16 15:08:44 +02:00
Aleksey Kladov
d2c9f3add1
internal: add deref_mut to minicore
2021-06-16 10:30:29 +03:00
Aleksey Kladov
7cbcbccc78
internal: switch some tests to minicore
2021-06-15 23:11:53 +03:00
Aleksey Kladov
ae92057df6
internal: switch some tests to minicore
2021-06-15 23:02:38 +03:00
Aleksey Kladov
4584868a7a
internal: don't #[ignore] tests
...
See the style.md for motivation
2021-06-15 16:37:58 +03:00
Lukas Wirth
5558e11282
Add assoc type in trait bound completion test
2021-06-14 18:17:21 +02:00
bors[bot]
5a8ddb4b2d
Merge #9260
...
9260: tree-wide: make rustdoc links spiky so they are clickable r=matklad a=lf-
Rustdoc was complaining about these while I was running with --document-private-items and I figure they should be fixed.
Co-authored-by: Jade <software@lfcode.ca>
2021-06-14 07:16:48 +00:00
Jade
20b325c7d5
tree-wide: make rustdoc links spiky so they are clickable
2021-06-13 21:58:05 -07:00
Aleksey Kladov
546be18e3a
internal: check that coverage marks are always paired
2021-06-13 13:13:26 +03:00
Maan2003
aabd41cafc
clippy::redundant_field_names
2021-06-13 09:40:22 +05:30
Maan2003
75370312fb
clippy::redundant_closure
2021-06-13 09:29:36 +05:30
Maan2003
c9b4ac5be4
clippy::redudant_borrow
2021-06-13 09:24:16 +05:30
Aleksey Kladov
0463d76a1f
internal: cross-crate cov-marks
2021-06-12 23:40:52 +03:00
Kirill Bulatov
9c0b141dc9
Fix some typos in flyimport docs
2021-06-12 21:51:09 +03:00
Lukas Wirth
ec9ef9c283
Complete associated types in dyn and impl trait
2021-06-11 23:12:30 +02:00
bors[bot]
863e23f00f
Merge #9219
...
9219: minor: Replace some AssocItem::containing_trait calls trait_or_trait_impl r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 17:56:00 +00:00
Lukas Wirth
db4a1fcab4
Replace some AssocItem::containing_trait calls trait_or_trait_impl
2021-06-11 19:55:24 +02:00
Lukas Wirth
4e588dfd88
Don't allow lookup by self for unprefixed self access completions
2021-06-11 18:26:52 +02:00
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 Name
s 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