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
Lukas Wirth
e55a44a831
Use shorthand record syntax when renaming struct initializer field
2020-11-14 17:51:09 +01:00
bors[bot]
e8c803937c
Merge #6544
...
6544: add suggestion ..Default::default() for remaining struct fields in a constructor r=bnjjj a=bnjjj
I'm not sure I should import `assists` crate inside `completions`, maybe we should move out `FamousDefs` from `assists` ? Let me know :)
close #6492
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-11-13 23:30:13 +00:00
Benjamin Coenen
9f15de77f9
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 23:20:26 +01:00
Aleksey Kladov
b1377363df
Remove dead code
2020-11-13 17:53:48 +01:00
Aleksey Kladov
4dfda64b39
Cleanup workspace loading a tiny bit
2020-11-13 17:38:26 +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
Aleksey Kladov
aeda30e301
Move tricky workspace logic to a separate module
2020-11-13 16:44:48 +01:00
Aleksey Kladov
f0f13d8cfa
cleanup
2020-11-13 16:32:57 +01:00
bors[bot]
b0ad492e3d
Merge #6519
...
6519: Add "Open Cargo.toml" action r=matklad a=p3achyjr
## What is it?
This adds an "open cargo.toml" action from the vscode shell, resolves #6462
## Test
Ran ```cargo xtask install --server``` and ```cargo xtask install --client```, then ```Developer: Reload Window```.
![image](https://user-images.githubusercontent.com/8763808/98614382-2a578f00-22ad-11eb-9811-4a72a54ff6fb.png )
When clicked:
![image](https://user-images.githubusercontent.com/8763808/98618176-77d7fa00-22b5-11eb-8788-35256542f3a6.png )
Co-authored-by: Anatol Liu <axlui@anatols-mbp.lan>
2020-11-13 15:25:26 +00:00
Anatol Liu
b1b7727e04
add open Cargo.toml action
2020-11-12 17:48:07 -08:00
bors[bot]
ddccaecb79
Merge #6524
...
6524: Add support for loading rustc private crates r=matklad a=xldenis
This PR presents a solution to the problem of making`rustc_private` crates visible to `rust-analyzer`.
Currently developers add dependencies to those crates behind a `cfg(NOT_A_TARGET)` target to prevent `cargo` from building them.
This solution is unsatisfactory since it requires modifying `Cargo.toml` and causes problems for collaboration or CI.
The proposed solution suggested by @matklad is to allow users to give RA a path where the `rustc` sources could be found and then load that like a normal workspace.
This PR implements this solution by adding a `rustcSource` configuration item and adding the cargo metadata to the crate graph if it is provided.
------
I have no idea how this should be tested, or if this code is generally tested at all. I've locally run the extension with these changes and it correctly loads the relevant crates on a `rustc_private` project of mine.
Co-authored-by: Xavier Denis <xldenis@gmail.com>
2020-11-12 17:55:32 +00:00
Xavier Denis
89ce6b6664
Address review comments
2020-11-12 18:49:22 +01:00
bors[bot]
cf73b6851b
Merge #6514
...
6514: Fix extract_struct_from_enum_variant not updating record references r=Veykril a=Veykril
Related to #6510
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-12 17:48:25 +00:00
Lukas Wirth
ccdcd52975
Add extra test to extract_struct_from_enum_variant
2020-11-12 18:44:37 +01:00
bors[bot]
13cf3b4886
Merge #6513
...
6513: Support qualified function calls in remove_unused_param r=Veykril a=Veykril
Also adds a test to check that it removes unused params across files.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-12 17:12:21 +00:00
Lukas Wirth
b6e2b28353
Support qualified function calls in remove_unused_param
2020-11-12 18:04:42 +01:00
Lukas Wirth
9454a9e536
Use Module::find_use_path_prefixed in extract_struct_from_enum_variant assist
2020-11-12 17:32:45 +01:00
Lukas Wirth
e24cc77cd1
Fix extract_struct_from_enum_variant not updating record references
2020-11-12 17:13:33 +01:00
Kirill Bulatov
07e633ef0a
Remove the fixme
2020-11-12 13:52:24 +02:00
Kirill Bulatov
3481ea96bd
Add a FIXME for non-unified inner attributes
2020-11-12 13:46:02 +02:00
Kirill Bulatov
335edf87bc
Do not insert imports before inner comments
2020-11-12 13:46:02 +02:00
Aleksey Kladov
a27186636d
Fix attachment of inner doc comments
2020-11-12 12:09:12 +01:00
Aleksey Kladov
81ac99f60a
Simplify code
2020-11-12 11:45:18 +01:00
Aleksey Kladov
f73b874157
Update tests
2020-11-12 11:19:26 +01:00
kjeremy
3b9d164043
Update crates
2020-11-11 11:17:48 -05:00
Xavier Denis
16443760a3
Reorder rustc_private loading
2020-11-11 13:04:27 +01:00
Xavier Denis
8716087919
Add support for loading rustc private crates
2020-11-11 12:45:40 +01:00
Aleksey Kladov
731f7bfc02
Replace RacyFlag with OnceCell
2020-11-11 03:11:40 +01:00
Aleksey Kladov
0caa491893
Be more pedantic when checking codeAction/resolve support
2020-11-10 20:38:34 +01:00
Aleksey Kladov
7d2eb000b0
Switch to upstream protocol for resolving code action
...
Note that we have to maintain custom implementation on the client
side: I don't see how to marry bulitin resolve support with groups and
snippets.
2020-11-10 18:48:46 +01:00
bors[bot]
ada5a88f8f
Merge #6512
...
6512: Don't replace parent node when inserting as first child in algo::diff r=SomeoneToIgnore a=Veykril
This makes the diff a bit more detailed.
See https://github.com/rust-analyzer/rust-analyzer/pull/6287#issuecomment-723889267 for context
cc @SomeoneToIgnore
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-09 23:41:43 +00:00
bors[bot]
0a715cfbd2
Merge #6472
...
6472: Add `static` modifier for associated functions r=matklad a=p3achyjr
Adds static semantic token modifier to associated functions, resolves #6194
## Info
- Associated functions are more-or-less equivalent to static methods in other languages. This PR checks, for each function, whether that function has a self_param, and whether it's enclosed in a trait/impl.
## Changes
- Added method ```is_associated``` to code_model::Function. This basically gets the source from the ast, and checks whether the enclosing scope is an impl or trait.
- Added `static` to HighlightModifiers
- Added unit test
## Tests
- Ran ```cargo test```
Co-authored-by: Anatol Liu <axlui@anatols-mbp.lan>
2020-11-09 21:13:51 +00:00
Anatol Liu
6b950d24d4
Add static semantic token modifier for associated functions with no &self
...
refactor logic into code_model.rs
address comments
2020-11-09 13:09:20 -08:00
Lukas Wirth
a61bb4abb5
Don't replace parent node when inserting as first child in algo::diff
2020-11-09 20:10:49 +01:00
Lukas Wirth
949c580d1b
Add multiple file edit tes to remove_unused_param assist
2020-11-09 19:06:11 +01:00
Aleksey Kladov
9634521abd
. is an operator
...
closes #6498
2020-11-09 18:12:28 +01:00
Aleksey Kladov
4a16c228e7
Fix panic when extracting struct
2020-11-09 16:59:57 +01:00
Aleksey Kladov
018f826197
Support multi-file assist tests
2020-11-09 14:44:08 +01:00
Aleksey Kladov
e72cd4600e
Fix debug for SyntaxRewriter
2020-11-09 14:09:49 +01:00
bors[bot]
73b08131df
Merge #6506
...
6506: Cleanup assists r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-09 12:28:57 +00:00
Aleksey Kladov
d31ce3b16c
Use standard style for test code
2020-11-09 13:28:04 +01:00
Aleksey Kladov
3cecf78488
More consistent naming
2020-11-09 13:18:40 +01:00
Aleksey Kladov
29bf6bed9b
More consistent naming
2020-11-09 13:07:18 +01:00
bors[bot]
2d3b0571bb
Merge #6465
...
6465: Support multiple file edits in AssistBuilder r=matklad a=Veykril
Fixes #6459
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-09 11:54:42 +00:00
bors[bot]
2f24714081
Merge #6501
...
6501: Remove text_edit_builder api from AssistBuilder r=matklad a=Veykril
Also fixes a small bug in `expand_glob_import` in regards to the very nice looking `something::{*}` import when only one item was used. Before it would duplicate the path and just append it, causing the following wrong import `something::something::UsedItem`.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-09 11:40:08 +00:00
Lukas Wirth
4c03d98db4
Remove text_edit_builder api from AssistBuilder
2020-11-08 23:22:11 +01:00
Pavan Kumar Sunkara
ca3498bd84
Add some postfix snippet
2020-11-08 20:10:40 +01:00
Anatol Liu
90031a267a
Add static semantic token modifier for associated functions with no &self
...
refactor logic into code_model.rs
address comments
2020-11-08 00:01:02 -08:00
bors[bot]
dac7060382
Merge #6476
...
6476: Add missing AssocItems in add_custom_impl assist r=matklad a=Veykril
```rust
use std::fmt;
#[derive(Debu<|>g)]
struct Foo {
bar: String,
}
```
->
```rust
use std::fmt;
struct Foo {
bar: String,
}
impl fmt::Debug for Foo {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
${0:todo!()}
}
}
```
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-07 18:21:11 +00:00
m-ysk
69ba62e6cd
Minimize convert_integer_literal tests
2020-11-07 18:47:25 +09:00
Aleksey Kladov
5db789df9c
Cleanup API
2020-11-06 22:52:42 +01:00
bors[bot]
7f12a1f225
Merge #6485
...
6485: Remove RAW literals r=matklad a=matklad
bors r+
🤖
closes https://github.com/rust-analyzer/rust-analyzer/issues/6308
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-06 21:39:02 +00:00
bors[bot]
cdddcaee85
Merge #6477
...
6477: Add infer_function_return_type assist r=matklad a=Veykril
This adds an assist to insert a functions return type if it hasn't been specified yet by inferring it from the functions tail expression. This assist only becomes active if the cursor is on the tail expression. See https://github.com/rust-analyzer/rust-analyzer/issues/6303#issuecomment-714657326
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-06 21:32:27 +00:00
Aleksey Kladov
6158304f8b
Simplify
2020-11-06 22:30:58 +01:00
Aleksey Kladov
5ba4f949c2
Kill RAW_ literals
...
Syntactically, they are indistinguishable from non-raw versions, so it
doesn't make sense to separate then *at the syntax* level.
2020-11-06 22:23:14 +01:00
Lukas Wirth
186431e178
Adjust test-texts in infer_function_return_type
2020-11-06 21:51:15 +01:00
Lukas Wirth
4f0d02c276
Enable infer_function_return_type in return-type position
2020-11-06 21:49:03 +01:00
Aleksey Kladov
6725dcf847
Minor, cleanup style
2020-11-06 21:09:37 +01:00
bors[bot]
1faa9559fe
Merge #6480
...
6480: Support closure in change_return_type_to_result assist r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-06 19:41:13 +00:00
Lukas Wirth
e95a65ccaf
Support closure in change_return_type_to_result assist
2020-11-06 20:40:03 +01:00
Aleksey Kladov
eb46033390
More orthogonal API
2020-11-06 19:09:01 +01:00
Aleksey Kladov
735aaa7b39
Move int parsing to IntNumber token
2020-11-06 18:54:01 +01:00
Aleksey Kladov
6bcc33e5b7
Better imports
2020-11-06 18:39:09 +01:00
Aleksey Kladov
3820b26a93
Generate token for ints and floats
2020-11-06 18:19:24 +01:00
Aleksey Kladov
85db47ac76
Ignore RUST_SRC_PATH if it is set to invalid value
...
Folks report a ton of hard-to-diagnose issues, the solution for which
is "unset RUST_SRC_PATH". Let's just ignore RUST_SRC_PATH when it
won't work anyway!
2020-11-06 11:30:57 +01:00
Lukas Wirth
c665884474
Wrap non-block expressions in closures with a block
2020-11-06 03:06:08 +01:00
Lukas Wirth
2e6e5d8f73
Ignore unit expressions in infer_function_return_type assist
2020-11-06 02:17:34 +01:00
Lukas Wirth
0a7c8512ff
Support closures in infer_function_return_type assist
2020-11-06 02:15:13 +01:00
Lukas Wirth
a14df19d82
Add infer_function_return_type assist
2020-11-06 01:47:41 +01:00
Anatol Liu
3aa0e40726
Add static semantic token modifier for associated functions with no &self
...
refactor logic into code_model.rs
address comments
2020-11-05 15:46:04 -08:00
Lukas Wirth
19443c1fa3
Add missing AssocItems in add_custom_impl assist
2020-11-05 23:41:46 +01:00
Anatol Liu
14b38e198c
Add static semantic token modifier for associated functions with no &self
...
refactor logic into code_model.rs
2020-11-04 23:41:02 -08:00
Anatol Liu
771c0d8c08
Add static semantic token modifier for associated functions with no &self
...
refactor logic into code_model.rs
2020-11-04 21:55:44 -08:00
Anatol Liu
3baa526fb0
Add static semantic token modifier for associated functions with no &self
2020-11-04 20:08:46 -08:00