Commit graph

7897 commits

Author SHA1 Message Date
Aleksey Kladov
1c359ab634 Replace SepBy with Itertools 2020-08-12 15:04:06 +02:00
bors[bot]
42a1692629
Merge #5720
5720: Fix docs

 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-12 11:59:02 +00:00
Aleksey Kladov
c9a42c7c46 Fix docs 2020-08-12 13:56:58 +02:00
bors[bot]
4b3d99f98f
Merge #5699
5699: Fix clippy warnings r=matklad a=popzxc

Currently clippy spawns a bunch of warnings on the `rust-analyzer` project. Nothing critical, but easy to fix, so I guess it won't harm.

Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
2020-08-12 11:51:53 +00:00
Igor Aleksanov
fcd4b0176f Revert style preference-related fixes 2020-08-12 14:08:55 +03:00
bors[bot]
e471cb2a12
Merge #5718
5718: Deny clippy

 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-12 10:51:02 +00:00
Aleksey Kladov
49af51129b Deny clippy 2020-08-12 12:49:48 +02:00
bors[bot]
d0fd8eb7f6
Merge #5717
5717: Minor

 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-12 10:35:18 +00:00
Jonas Schievink
b27d5233bb
Merge pull request #5716 from jonas-schievink/musl
Fix build on musl and test it in CI
2020-08-12 12:31:17 +02:00
Jonas Schievink
67b2b3d0ce Fix build on musl and test it in CI 2020-08-12 12:23:25 +02:00
Aleksey Kladov
96001921fc Minor 2020-08-12 12:21:03 +02:00
bors[bot]
87429768bd
Merge #5711
5711: Display snippet in the completion label r=matklad a=SomeoneToIgnore

Before, the completion did not show the actual snippet and it was hard to understand what to input to get the right snippet:

<img width="467" alt="image" src="https://user-images.githubusercontent.com/2690773/89941040-21f6a600-dc23-11ea-94b8-61f77f88feaf.png">
<img width="367" alt="image" src="https://user-images.githubusercontent.com/2690773/89941046-23c06980-dc23-11ea-8034-6c4e14357c94.png">

Now it's more clear:

<img width="315" alt="image" src="https://user-images.githubusercontent.com/2690773/89941124-42befb80-dc23-11ea-9fcc-5fd49cc92b74.png">
<img width="210" alt="image" src="https://user-images.githubusercontent.com/2690773/89941132-4488bf00-dc23-11ea-99c2-12ec66e0a044.png">


Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-08-12 10:00:08 +00:00
Aleksey Kladov
8aba6bfef5 Simplify 2020-08-12 10:14:08 +02:00
Kirill Bulatov
7543b06d30 Display snippet in the completion label 2020-08-11 22:33:17 +03:00
bors[bot]
e0de247520
Merge #5708
5708: Use Hygiene in completion r=jonas-schievink a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-08-11 10:30:39 +00:00
bors[bot]
ef20dfc78d
Merge #5707
5707: Address some FIXMEs for ra_assists r=jonas-schievink a=JmPotato

Signed-off-by: JmPotato <ghzpotato@gmail.com>

Co-authored-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 10:22:57 +00:00
JmPotato
6ef019bd46 Revert some FIXMEs
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 17:19:02 +08:00
JmPotato
7fbc9afca4 Typo fix
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 16:50:45 +08:00
Laurențiu Nicola
fc01c7846d Use Hygiene in completion 2020-08-11 10:09:50 +03:00
JmPotato
b69dfddb57 Remove redundant dependencies
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 14:35:15 +08:00
JmPotato
ace75f9590 Typo fix
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 12:09:11 +08:00
JmPotato
dc6e1e0dac Address some FIXMEs
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 10:55:26 +08:00
Veetaha
4f386afb16 Log the command flycheck runs to debug misconfigurations
Without this users have no clue why flycheck fails to run.
This is what is printed to the output channel:
```
[ERROR rust_analyzer::main_loop] cargo check failed: Cargo watcher failed,the command produced no valid metadata (exit code: ExitStatus(ExitStatus(25856)))
```

