Commit graph

8831 commits

Author SHA1 Message Date
Lukas Wirth
1f87a41989 Add attribute highlight modifier to all tokens inside attributes 2020-11-21 12:51:05 +01:00
Lukas Wirth
91a1a83601 Fill code_description for rust_analyzer diagnostics 2020-11-18 08:54:52 +01:00
Lukas Wirth
56a0021e61 update diagnostics test_data with code_description changes 2020-11-18 08:50:27 +01:00
Lukas Wirth
863fdcfa24 Link clippy lint codes in diagnostics 2020-11-18 08:50:27 +01:00
Lukas Wirth
132063ad96 Link rustc error codes in diagnostics 2020-11-18 08:50:27 +01:00
bors[bot]
156f7d6963
Merge #6553
6553: Auto imports in completion r=matklad a=SomeoneToIgnore

![completion](https://user-images.githubusercontent.com/2690773/99155339-ae4fb380-26bf-11eb-805a-655b1706ce70.gif)

Closes https://github.com/rust-analyzer/rust-analyzer/issues/1062 but does not handle the completion order, since it's a separate task for https://github.com/rust-analyzer/rust-analyzer/issues/4922 , https://github.com/rust-analyzer/rust-analyzer/issues/4922 and maybe something else.

2 quirks in the current implementation:

* traits are not auto imported during method completion

If I understand the current situation right, we cannot search for traits by a **part** of a method name, we need a full name with correct case to get a trait for it.

* VSCode (?) autocompletion is not as rigid as in Intellij Rust as you can notice on the animation.

Intellij is able to refresh the completions on every new symbol added, yet VS Code does not query the completions on every symbol for me.
With a few debug prints placed in RA, I've observed the following behaviour: after the first set of completion suggestions is received, next symbol input does not trigger a server request, if the completions contain this symbol.
When more symbols added, the existing completion suggestions are filtered out until none are left and only then, on the next symbol it queries for completions.
It seems like the only alternative to get an updated set of results is to manually retrigger it with Esc and Ctrl + Space.

Despite the eerie latter bullet, the completion seems to work pretty fine and fast nontheless, but if you have any ideas on how to make it more smooth, I'll gladly try it out.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-11-17 17:50:08 +00:00
bors[bot]
f4b4f17662
Merge #6582
6582: Fill the diagnostic code field in publish_diagnostics r=kjeremy a=Veykril

Fixes #6580
Before:
![Code_znn6VgLLH9](https://user-images.githubusercontent.com/3757771/99408084-213f7100-28f0-11eb-8317-3f5c2b93313d.png)
After:
![Code_c4jJsvzOEA](https://user-images.githubusercontent.com/3757771/99408096-23093480-28f0-11eb-9bb2-8ebf2fb3d5a1.png)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-17 15:47:36 +00:00
Lukas Wirth
c868f0255f Fill the diagnostic code field in publish_diagnostics 2020-11-17 16:23:53 +01:00
Aleksey Kladov
e88b5fe916 Simplify 2020-11-17 15:25:58 +01:00
Aleksey Kladov
bd4d375a64 Make code more readable 2020-11-17 15:25:58 +01:00
Aleksey Kladov
a0c4dbc399 Minor 2020-11-17 15:25:58 +01:00
Aleksey Kladov
db218006c9 Remove dead code 2020-11-17 15:25:57 +01:00
Aleksey Kladov
0d19ee1d70 Simplify 2020-11-17 15:25:57 +01:00
Aleksey Kladov
17e8a00b0b Use standard code style for test fixtures 2020-11-17 14:43:23 +01:00
Aleksey Kladov
8c6f933773 **Unwrap Block** supports stand-alone blocks 2020-11-17 14:33:30 +01:00
Aleksey Kladov
10fa9c595a Simplify 2020-11-17 14:33:30 +01:00
Aleksey Kladov
8dd0b7d2b5 Assist target should point at *existing* code 2020-11-17 14:33:30 +01:00
Aleksey Kladov
9a30707281 Add **Ignore Test** assist 2020-11-17 14:22:04 +01:00
Kirill Bulatov
16f0b2fdde Actually enable eager completion 2020-11-17 13:19:56 +02:00
bors[bot]
10e3a9879c
Merge #6571
6571: Cleanup project model r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-17 10:53:12 +00:00
Aleksey Kladov
0dc1742187 Remove needless alloc 2020-11-17 11:52:28 +01:00
Aleksey Kladov
e4927d52e2 Compress code 2020-11-17 11:52:28 +01:00
Aleksey Kladov
a6960fb3b8 simplify 2020-11-17 11:31:40 +01:00
Kirill Bulatov
d4128beb3d Avoid turning completion objects into builders 2020-11-16 23:16:41 +02:00
kjeremy
233fdb12ce Latest LSP 3.16 protocol
Pulls in https://github.com/gluon-lang/lsp-types/pull/186
2020-11-16 15:10:13 -05:00
Kirill Bulatov
4109968934 Remove query aliases 2020-11-16 21:24:54 +02:00
Kirill Bulatov
d776c67226 Properly fill the completion settings 2020-11-16 21:19:06 +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
Aleksey Kladov
682dd4dac0 Prepare to recompute completions on every keystroke
If we set `is_incomplete: true`, VS Code will re-query completions
after every keypress.
2020-11-16 17:27:36 +01:00
bors[bot]
789d9ca1d3
Merge #6563
6563: Don't complete keywords in struct initializers r=matklad a=Veykril

Fixes #6562

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-16 11:49:48 +00:00
Lukas Wirth
fb71185692 Don't complete keywords in struct literals 2020-11-16 12:23:18 +01:00
bors[bot]
e17d604888
Merge #6558
6558: format string highlighting: handle hex + debug type specifier r=matklad a=ruabmbua

Should fix https://github.com/rust-analyzer/rust-analyzer/issues/6427


Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
2020-11-16 11:07:29 +00:00
bors[bot]
382361c252
Merge #6552
6552: Properly handle shorthands in destructure patterns when renaming r=SomeoneToIgnore a=Veykril

Fixes #6548 and #6551.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-15 18:51:23 +00:00
Roland Ruckerbauer
a15dda48c6 format string highlighting: handle hex + debug type specifier 2020-11-15 17:43:14 +01:00
Lukas Wirth
f3e297331c Cleanup edit_text_range_for_record_field_expr_or_pat 2020-11-15 16:11:06 +01:00
Lukas Wirth
cb60708274 Use shorthand field syntax in destructures 2020-11-14 21:08:20 +01:00
Lukas Wirth
924eecf4af Properly handle shorthands in destructure patterns when renaming 2020-11-14 19:11:09 +01:00