Aleksey Kladov
2bf81922f7
internal: more reasonable grammar for blocks
...
Consider these expples
{ 92 }
async { 92 }
'a: { 92 }
#[a] { 92 }
Previously the tree for them were
BLOCK_EXPR
{ ... }
EFFECT_EXPR
async
BLOCK_EXPR
{ ... }
EFFECT_EXPR
'a:
BLOCK_EXPR
{ ... }
BLOCK_EXPR
#[a]
{ ... }
As you see, it gets progressively worse :) The last two items are
especially odd. The last one even violates the balanced curleys
invariant we have (#10357 ) The new approach is to say that the stuff in
`{}` is stmt_list, and the block is stmt_list + optional modifiers
BLOCK_EXPR
STMT_LIST
{ ... }
BLOCK_EXPR
async
STMT_LIST
{ ... }
BLOCK_EXPR
'a:
STMT_LIST
{ ... }
BLOCK_EXPR
#[a]
STMT_LIST
{ ... }
2021-09-26 19:16:09 +03:00
Lukas Wirth
845904f0bb
fix: do not complete builtin attributes for qualified paths
2021-09-14 00:31:14 +02:00
Aleksey Kladov
076c972e3b
internal: prevent possible bugs when adding magical comments
2021-09-13 13:43:13 +03:00
bors[bot]
0bc8e2acb8
Merge #10154
...
10154: feat: Complete `#![recursion_limit = "N"]` instead of `#![recursion_limit = N]` r=lnicola a=hkmatsumoto
Currently ra emits `#![recursion_limit = 128]`, but this should rather be `#![recursion_limit = "128"]`
Co-authored-by: Hirochika Matsumoto <git@hkmatsumoto.com>
2021-09-06 10:38:41 +00:00
Jonas Schievink
8e736da456
Recover from statement macro expansion errors
2021-09-06 00:16:12 +02:00
Hirochika Matsumoto
1f238b3bb5
Complete #![recursion_limit = "N"]
over #![recursion_limit = N]
2021-09-05 18:05:06 +09:00
Lukas Wirth
40a2faee65
Enable flyimport for ident patterns
2021-09-01 16:13:53 +02:00
Frank Steffahn
3a5a93595f
Fix typos “a”→“an”
2021-08-22 14:31:37 +02:00
Lukas Wirth
833de22d0b
fix: Do not show functional update completion when already qualified
2021-08-21 20:45:15 +02:00
bors[bot]
933a4dc3a6
Merge #9902
...
9902: minor: move functionality to a better place r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-14 17:43:52 +00:00
Aleksey Kladov
3c49a9f079
minor: move functionality to a better place
2021-08-14 20:43:28 +03:00
bors[bot]
1e0d20366f
Merge #9900
...
9900: internal: remove one more usage of old editing API. r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-14 17:17:51 +00:00
Aleksey Kladov
e300f58d2c
internal: remove one more usage of old editing API.
2021-08-14 20:17:16 +03:00
Lukas Wirth
2e733b1a3e
Simplify
2021-08-14 19:09:36 +02:00
Lukas Wirth
bf918046fa
Only complete type annotations for patterns in function params
2021-08-14 18:18:32 +02:00
Lukas Wirth
f6d6fda85b
Refine functional update completion some more
2021-08-10 17:03:38 +02:00
bors[bot]
f6ef043a88
Merge #9845
...
9845: fix: Do not drop `..Default::default()` completion when typing `..` r=Veykril a=Veykril
cc https://github.com/rust-analyzer/rust-analyzer/issues/9839
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-10 13:08:58 +00:00
Lukas Wirth
e729529410
Do not drop ..Default::default()
completion when typing ..
2021-08-10 15:08:35 +02:00
Lukas Wirth
7e6eb67f0d
Substitute generic types in inline_call
2021-08-10 14:39:56 +02:00
bors[bot]
546d718a7e
Merge #9808
...
9808: fix: Look for enum variants and trait assoc functions when looking for lang items r=matklad a=Veykril
Examples for lang enum variants are the `Option` variants.
Assoc trait functions aren't being seen since they aren't declared in the direct module scope.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-08 10:41:45 +00:00
Lukas Wirth
50d46863ef
Look for enum variants and trait assoc functions when looking for lang items
2021-08-07 22:30:13 +02:00
Alexandre Fourcat
9beefef8f9
Add completion for struct literal in which all fields are visible.
...
Fix ide_completion tests.
Move 'complete_record_literal' call to the main completion function.
Fix a rendering bug when snippet not available.
Checks if an expression is expected before adding completion for struct literal.
Move 'completion struct literal with private field' test to 'expressions.rs' test file.
Update 'expect' tests with new check in 'complete record literal'.
2021-08-04 18:52:58 +02:00
bors[bot]
00c8cab20b
Merge #9765
...
9765: internal: Introduce TypeInfo r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-03 15:32:51 +00:00
Lukas Wirth
b96f1adf5c
Give TypeInfo fields and methods more appropriate names
2021-08-03 17:28:51 +02:00
Lukas Wirth
25ff7171c4
Introduce TypeInfo
2021-08-03 16:41:53 +02:00
bors[bot]
4b0c97668c
Merge #9772
...
9772: feat: filter out duplicate macro completions r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-03 14:37:25 +00:00
Aleksey Kladov
2f9273633b
feat: filter out duplicate macro completions
...
closes #9303
2021-08-03 17:36:06 +03:00
bors[bot]
da894358e1
Merge #9764
...
9764: fix: Don't use the module as the candidate node in fuzzy path flyimport r=Veykril a=Veykril
The problem was that the candidate node is whats being used for the scope, so using an inline module will yield the surrounding scope of the module instead of the scope of the module itself.
Also seems to fix the problem in this comment https://github.com/rust-analyzer/rust-analyzer/issues/9760#issuecomment-891125674 , though I could not recreate that in a test for some reason.
Fixes #9760
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-02 18:43:02 +00:00
Lukas Wirth
e138676664
Don't use the module as the candidate node in fuzzy path flyimport
2021-08-02 19:56:32 +02:00
Aleksey Kladov
8b6ea1545f
simplify
2021-08-02 14:27:11 +03:00
Aleksey Kladov
71cd67fe47
failing test
2021-08-02 14:27:11 +03:00
Jonas Schievink
8764cc955f
Make flyimport respect #[doc(hidden)]
2021-07-28 19:22:59 +02:00
Jonas Schievink
0fbf396f0d
Make most completions respect #[doc(hidden)]
2021-07-28 15:59:02 +02:00
Laurențiu Nicola
1da21b797a
Fix typo
2021-07-24 11:20:40 +03:00
Jonas Schievink
c495a7374f
Resolve tuple field visibility FIXME
2021-07-23 20:20:41 +02:00
Jonas Schievink
4267c38db1
Add tests for tuple struct field completion
2021-07-23 20:20:23 +02:00
Jonas Schievink
3efdf6861f
Complete editable private items
2021-07-23 19:57:16 +02:00
bors[bot]
75d7da196f
Merge #9683
...
9683: internal: Move out expression based `unqualified_path` completion tests r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-23 15:07:10 +00:00
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
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
Aleksey Kladov
15f11dce4a
feat: improve parser error recovery for function parameters
2021-07-17 22:41:04 +03: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
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
mahdi-frms
486bffc23e
show imported trait on autocompletion of associated items
2021-07-05 02:13:49 +04:30
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
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
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
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
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
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
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
Lukas Wirth
a92ed1eef4
Don't complete already used derive attributes
2021-06-16 19:27:06 +02:00