Lukas Wirth
a5874a38cb
Reduce code duplication in pattern completion
2020-12-20 19:20:55 +01:00
Lukas Wirth
2f6a24950a
Emit snippets for struct pattern completion if enabled
2020-12-20 19:16:28 +01:00
Lukas Wirth
b184bfad7a
Add completions for patterns
2020-12-20 18:19:23 +01:00
Lukas Wirth
15a52f69d9
Show enum variant completions for ref scrutinee
2020-12-20 12:32:53 +01:00
Lukas Wirth
943e4faceb
Show enum variant on Self qualified paths
2020-12-20 12:31:59 +01:00
Aleksey Kladov
f6ed16674c
Align code_model name with ungrammar
2020-12-20 10:05:24 +03:00
Kirill Bulatov
b45ec84739
Fewer allocations
2020-12-19 20:42:16 +02:00
Kirill Bulatov
0415dcd832
Tidy up
2020-12-19 14:13:27 +02:00
Kirill Bulatov
8c292e3cc5
Keep the original completion order in tests
2020-12-19 13:18:40 +02:00
Kirill Bulatov
5fa078f26f
Add a slightly better fuzzy search heuristics
2020-12-19 12:54:17 +02:00
bors[bot]
f4929fa9cc
Merge #6901
...
6901: Temp fixes panic caused by no ast for proc-macro r=maklad a=edwin0cheng
There are some panic when hover/goto definition for proc-macro. It is because in current design, we don't have `ast-node` for proc-macro and then it trigger [this](479d1f7eec/crates/hir/src/has_source.rs (L116)
) line to panic.
This PR is a temp fix for all of these similar to bd4c352831/crates/completion/src/render/macro_.rs (L42)
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-12-18 02:30:51 +00:00
Edwin Cheng
60a3785ac2
Temp fixes panic caused by no ast for proc-macro
2020-12-18 10:26:17 +08:00
Kirill Bulatov
9d2cbf05e3
Show first fuzzy completions fully containing the input
2020-12-17 23:10:18 +02:00
Jonas Schievink
c1cb595382
Move to upstream macro_rules!
model
2020-12-15 15:37:37 +01:00
Jeremy Kolb
26a1675764
Remove some redundant allocations
2020-12-12 12:27:09 -05:00
Aleksey Kladov
e179ed6f53
Use natural trait ordering in derive completion
...
derive(Clone, Copy) reads better than derive(Copy, Clone).
However, we preserve the reverse ordering in the lookup text for
sorting purposes. That way, it's convenient to type just `Ord` to
derive everything.
2020-12-11 15:45:53 +03:00
Aleksey Kladov
78de7f0d4a
Remove debug print
2020-12-10 18:30:49 +03:00
Aleksey Kladov
076945e47c
Minor, more orthogonal code
...
It's better to accept things as arguments rather than store them.
2020-12-10 18:01:02 +03:00
Aleksey Kladov
17f236c2b0
Normalize spelling to American English
2020-12-10 17:51:56 +03:00
Kirill Bulatov
bf24cb3e8d
Tweak the search query params for better lookup speed
2020-12-08 15:05:09 +02:00
Kirill Bulatov
cbd3717f2c
Better config name
2020-12-08 14:27:18 +02:00
Kirill Bulatov
3183ff3a7b
Disable the completion for no corresponding client resolve capabilities
2020-12-08 01:07:20 +02:00
Kirill Bulatov
9656ceb896
Document the feature
2020-12-07 23:41:08 +02:00
Kirill Bulatov
19cfa5802e
Simplify
2020-12-07 23:41:08 +02:00
Kirill Bulatov
077c1c3c1f
Less panic, more tests
2020-12-07 23:41:08 +02:00
Kirill Bulatov
045d7f096f
Fix the profiling label
2020-12-07 23:41:08 +02:00
Kirill Bulatov
deda74edd8
Use stateless completion resolve
2020-12-07 23:41:08 +02:00
Kirill Bulatov
93bc009a59
Remove the state
2020-12-07 23:41:08 +02:00
Kirill Bulatov
74c3bbacc9
Make completion resolve async
2020-12-07 23:41:08 +02:00
Kirill Bulatov
f6d2540df0
Simplify import edit calculation
2020-12-07 23:41:08 +02:00
Kirill Bulatov
68a747efe0
Remove redundant code
2020-12-07 23:41:08 +02:00
Kirill Bulatov
50e06ee95a
Refactor the code
2020-12-07 23:41:08 +02:00
Kirill Bulatov
d9bd1f171d
Add eager resolve capability
2020-12-07 23:41:08 +02:00
Kirill Bulatov
2a7be4afb0
Better support client completion resolve caps
2020-12-07 23:41:08 +02:00
Kirill Bulatov
47464e556c
Properly fill client completion resolve capabilities data
2020-12-07 23:41:08 +02:00
Kirill Bulatov
6d2d279389
Working resolve completion imports prototype
2020-12-07 23:41:08 +02:00
Kirill Bulatov
48acd7d455
Draft the new lsp handler
2020-12-07 23:41:08 +02:00
Lukas Wirth
2ff1ebe8f3
Update attributes completion list
2020-12-06 16:46:24 +01:00
Aleksey Kladov
21d962f0ac
Trigger .let postfix snippet in the middle of the block
2020-12-01 15:38:06 +03:00
Aleksey Kladov
9d94ffad44
Place cursor correctly when completing assoc fns with self
2020-12-01 14:28:50 +03:00
Aleksey Kladov
02955661a0
Fix typo
2020-12-01 13:56:46 +03:00
Aleksey Kladov
6f51f728a1
Type-safer API for dealing with parameter lists with optional self
2020-12-01 13:53:39 +03:00
bors[bot]
f8726d781a
Merge #6601
...
6601: add let and letm postfix to turn expressions into variables r=matklad a=bnjjj
Partially resolve #6426
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-11-29 19:21:25 +00:00
Benjamin Coenen
474ebd60d1
add let and letm postfix to turn expressions into variables
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-11-28 17:38:16 +01:00
Kirill Bulatov
3f612d37c6
Move the helpers into ide_db
2020-11-28 16:30:39 +02:00
Kirill Bulatov
f75f07019b
Group import data in a struct
2020-11-27 18:30:10 +02:00
Kirill Bulatov
f4ae3650d8
Extract the import code into the shared module
2020-11-27 18:28:41 +02:00
Kirill Bulatov
b2e6ca46ca
Profile completions better
2020-11-27 18:00:03 +02:00
bors[bot]
fc0354b280
Merge #6635
...
6635: Complete struct in irrefutable let r=Veykril a=Veykril
Fixes #6210
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-26 20:30:16 +00:00
Lukas Wirth
ee06c07f50
Complete struct in irrefutable let
2020-11-26 21:28:43 +01:00
bors[bot]
db6988d4e7
Merge #6614 #6632
...
6614: Improve autoimports on completion speed r=matklad a=SomeoneToIgnore
Presumably closes https://github.com/rust-analyzer/rust-analyzer/issues/6594
May help https://github.com/rust-analyzer/rust-analyzer/issues/6612
* Ignore modules eaferly
* Do less completion string rendering
6632: Pin cargo_metadata r=matklad a=kjeremy
See: https://github.com/oli-obk/cargo_metadata/pull/142#issuecomment-733653275
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-26 10:43:35 +00:00
Kirill Bulatov
9812150047
Document experimental completions
2020-11-25 00:42:58 +02:00
Kirill Bulatov
4c95c6e25d
Gate autoimports begind experimental completions flag
2020-11-25 00:30:28 +02:00
Kirill Bulatov
4baac238a8
Improve autoimports on completion speed
...
* Ignore modules eaferly
* Do less completion string rendering
2020-11-24 02:28:45 +02:00
Benjamin Coenen
775c69183c
add let and letm postfix to turn expressions into variables
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-11-21 15:06:22 +01:00
Kirill Bulatov
d4128beb3d
Avoid turning completion objects into builders
2020-11-16 23:16:41 +02:00
Kirill Bulatov
4109968934
Remove query aliases
2020-11-16 21:24:54 +02:00
Kirill Bulatov
1de7848b57
Fix the other test
2020-11-16 21:19:06 +02:00
Kirill Bulatov
bbe1fbd178
Qualify autoimport completion suggestions
2020-11-16 21:19:06 +02:00
Kirill Bulatov
38ef1fd4ad
Better filter mod paths
2020-11-16 21:19:06 +02:00
Kirill Bulatov
ee99620754
Move autoimport completion into the unqialified_path module
2020-11-16 21:19:06 +02:00
Kirill Bulatov
3b0fc4d7f2
Omit modules during autocompletion
2020-11-16 21:19:06 +02:00
Kirill Bulatov
46514448b7
Tweak the search limits a bit
2020-11-16 21:19:06 +02:00
Kirill Bulatov
1598740292
Reuse existing element rendering
2020-11-16 21:19:06 +02:00
Kirill Bulatov
4c8edd003a
Use imports_locator
2020-11-16 21:19:06 +02:00
Kirill Bulatov
d1556550f8
Rename the module
2020-11-16 21:19:06 +02:00
Kirill Bulatov
0e050fc3eb
Allow to configure the merge behavior
2020-11-16 21:19:06 +02:00
Kirill Bulatov
1e458efe62
Add braces to functions and macros
2020-11-16 21:19:06 +02:00
Kirill Bulatov
6ab97244b8
Tidy up the tests
2020-11-16 21:19:06 +02:00
Kirill Bulatov
6866a05e6f
Use rewriter api to add both changes
2020-11-16 21:19:06 +02:00
Kirill Bulatov
f62e8616c8
Add imports in auto completion
2020-11-16 21:19:05 +02:00
Lukas Wirth
fb71185692
Don't complete keywords in struct literals
2020-11-16 12:23:18 +01:00
Benjamin Coenen
e73d140b51
add suggestion ..Default::default() for remaining struct fields in a constructor #6492
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-11-13 17:17:16 +01:00
Pavan Kumar Sunkara
ca3498bd84
Add some postfix snippet
2020-11-08 20:10:40 +01:00
Igor Aleksanov
8efe43245b
Remove intra-crate facade from completions
2020-11-03 10:36:01 +03:00
Igor Aleksanov
4d333ebb63
Get rid of do-er antipattern
2020-11-03 10:33:13 +03:00
Igor Aleksanov
caf0fa20a7
Provide only explicit constructor for RenderContext
2020-11-03 10:17:59 +03:00
Igor Aleksanov
2a214e15d3
Add doc-comments to the new files
2020-11-03 10:16:35 +03:00
Igor Aleksanov
af7175f332
Make structures order more logical in render.rs
2020-11-03 10:16:35 +03:00
Igor Aleksanov
97a504805d
Move rendering tests to the render module
2020-11-03 10:16:35 +03:00
Igor Aleksanov
15b16917fc
Add TypeAliasRender
2020-11-03 10:16:35 +03:00
Igor Aleksanov
944ccf6075
Add ConstRender
2020-11-03 10:16:35 +03:00
Igor Aleksanov
fc8a1cd800
Introduce render module
2020-11-03 10:16:35 +03:00
Aleksey Kladov
ba8d6d1e4e
Remove more unreachable pubs
2020-11-02 16:58:33 +01:00
Igor Aleksanov
357bf0cedc
Reduce visibility of some methods
2020-10-26 20:37:19 +03:00
Igor Aleksanov
1759f2fc17
Add a module doc-comment for completions module
2020-10-25 11:40:00 +03:00
Igor Aleksanov
9822acac0d
Remove presentation module
2020-10-25 11:32:41 +03:00
Igor Aleksanov
f731d910cb
Move Completions structure definition into completions module
2020-10-25 11:26:38 +03:00
Igor Aleksanov
19c1067202
Reorganize completions structure
2020-10-25 10:59:15 +03:00
Igor Aleksanov
19cce08662
Re-export base_db from ide_db
2020-10-24 11:39:57 +03:00
Igor Aleksanov
b6ea56ea09
Make call_info a part of ide_db
2020-10-24 11:07:10 +03:00
Igor Aleksanov
8d3d509af7
Remove dependency on 'assists' from 'completion' crate
2020-10-24 10:47:23 +03:00
Aleksey Kladov
f9b81369e2
Complete variants when only enun name is typed
...
This allows the client to filter `Foo::Bar` when *either* `Foo` or
`Bar` is typed.
2020-10-23 23:41:47 +02:00
adamrk
3dbbcfca67
Insert ref for completions
2020-10-22 22:45:14 +02:00
Benjamin Coenen
aa031e91f4
add completions for clippy lint in attributes
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-10-20 21:29:31 +02:00
Aleksey Kladov
8421115354
Try to fix publishing
...
This errro specifically:
Updating crates.io index
error: failed to select a version for the requirement `ra_ap_stdx = "^0.0.0"`
candidate versions found which didn't match: 0.0.20
location searched: /home/runner/work/rust-analyzer/rust-analyzer/crates/stdx
required by package `ra_ap_completion v0.0.20 (/home/runner/work/rust-analyzer/rust-analyzer/crates/completion)`
error: unable to update Cargo.lock
Error: Process completed with exit code 1.
2020-10-19 15:18:28 +02:00
Igor Aleksanov
9e7c952bbd
Extract call_info and completion into separate crates
2020-10-18 13:09:00 +03:00