I stumbled with this figuring out that rust-analyzer adds `--all-features` which is not intended
for some crates in the workspace (e.g. they have mutually-exclusive features.
Having the command rust-analyzer ran should help a lot
2020-08-11 03:12:09 +03:00
Jeremy Kolb
cf6d14cee7 Return InvalidRequest if Shutdown has been requested
From the LSP 3.16 spec: "If a server receives requests after a shutdown request those requests should error with InvalidRequest."
2020-08-10 11:03:08 -04:00
Igor Aleksanov
d180b8bbe8 Revert boxing for large enum variant 2020-08-10 15:50:27 +03:00
Igor Aleksanov
6344a7f362 Fix clippy warnings 2020-08-10 15:05:01 +03:00
JmPotato
958b91c1e8 Better codes
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-10 17:51:45 +08:00
JmPotato
4d9c8821e5 Show const body in short_label
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-10 14:02:40 +08:00
bors[bot]
7a03f05eac
Merge #5692
5692: Add support for extern crate r=jonas-schievink a=Nashenas88

This adds syntax highlighting, hover and goto def functionality for extern crate.

Fixes #5690 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-09 23:16:58 +00:00
Paul Daniel Faria
bf9b4578bb Remove Option<...> from result of Crate::root_module
There doesn't seem to be any need for it, and removing it simplies
several paths of code that depend on it.
2020-08-09 18:52:19 -04:00
bors[bot]
b1cb4ac13d
Merge #5693
5693: Fix no inlay hints / unresolved tokens until manual edit to refresh r=jonas-schievink a=Veetaha

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5349 

Now we return ContentModified during the workspace loading. This signifies the language
client to retry the operation (i.e. the client will
continue polling the server while it returns ContentModified).
I believe that there might be cases of overly big projects where the backoff
logic we have setup in `sendRequestWithRetry` (which we use for inlay hints)
might bail too early (currently the largest retry standby time is 10 seconds).
However, I've tried on one of my project with 500+ dependencies and it is still enough.

Here are the examples before/after the change (the gifs are quite lengthy because they show testing rather large cargo workspace).

<details>
<summary>Before</summary>

Here you can see that the client receives empty array of inlay hints and does nothing more.
Same applies to semantic tokens. The client receives unresolved tokens and does nothing more.
The user needs to do a manual edit to refresh the editor.

![prev-demo](https://user-images.githubusercontent.com/36276403/89717721-e4471280-d9c1-11ea-89ce-7dc3e83d9768.gif)

</details>

<details>
<summary>After</summary>

Here the server returns ContentModified, so the client periodically retries the requests and eventually receives the wellformed response.

![new-demo](https://user-images.githubusercontent.com/36276403/89717725-eb6e2080-d9c1-11ea-84c9-796bb2b22cec.gif)

</details>

Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-08-09 22:39:10 +00:00
Veetaha
dbe7ede2ee Let shutdown request to pass through when status == Loading 2020-08-10 00:49:53 +03:00
bors[bot]
9995e79cce
Merge #5414
5414: Fix test code lens r=jonas-schievink a=avrong

Closes #5217

The implementation is quite similar to #4821. Maybe we should somehow deal with duplicated code.

Also, both of these requests introduce some unclear behavior. I'm not sure how to process this, therefore asking for advice. Examples are below.
<img width="286" alt="image" src="https://user-images.githubusercontent.com/6342851/87713209-83595f80-c7b2-11ea-8c0f-a12e7571e7df.png">

Co-authored-by: Aleksei Trifonov <avrong@avrong.me>
2020-08-09 21:23:20 +00:00
JmPotato
3f2bc813d3 format in to_proto::markup_content
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-09 21:33:14 +08:00
Veetaha
e43811c164 Fix no inlay hints / unresolved tokens until manual edit
No we return ContentModified during the workspace loading. This signifies the language
client to retry the operation (i.e. the client will
continue polling the server while it returns ContentModified).
I believe that there might be cases of overly big projects where the backoff
logic we have setup in `sendRequestWithRetry` (which we use for inlay hints)
might bail too early (currently the largest retry standby time is 10 seconds).
However, I've tried on one of my project with 500+ dependencies and it is still enough.
2020-08-08 21:53:38 +03:00
Paul Daniel Faria
6cde0b1aa0 Add support for extern crate
This adds syntax highlighting, hover and goto def
functionality for extern crate
2020-08-08 14:14:18 -04:00
bors[bot]
8a57afe5a4
Merge #5684
5684: Semantic highlighting for unsafe union field access r=jonas-schievink a=Nashenas88

This change adds support for unions in inference and lowering, then extends on that to add the unsafe semantic modifier on field access only. The `is_possibly_unsafe` function in `syntax_highlighting.rs` could be extended to support fns and static muts so that their definitions are not highlighted as unsafe, but only their usage.

Also, each commit of this PR updates the tests. By reviewing the files by commit, it's easy to see how the changes in the code affected the tests.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-08 16:45:37 +00:00
Paul Daniel Faria
be935b2b56 Apply unsafe semantic highlighting to union field access 2020-08-08 11:29:56 -04:00
Paul Daniel Faria
3bf033e548 Add support for unions in inference and lowering 2020-08-08 11:29:56 -04:00
Paul Daniel Faria
a39d503ef3 Add additional checks for union inference tests 2020-08-08 11:29:50 -04:00
Veetaha
b1ec08e3ff Remove clone 2020-08-08 17:42:50 +03:00
bors[bot]
7a02cc8845
Merge #5679
5679: Account for static mut in missing unsafe diagnostic r=jonas-schievink a=Nashenas88

Accessing or modifying a static mut is an unsafe operation. The "missing unsafe" diagnostic now tracks this.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-07 12:26:23 +00:00
bors[bot]
911ef38b24
Merge #5678
5678: Static mut unsafe semantic highlighting r=jonas-schievink a=Nashenas88

This marks static mutable names as unsafe, since accessing or modifying a static mut is an unsafe operation.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-07 12:20:13 +00:00
bors[bot]
ae1197accd
Merge #5674
5674: Update chalk r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-07 10:32:06 +00:00
Paul Daniel Faria
a6532905a9 Add test for unsafe union field access highlighting 2020-08-06 21:15:31 -04:00
Paul Daniel Faria
f089690a21 Account for static mut in missing unsafe diagnostic 2020-08-06 20:55:29 -04:00
Paul Daniel Faria
8e657f663d Mark static mutable names as unsafe 2020-08-06 20:07:42 -04:00
Paul Daniel Faria
6be528da0d Add test for accessing static mut 2020-08-06 19:58:37 -04:00
Jeremy Kolb
4591bd458d Update chalk 2020-08-05 22:24:23 -04:00
bors[bot]
f1d507270c
Merge #5526
5526: Handle semantic token deltas r=kjeremy a=kjeremy

This basically takes the naive approach where we always compute the tokens but save space sending over the wire which apparently solves some GC problems with vscode.

This is waiting for https://github.com/gluon-lang/lsp-types/pull/174 to be merged. I am also unsure of the best way to stash the tokens into `DocumentData` in a safe manner.

Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-06 01:44:38 +00:00