Commit graph

732 commits

Author SHA1 Message Date
Jonas Schievink
9086c8c663 Add --memory-usage to analysis-bench 2020-07-15 12:14:51 +02:00
bors[bot]
b8b41c5f41
Merge #5354
5354: Add opt-in mimalloc feature r=matklad a=ivan

This adds a `mimalloc` feature to use [mimalloc](https://github.com/microsoft/mimalloc) via [mimalloc_rust](https://github.com/purpleprotocol/mimalloc_rust), and a corresponding `cargo xtask install --server --mimalloc`.

In my tests on Linux, mimalloc seems to run consistently faster than jemalloc and uses only slightly more memory in `analysis-stats` on chalk. Also, builds with mimalloc produce a binary 3MB smaller than builds with jemalloc.

A summary of `env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/` runs on NixOS master on an Intel 4790K in VMware Workstation:

<table>
<tr>
<td></td><td>self-reported time</td><td>elapsed time</td><td>max RSS</td>
</tr>
<tr><td>glibc 2.30 run 1</td><td>225.1 sec</td><td>3:46.91</td><td>1075208</td></tr>
<tr><td>glibc 2.30 run 2</td><td>228.4 sec</td><td>3:50.13</td><td>1074996</td></tr>
<tr><td>jemalloc run 1</td><td>201.8 sec</td><td>3:23.03</td><td>1055960</td></tr>
<tr><td>jemalloc run 2</td><td>199.2 sec</td><td>3:20.41</td><td>1065040</td></tr>
<tr><td>mimalloc run 1</td><td>188.6 sec</td><td>3:09.77</td><td>1105584</td></tr>
<tr><td>mimalloc run 2</td><td>185.0 sec</td><td>3:06.23</td><td>1108132</td></tr>
<tr><td>mimalloc + lto run 1</td><td>160.7 sec</td><td>2:41.80</td><td>1106076</td></tr>
<tr><td>mimalloc + lto run 2</td><td>162.2 sec</td><td>2:43.31</td><td>1104268</td></tr>
</tr>
</table>

I included an `lto = true; codegen-units = 1` run out of curiosity, this PR doesn't enable it.

<details>
<summary>analysis-stats benchmark runs</summary>

## default

```
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.10s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 333.880345ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 10.176299461s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 214.968806927s, 0b allocated 0b resident
Total: 225.145114417s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 225.34
        System time (seconds): 1.49
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:46.91
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1075208
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 6
        Minor (reclaiming a frame) page faults: 294711
        Voluntary context switches: 365
        Involuntary context switches: 3273
        Swaps: 0
        File system inputs: 2904
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.10s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 332.711598ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 9.895020518s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 218.5001697s, 0b allocated 0b resident
Total: 228.39519833s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 228.26
        System time (seconds): 1.75
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:50.13
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1074996
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 9
        Minor (reclaiming a frame) page faults: 294748
        Voluntary context switches: 330
        Involuntary context switches: 1561
        Swaps: 0
        File system inputs: 12608
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
```

## jemalloc
```
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.11s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 356.090374ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 10.176550183s, 439mb allocated 465mb resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 191.607201827s, 993mb allocated 1036mb resident
Total: 201.783937913s, 993mb allocated 1036mb resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 201.07
        System time (seconds): 1.89
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:23.03
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1055960
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 357755
        Voluntary context switches: 240
        Involuntary context switches: 1889
        Swaps: 0
        File system inputs: 256
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.10s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 317.917622ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 9.902142185s, 439mb allocated 463mb resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 189.295317017s, 993mb allocated 1046mb resident
Total: 199.197555943s, 993mb allocated 1046mb resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 198.64
        System time (seconds): 1.67
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:20.41
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1065040
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 369013
        Voluntary context switches: 243
        Involuntary context switches: 2835
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
```

## mimalloc
```
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.12s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 332.116806ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 9.796643695s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 178.82132362s, 0b allocated 0b resident
Total: 188.617975605s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 187.70
        System time (seconds): 1.97
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:09.77
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1105584
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 296481
        Voluntary context switches: 222
        Involuntary context switches: 1868
        Swaps: 0
        File system inputs: 256
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.13s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 320.046776ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 9.287690124s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 175.710939697s, 0b allocated 0b resident
Total: 184.998640033s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 184.38
        System time (seconds): 1.81
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:06.23
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1108132
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 297055
        Voluntary context switches: 374
        Involuntary context switches: 2374
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
```

## mimalloc + lto
```
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.11s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 369.600196ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 7.572726834s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 153.090899101s, 0b allocated 0b resident
Total: 160.663635235s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 160.01
        System time (seconds): 1.70
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 2:41.80
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1106076
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 1
        Minor (reclaiming a frame) page faults: 296610
        Voluntary context switches: 209
        Involuntary context switches: 2798
        Swaps: 0
        File system inputs: 8
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.10s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 334.630658ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 7.71699197s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 154.50351318s, 0b allocated 0b resident
Total: 162.220513775s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 161.52
        System time (seconds): 1.74
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 2:43.31
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1104268
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 296183
        Voluntary context switches: 200
        Involuntary context switches: 1666
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
```
</details>

Co-authored-by: Ivan Kozik <ivan@ludios.org>
2020-07-15 09:43:08 +00:00
Ivan Kozik
6710856c10 Add opt-in mimalloc feature 2020-07-14 20:57:51 +00:00
kjeremy
2257a48cd3 Use more explicity type for save registration 2020-07-14 11:03:44 -04:00
Yuki Okushi
6f423466d1
Add a license field to all the crates 2020-07-14 10:57:26 +09:00
kjeremy
aa598ecb75 Filter assists 2020-07-13 17:41:47 -04:00
Jeremy Kolb
6a18dbe116 Update lsp-types 2020-07-12 12:28:00 -04:00
bors[bot]
49fbd1b625
Merge #5325
5325: Update lsp-types to account for new CodeActionKind structure r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-07-11 22:36:53 +00:00
Jeremy Kolb
8c81465d5b Update tests 2020-07-11 18:23:08 -04:00
Jeremy Kolb
007812dcae Update lsp-types to account for new CodeActionKind structure 2020-07-11 17:29:45 -04:00
Aleksey Kladov
b34cdf7bf4 Implementations lens for unions
closes #4728
2020-07-11 22:53:31 +02:00
Aleksey Kladov
e1d6b7f7c4 Use dedicated semantic highlight tag for parameters
closes #5106
2020-07-11 14:51:41 +02:00
Aleksey Kladov
0f0c5081c0 Make sure there are no commands in code actions 2020-07-11 11:53:24 +02:00
Aleksey Kladov
e6ea395fb0 Don't show error when speculatively reloading workspace 2020-07-11 01:39:06 +02:00
Aleksey Kladov
a425d7d871 Simplify 2020-07-10 23:57:10 +02:00
Aleksey Kladov
dac9a4cebd Don't spawn notify unnecessary 2020-07-10 23:45:07 +02:00
Aleksey Kladov
a1ef6cc553 Optimize VFS processing 2020-07-10 22:30:24 +02:00
Aleksey Kladov
be679a02ab Add profiling calls 2020-07-10 22:30:24 +02:00
Aleksey Kladov
86bc4d20b3 Also reload when adding new examples, tests, etc 2020-07-10 22:30:24 +02:00
Aleksey Kladov
d0a8f6a3eb Automatically reload project info on Cargo.toml changes 2020-07-10 15:35:15 +02:00
Aleksey Kladov
17edf50e2c Avoid accidently stumping over config values 2020-07-10 10:07:08 +02:00
Aleksey Kladov
65d9966a4f Always put config first 2020-07-09 16:12:53 +02:00
Aleksey Kladov
e075e6eef2 Move diagnostics tests to expect 2020-07-09 16:04:29 +02:00
Aleksey Kladov
d70f4f5da5 Add fixmes 2020-07-09 15:41:13 +02:00
Aleksey Kladov
9d0196a491 Simplify 2020-07-09 15:35:52 +02:00
Aleksey Kladov
b398519011 Cleanup diagnostic conversion code 2020-07-09 15:34:37 +02:00
Aleksey Kladov
e8bb153b19 Add Markup type 2020-07-08 22:37:35 +02:00
Aleksey Kladov
7ae696ba76 Remove unwanted dependency 2020-07-08 18:26:31 +02:00
kjeremy
4b7f473223 Clippy perf warnings 2020-07-08 09:45:29 -04:00
bors[bot]
73e972a173
Merge #5244
5244: Add a command to compute memory usage statistics r=matklad a=jonas-schievink

This allows inspecting memory usage on a live rust-analyzer instance after it has been used interactively.

This will only work with `--features jemalloc`, so maybe it should print something more useful when that's not available? Right now it will just print 0 Bytes for every query.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-07 11:00:04 +00:00
Aleksey Kladov
5b8a5bfb15 Modernize unqualified reference completion tests 2020-07-07 12:52:09 +02:00
Jonas Schievink
f44c4b61e1 Add a command to compute memory usage statistics 2020-07-07 12:10:14 +02:00
Aleksey Kladov
569504938e Fix typo 2020-07-05 11:19:16 +02:00
Aleksey Kladov
3902e5574c Add Item change to the set of benches 2020-07-04 17:04:33 +02:00
Aleksey Kladov
000d1db351 Fix bench to work with relative paths 2020-07-04 17:03:02 +02:00
Aleksey Kladov
d09f692300 Add AssistKind::Generate 2020-07-03 19:32:18 +02:00
bors[bot]
0f68fed4a0
Merge #5209
5209: Fixes to memory usage stats r=matklad a=jonas-schievink

This brings the unaccounted memory down from 287mb to 250mb, and displays memory used by VFS and "other" allocations.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-03 15:58:46 +00:00
Aleksey Kladov
b8ef8539a6 Fix workspace reloading 2020-07-03 17:19:00 +02:00
Jonas Schievink
f01e7e3601 Track VFS and remaining/unaccounted memory 2020-07-03 17:16:01 +02:00
kjeremy
4c9347ecc3 Don't categorize things we don't care about 2020-07-02 18:01:22 -04:00
kjeremy
36cc81ac71 Move AssistKind into AssistId 2020-07-02 17:48:35 -04:00
Jeremy Kolb
b98c16a034 Categorize assists 2020-07-02 17:13:02 -04:00
bors[bot]
4cb8bf03c5
Merge #5192
5192: Implement rust-analyzer feature configuration to tests. r=matklad a=daxpedda

Fixes #3198.

I'm unsure if it is desired this way, maybe we want to make a seperate configuration?

Co-authored-by: daxpedda <daxpedda@gmail.com>
2020-07-02 15:48:54 +00:00
Aleksey Kladov
6c7578bd7a Move cargo metadata off the main loop 2020-07-02 17:39:51 +02:00
daxpedda
eb75a644a1
Implement rust-analyzer feature configuration to tests. 2020-07-02 16:13:24 +02:00
bors[bot]
83f3cdca4f
Merge #5191
5191: Minor r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-02 14:10:13 +00:00
Aleksey Kladov
6a694ad047 Minor 2020-07-02 16:06:00 +02:00
bors[bot]
1a3a7f4237
Merge #5188
5188: Implement StatusBar r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-02 14:02:52 +00:00
Aleksey Kladov
4f26a3734e Indicate when project needs a reload 2020-07-02 15:34:12 +02:00
Aleksey Kladov
3ef7676076 Implement StatusBar 2020-07-02 15:32:14 +02:00
Aleksey Kladov
8295dc42a0 Fold multiline calls 2020-07-01 18:27:58 +02:00
Aleksey Kladov
a03cfa4926 Automatically reload project on config change 2020-07-01 16:42:14 +02:00
Aleksey Kladov
298adb27b9 Better account for project reload 2020-07-01 16:01:03 +02:00
Aleksey Kladov
c9f878962a Add reload workspace command 2020-07-01 14:57:59 +02:00
Jeremy Kolb
20d864807d Use the selection range when resolving call hierarchy items
Add a test in call_hierarchy that already passed

Fixes #5103
2020-07-01 07:56:15 -04:00
Aleksey Kladov
44b8737ced Dont show empty progress for empty workspaces 2020-07-01 13:05:34 +02:00
bors[bot]
a9db3d53a0
Merge #5159
5159: Don't fail expect tests in rewrite mode r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-01 09:35:31 +00:00
Aleksey Kladov
adf624b433 Add file support to expect 2020-07-01 11:19:40 +02:00
David Lattimore
95f8310514 Structured search debugging 2020-07-01 16:50:45 +10:00
Jonas Schievink
4602c2eeaa analysis-stats: allow parallel type inference 2020-06-30 17:00:17 +02:00
Aleksey Kladov
af7e300041 Remove confusing API 2020-06-30 13:29:53 +02:00
bors[bot]
e87cba85ef
Merge #5132
5132: Fix some typos r=matklad a=davidlattimore



Co-authored-by: David Lattimore <dml@google.com>
2020-06-30 08:45:16 +00:00
bors[bot]
d13ded6cbc
Merge #5101
5101: Add expect -- a light-weight alternative to insta r=matklad a=matklad

This PR implements a small snapshot-testing library. Snapshot updating is done by setting an env var, or by using editor feature (which runs  a test with env-var set). 

Here's workflow for updating a failing test:

![expect](https://user-images.githubusercontent.com/1711539/85926956-28afa080-b8a3-11ea-9260-c6d0d8914d0b.gif)

Here's workflow for adding a new test:

![expect-fresh](https://user-images.githubusercontent.com/1711539/85926961-306f4500-b8a3-11ea-9369-f2373e327a3f.gif)

Note that colorized diffs are not implemented in this PR, but should be easy to add (we already use them in test_utils). 

Main differences from insta (which is essential for rust-analyzer development, thanks @mitsuhiko!):
* self-updating tests, no need for a separate tool
* fewer features (only inline snapshots, no redactions)
* fewer deps (no yaml, no persistence)
* tighter integration with editor
* first-class snapshot object, which can be used to write test functions (as opposed to testing macros)
* trivial to tweak for rust-analyzer needs, by virtue of being a workspace member. 

I think eventually we should converge to a single snapshot testing library, but I am not sure that `expect` is exactly right, so I suggest rolling with both insta and expect for some time (if folks agree that expect might be better in the first place!). 

# Editor Integration Implementation 

The thing I am most excited about is the ability to update a specific snapshot from the editor. I want this to be available to other snapshot-testing libraries (cc @mitsuhiko, @aaronabramov), so I want to document how this works. 

The ideal UI here would be a code action (💡). Unfortunately, it seems like it is impossible to implement without some kind of persistence (if you save test failures into some kind of a database, like insta does, than you can read the database from the editor plugin). Note that it is possible to highlight error by outputing error message in rustc's format. Unfortunately, one can't use the same trick to implement a quick fix. 

For this reason, expect makes use of another rust-analyzer feature -- ability to run a single test at the cursor position. This does need some expect-specific code in rust-analyzer unfortunately. Specifically, if rust-analyzer notices that the cursor is on `expect!` macro, it adds a special flag to runnable's JSON. However, given #5017 it is possible to approximate this well-enough without rust-analyzer integration. Specifically, an extension can register a special runner which checks (using regexes) if rust-anlyzer runnable covers text with specific macro invocation and do special magic in that case. 

closes #3835 


Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-30 08:34:08 +00:00
Zac Pullar-Strecker
10c50b140a Format & replace todos with 'fixme' 2020-06-30 20:10:24 +12:00
Zac Pullar-Strecker
73d5a31450 Update missed heavy test 2020-06-30 20:10:23 +12:00
Zac Pullar-Strecker
6bba4158cb Switch to pulldown-cmark, tidy imports 2020-06-30 20:10:23 +12:00
Zac Pullar-Strecker
1d6f291335 Move resolver into impls, work on tests 2020-06-30 20:07:08 +12:00
Zac Pullar-Strecker
108b953254 Remove local documentation link rewriting 2020-06-30 20:05:21 +12:00
Zac Pullar-Strecker
2023af53f0 Hover doc link rewriting 2020-06-30 20:02:46 +12:00
David Lattimore
ef49bbeec4 Fix some typos 2020-06-30 10:43:37 +10:00
bors[bot]
2bd7171399
Merge #5120
5120: Add a simple SSR subcommand to the rust-analyzer command line binary r=davidlattimore a=davidlattimore

Is adding the dependency on ra_ide_db OK? It's needed for the call to `db.local_roots()`

Co-authored-by: David Lattimore <dml@google.com>
2020-06-29 23:33:34 +00:00
David Lattimore
867f29559f Moved new deps to CLI-only section 2020-06-30 09:31:45 +10:00
bors[bot]
86f1556f7c
Merge #5122
5122: Fix "Run | Debug" lens for examples r=matklad a=vsrs

Fixes #4974

Co-authored-by: vsrs <vit@conrlab.com>
2020-06-29 15:55:42 +00:00
Laurențiu Nicola
95d67ec401 Use more of FxHash* 2020-06-29 18:07:52 +03:00
vsrs
05e6cbf310 Fix "Run | Debug" lens for examples 2020-06-29 14:05:52 +03:00
David Lattimore
93a91ae9de Add a simple SSR subcommand to the rust-analyzer command line binary 2020-06-29 13:34:45 +10:00
bors[bot]
ca31b1d63a
Merge #5105
5105: Simlify with matches!() r=matklad a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-28 22:37:25 +00:00
Aleksey Kladov
5cdd8d442e Cleanup cargo process handling in flycheck 2020-06-28 23:42:44 +02:00
Veetaha
e75e2ae5b6 Simlify with matches!() 2020-06-28 04:03:59 +03:00
Aleksey Kladov
a4f934efa8
Update crates/rust-analyzer/src/handlers.rs
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-28 01:23:32 +02:00
Veetaha
39a58ed19a Simplify 2020-06-28 01:30:45 +03:00
Aleksey Kladov
03c5a6690d Add light-weight snapshot testing library with editor integration 2020-06-27 19:22:31 +02:00
Laurențiu Nicola
b4420626fb Add support for include_str 2020-06-27 19:34:48 +03:00
Laurențiu Nicola
d036006c95 Bump deps 2020-06-27 13:56:54 +03:00
Aleksey Kladov
9617bb4f07 Try to find rustfmt in more places 2020-06-27 01:28:06 +02:00
Aleksey Kladov
91453e796b Set corret request method 2020-06-26 17:55:20 +02:00
Aleksey Kladov
5a18734338 Fix config switching 2020-06-26 17:28:04 +02:00
bors[bot]
a0a475546b
Merge #5078
5078: Minor r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-26 15:18:04 +00:00
Aleksey Kladov
de7b248227 Minor 2020-06-26 17:17:38 +02:00
bors[bot]
d86a2426a2
Merge #5077
5077: Type safer requests r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-26 15:08:58 +00:00
Aleksey Kladov
9d15e8fc4f Type safer requests 2020-06-26 17:07:14 +02:00
bors[bot]
fa70882418
Merge #5075
5075: Be more precise about flycheck status r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-26 15:02:00 +00:00
bors[bot]
4f60b4f2a3
Merge #5076
5076: Make VFS join methods fallible r=matklad a=jonas-schievink



Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-06-26 14:37:15 +00:00
Aleksey Kladov
1893289e5c Move progress reporting to utils 2020-06-26 16:33:57 +02:00
Jonas Schievink
72fe70f2f8 Make VFS join methods fallible 2020-06-26 16:30:50 +02:00
Aleksey Kladov
bd903bf132 Be more precise about flycheck status 2020-06-26 16:20:46 +02:00
Aleksey Kladov
12831b74af Cleanup 2020-06-26 12:06:08 +02:00
Aleksey Kladov
b039f0d1ba Simplify 2020-06-26 11:44:46 +02:00
Aleksey Kladov
751b8792a2 Simplify 2020-06-26 11:43:07 +02:00
Aleksey Kladov
34118779ec Workaround use Trait as _ bug in rust-analyzer 2020-06-26 11:39:27 +02:00
Aleksey Kladov
2fd25e2d98 reduce visibility 2020-06-26 11:29:27 +02:00
Aleksey Kladov
1272e6cb88 minor 2020-06-26 11:21:21 +02:00
Aleksey Kladov
5f6f994256 Simplify 2020-06-26 00:54:41 +02:00
Aleksey Kladov
e70f7dc10c Minor 2020-06-26 00:27:57 +02:00
Aleksey Kladov
72fb712dff Add new module for project loading stuff 2020-06-26 00:27:57 +02:00
Aleksey Kladov
3d0f782138 Prep dynamic workspace loading 2020-06-26 00:27:57 +02:00
Aleksey Kladov
73d73077fe Separate creation and initialization of global state 2020-06-26 00:27:57 +02:00
Aleksey Kladov
df769e5bb4 Simplify diagnostics handling 2020-06-25 22:45:35 +02:00
Aleksey Kladov
86a4d4cb9c Simplify 2020-06-25 19:23:52 +02:00
Aleksey Kladov
dba11cb060 -mMake it harder to accidently early-exit the loop 2020-06-25 19:01:16 +02:00
Aleksey Kladov
f5ea35a271 Add NotificationDispatcher 2020-06-25 18:28:58 +02:00
Aleksey Kladov
22098127c4 Move request dispatcher to a separate file 2020-06-25 17:22:18 +02:00
Aleksey Kladov
379a096de9 Refactor main_loop 2020-06-25 17:14:11 +02:00
Aleksey Kladov
dd20c2ec5b Move TaskPool into GlobalState 2020-06-25 15:35:42 +02:00
Aleksey Kladov
9cdeb1291e Better event naming 2020-06-25 14:13:17 +02:00
Aleksey Kladov
1ccf33d88f Minor, move code 2020-06-25 09:51:30 +02:00
Aleksey Kladov
5d401092f0 Minor rename 2020-06-25 09:19:01 +02:00
Aleksey Kladov
0ec5d4f55c Rename ra_flycheck -> flycheck 2020-06-25 09:13:46 +02:00
Aleksey Kladov
5a184fe855 Unify style 2020-06-25 09:00:33 +02:00
Aleksey Kladov
dab8808e82 Abstract over channel 2020-06-25 08:39:33 +02:00
Aleksey Kladov
69e6924dd5 Use Handle/Actor terminology for flycheck 2020-06-25 08:24:27 +02:00
Aleksey Kladov
874a5f80c7 Scale progress down
There are two reasons why we don't want a generic ra_progress crate
just yet:

*First*, it introduces a common interface between separate components,
and that is usually undesirable (b/c components start to fit the
interface, rather than doing what makes most sense for each particular
component).

*Second*, it introduces a separate async channel for progress, which
makes it harder to correlate progress reports with the work done. Ie,
when we see 100% progress, it's not blindly obvious that the work has
actually finished, we might have some pending messages still.
2020-06-25 08:01:03 +02:00
Aleksey Kladov
76a530242a Merge branch 'Veetaha-feat/sync-branch' 2020-06-25 07:56:47 +02:00
Aleksey Kladov
10ee6eb733 Tweak visibility 2020-06-25 01:02:08 +02:00
Aleksey Kladov
012a7e57b9 Reduce visibility 2020-06-25 01:02:08 +02:00
Aleksey Kladov
19b063e055 Merge LoopState into GlobalState 2020-06-25 01:02:04 +02:00
Aleksey Kladov
693489e5ee Flatten module hierarchy 2020-06-24 18:57:30 +02:00
Aleksey Kladov
d6c204c750 Cleanup visibility 2020-06-24 18:54:05 +02:00
Aleksey Kladov
6937bcb67d Less error-prone naming 2020-06-24 16:59:15 +02:00
Aleksey Kladov
ddc5a3e567 Fix infinite cargo check bug 2020-06-24 16:59:15 +02:00
Aleksey Kladov
e6c61d5072 Cleanup project.json deserialization 2020-06-24 16:16:52 +02:00
Aleksey Kladov
a07cad16ab Rename json_project -> project_json 2020-06-24 16:03:24 +02:00
bors[bot]
97c4d06258
Merge #5015 #5027 #5028
5015: Account for updated module ids when determining whether a resolution is changed r=matklad a=Nashenas88

Fixes #4943

5027: Make Debug less verbose for VfsPath and use Display in analysis-stats r=matklad a=lnicola



5028: Remove namedExports config r=matklad a=lnicola

Fixes a warning:

```
(!) Plugin commonjs: The namedExports option from "@rollup/plugin-commonjs" is deprecated. Named exports are now handled automatically.
```

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-24 13:02:37 +00:00
Aleksey Kladov
154cb8243b Be more explicit about absolute paths at various places 2020-06-24 14:39:34 +02:00
Laurențiu Nicola
c15c22139f Make Debug less verbose for VfsPath and use Display in analysis-stats 2020-06-24 14:07:03 +03:00
Aleksey Kladov
a0b76161ab Disable file watching when running slow tests
This should rid us of the intermittent test failure

https://github.com/rust-analyzer/rust-analyzer/pull/5017#issuecomment-648717983
2020-06-24 12:27:13 +02:00
bors[bot]
c544f9a137
Merge #4940
4940: Add support for marking doctest items as distinct from normal code r=ltentrup a=Nashenas88

This adds `HighlightTag::Generic | HighlightModifier::Injected` as the default highlight for all elements within a doctest. Please feel free to suggest that a new tag be created or a different one used.

![Screenshot from 2020-06-23 09-18-13](https://user-images.githubusercontent.com/1673130/85408493-9752ce00-b532-11ea-94fe-197353ccc778.png)

Fixes #4929 
Fixes #4939

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
Co-authored-by: Paul Daniel Faria <nashenas88@users.noreply.github.com>
2020-06-24 05:22:23 +00:00
Aleksey Kladov
7ce122b1df Remove useless test code 2020-06-23 23:45:40 +02:00
Aleksey Kladov
aa69757a01 More principled indentation trimming in fixtures 2020-06-23 23:33:41 +02:00
Aleksey Kladov
ff687453a8 Slightly better name 2020-06-23 21:29:50 +02:00
Aleksey Kladov
a34f9b7fb3 Docs for Fixture 2020-06-23 18:58:45 +02:00
Aleksey Kladov
21f751a0e5 Simplify 2020-06-23 18:37:26 +02:00
Aleksey Kladov
30748161f0 Simplify 2020-06-23 18:37:26 +02:00
Paul Daniel Faria
2a56323537 Update injection mechanism and stop injecting through highlight element, switch to more general new highlight tag, generic 2020-06-23 12:13:50 -04:00
Paul Daniel Faria
d8230acd84 Add punctuation highlighting for highlighting punctuation in doctests, fix highlighting in doctests 2020-06-23 12:11:33 -04:00
Paul Daniel Faria
351bba9bee Add support for marking doctest items as distinct from normal code, add default tag to all doctest elements 2020-06-23 12:08:04 -04:00
Aleksey Kladov
dad1333b48 New VFS 2020-06-23 17:51:06 +02:00
Aleksey Kladov
676e82bb83 Remove relative-path dependency 2020-06-23 17:04:10 +02:00
Aleksey Kladov
6a6098d4c3 Remove RelativePathBuf from fixture
The paths in fixture are not really relative (the default one is
`/main.rs`), so it doesn't make sense to use `RelativePathBuf` here.
2020-06-23 00:14:44 +02:00
Aleksey Kladov
f3cf85ab48 Move ReqQueue to lsp-server 2020-06-20 23:24:16 +02:00
Aleksey Kladov
93605c49ba Centralize handing of in-flight requests 2020-06-20 13:06:11 +02:00
bors[bot]
ec6df5d3e8
Merge #4937
4937: Allow overriding rust-analyzer display version r=matklad a=oxalica

The build script invokes `git` for version information which is displayed when rust-analyzer is called with `--version`. But in build environment without `git` or when the source code is not a git repo, there's no way to manually specify the version information.

This patch respects environment variable ~`REV`~ `RUST_ANALYZER_REV` in compile time for overriding.

Related: https://github.com/NixOS/nixpkgs/pull/90976

Co-authored-by: oxalica <oxalicc@pm.me>
2020-06-19 13:43:42 +00:00
bors[bot]
4575c38810
Merge #4839
4839: `Go to Type Definition` hover action. r=matklad a=vsrs

![hover_actions_goto](https://user-images.githubusercontent.com/62505555/83335671-0122e380-a2b7-11ea-9922-fbdcfb11a7f3.gif)

This implementation supports things like `dyn Trait<SomeType>`, `-> impl Trait`, etc.

Co-authored-by: vsrs <vit@conrlab.com>
2020-06-19 13:34:24 +00:00
oxalica
f9ce7cd961
Fix fmt 2020-06-19 02:25:07 +08:00
oxalica
bed0b794e5
Allow overriding rust-analyzer display revision 2020-06-18 22:33:23 +08:00
bors[bot]
f7f627d342
Merge #4903
4903: Add highlighting support for doc comments r=matklad a=Nashenas88

The language server protocol includes a semantic modifier for documentation. This change exports that modifier for doc comments so users can choose to highlight them differently compared to regular comments.

Example:
<img width="375" alt="Screen Shot 2020-06-16 at 10 34 14 AM" src="https://user-images.githubusercontent.com/1673130/84788271-f6599580-afbc-11ea-96e5-7a0215da620b.png">

CC @woody77 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-06-18 13:23:14 +00:00
Veetaha
6e81c9a921 Flatten Task enum ¯\_(ツ)_/¯ 2020-06-18 15:02:36 +03:00
veetaha
76c1160ffa Migrate flycheck to fully-lsp-compatible progress reports (introduce ra_progress crate) 2020-06-18 14:50:56 +03:00
veetaha
2f8126fcac Migrate flycheck to fully-lsp-compatible progress reports (introduce ra_progress crate) 2020-06-18 14:50:17 +03:00
Aleksey Kladov
61a3f6d463 Simplify 2020-06-18 12:39:41 +02:00
vsrs
c50157f330 Add Go to Type Definition hover action. 2020-06-18 10:15:43 +03:00
vsrs
102b7f0f56 Fix empty hover action group for a runnable. 2020-06-18 10:15:42 +03:00
bors[bot]
99e3acd1fe
Merge #4934
4934: Remove special casing for library symbols r=matklad a=matklad

We might as well handle them internally, via queries.

I am not sure, but it looks like the current LibraryData setup might
even predate salsa? It's not really needed and creates a bunch of
complexity.



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-18 06:31:24 +00:00
Aleksey Kladov
d1d0b5a88c Remove special casing for library symbols
We might as well handle them internally, via queries.

I am not sure, but it looks like the current LibraryData setup might
even predate salsa? It's not really needed and creates a bunch of
complexity.
2020-06-18 08:29:34 +02:00
Veetaha
9bb028189a Simplify 2020-06-18 02:00:48 +03:00
bors[bot]
1ce8c2b5a0
Merge #4927
4927: Better encapsulate reverse-mapping of files to cargo targets r=matklad a=matklad

We need to find a better way to do it...

CrateGraph by itself is fine, CargoWorkspace as well, but the mapping
between the two seems arbitrary...



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-17 15:53:07 +00:00
Aleksey Kladov
dc90e0b5a5 Better encapsulate reverse-mapping of files to cargo targets
We need to find a better way to do it...

CrateGraph by itself is fine, CargoWorkspace as well, but the mapping
between the two seems arbitrary...
2020-06-17 17:51:46 +02:00
Leander Tentrup
2145e2d878 Syntax highlighting for escape sequences in strings 2020-06-17 15:27:13 +02:00
Paul Daniel Faria
aae26bc5b8 Add highlighting support for doc comments 2020-06-17 08:29:13 -04:00
bors[bot]
931f317399
Merge #4913 #4915 #4916
4913: Remove debugging code for incremental sync r=matklad a=lnicola



4915: Inspect markdown code fences to determine whether to apply syntax highlighting r=matklad a=ltentrup

Fixes #4904 

4916: Warnings as hint or info r=matklad a=GabbeV

Fixes #4229 

This PR is my second attempt at providing a solution to the above issue. My last PR(#4721) had to be rolled back(#4862) due to it overriding behavior many users expected. This PR solves a broader problem while trying to minimize surprises for the users. 

### Problem description
The underlying problem this PR tries to solve is the mismatch between [Rustc lint levels](https://doc.rust-lang.org/rustc/lints/levels.html) and [LSP diagnostic severity](https://microsoft.github.io/language-server-protocol/specification#diagnostic). Rustc currently doesn't have a lint level less severe than warning forcing the user to disable warnings if they think they get to noisy. LSP however provides two severitys below warning, information and hint. This allows editors like VSCode to provide more fine grained control over how prominently to show different diagnostics.

Info severity shows a blue squiggly underline in code and can be filtered separately from errors and warnings in the problems panel.
![image](https://user-images.githubusercontent.com/13839236/84830640-0bb8d900-b02a-11ea-9e2f-0561b0e8f1ef.png)
![image](https://user-images.githubusercontent.com/13839236/84826931-ffca1880-b023-11ea-8080-5e5b91a6ac0d.png)

Hint severity doesn't show up in the problems panel at all and only show three dots under the affected code or just faded text if the diagnostic also has the unnecessary tag.
![image](https://user-images.githubusercontent.com/13839236/84827165-55062a00-b024-11ea-8bd6-bdbf1217c4c5.png)

### Solution
The solution provided by this PR allows the user to configure lists of of warnings to report as info severity and hint severity respectively. I purposefully only convert warnings and not errors as i believe it's a good idea to have the editor show the same severity as the compiler as much as possible.
![image](https://user-images.githubusercontent.com/13839236/84829609-50437500-b028-11ea-80a8-1bbd05680ba7.png)

### Open questions
#### Discoverability
How do we teach this to new and existing users? Should a section be added to the user manual? If so  where and what should it say?

#### Defaults
Other languages such as TypeScript report unused code as hint by default. Should rust-analyzer similarly report some problems as hint/info by default?

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
Co-authored-by: Gabriel Valfridsson <gabriel.valfridsson@gmail.com>
2020-06-17 11:01:37 +00:00
Gabriel Valfridsson
656e95211e Warnings as hint or info 2020-06-17 00:00:43 +02:00
Laurențiu Nicola
2fa0b20ce0 Remove debugging code for incremental sync 2020-06-16 22:06:24 +03:00
Aleksey Kladov
3c72fc0573 Anchor file-system operations to the file, and not to the source root.
Anchoring to the SourceRoot wont' work if the path is absolute:

  #[path = "/tmp/foo.rs"]
  mod foo;

Anchoring to a file will.

However, we *should* anchor, instead of just producing an abs path.

I can imagine a situation where, for example, rust-analyzer processes
crates from different machines (or, for example, from in-memory git
branch), where the same absolute path in different crates might refer
to different files in the end!
2020-06-16 18:45:58 +02:00
Thiébaud Weksteen
44f28f65af Accept relative paths in rust-project.json
If a relative path is found as part of Crate.root_module or Root.path,
interpret it as relative to the location of the rust-project.json file.
2020-06-15 13:11:53 +02:00
bors[bot]
246c66a7f7
Merge #4867
4867: Cleanup URL handling r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-13 12:35:44 +00:00
Aleksey Kladov
50bbf7233d Cleanup URL handling 2020-06-13 14:15:38 +02:00
Gabriel Valfridsson
66291d19f9 Revert "Hide squiggly for unused and unnecessary"
This reverts commit 599c105e6f.
2020-06-12 18:39:50 +02:00
Aleksey Kladov
663ce0e99d Remove dead code 2020-06-11 13:34:09 +02:00
Aleksey Kladov
27ebe5d33e Reduce OUT_DIR special casing 2020-06-10 12:08:35 +02:00
Clemens Wasser
fe21fc2d25 checkOnSafe.features and checkOnSafe.allFeatures now work identically. 2020-06-10 09:37:26 +02:00
Clemens Wasser
33b9058838 Most of the checkOnSafe options now default to the cargo equivalent. 2020-06-10 09:27:25 +02:00
Clemens Wasser
47ef544fa5 Added the rust-analyzer.checkOnSave.features option. 2020-06-10 08:51:11 +02:00
Clemens Wasser
684b6fa1b8 flycheck now uses the configured features 2020-06-09 21:47:54 +02:00
bors[bot]
38ac331f7d
Merge #4784
4784: Change management of test cfg to better support json projects r=Nashenas88 a=Nashenas88

This helps support json projects where they can decide whether to add the `test` cfg or not. One alternative is to add support for marking json project crates as a sysroot crate, and adding logic to remove the `test` cfg in those cases. In my opinion, that option gives less flexibility to json projects and leads to more functionality that needs to be maintained.

Fixes #4508 
cc @woody77 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
Co-authored-by: Paul Daniel Faria <nashenas88@users.noreply.github.com>
2020-06-08 16:20:45 +00:00
Paul Daniel Faria
dbceaf522b Use Option<&str> for target instead of Option<&String> 2020-06-08 12:10:23 -04:00
Paul Daniel Faria
9c35f135b9 Remove default_cfg_options, pass target instead so it can be used for building cargo workspaces 2020-06-08 10:23:29 -04:00
vsrs
b7db9f058a Apply suggestions from code review 2020-06-08 14:19:40 +03:00
Paul Daniel Faria
3937b225e7 Change management of test cfg to better support json projects 2020-06-07 10:29:03 -04:00
vsrs
9b4256dc4d Add lib target filtering. 2020-06-06 22:11:17 +03:00
vsrs
3434f1dd2c Add Run|Debug hover actions 2020-06-06 18:17:52 +03:00
vsrs
de74c0dcab Preliminary runnables refactoring 2020-06-06 18:17:52 +03:00
bors[bot]
4029628f15
Merge #4729 #4748
4729: Hover actions r=matklad a=vsrs

This PR adds a `hoverActions` LSP extension and a `Go to Implementations` action as an example:
![hover_actions_impl](https://user-images.githubusercontent.com/62505555/83335732-6d9de280-a2b7-11ea-8cc3-75253d062fe0.gif)



4748: Add an `ImportMap` and use it to resolve item paths in `find_path` r=matklad a=jonas-schievink

Removes the "go faster" queries I added in https://github.com/rust-analyzer/rust-analyzer/pull/4501 and https://github.com/rust-analyzer/rust-analyzer/pull/4506. I've checked this PR on the rustc code base and the assists are still fast.

This should fix https://github.com/rust-analyzer/rust-analyzer/issues/4515.

Note that this does introduce a change in behavior: We now always refer to items defined in external crates using paths through the external crate. Previously we could also use a local path (if for example the extern crate was reexported locally), as seen in the changed test. If that is undesired I can fix that, but the test didn't say why the previous behavior would be preferable.

Co-authored-by: vsrs <vit@conrlab.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-06-05 15:14:35 +00:00
Aleksey Kladov
c9a41bd92d Actually test include!(concant!(env!()));
It triggered index-based goto definition before :-(
2020-06-05 15:49:12 +02:00
Aleksey Kladov
cb9d9040f7 Cleanup test 2020-06-05 15:14:47 +02:00
vsrs
bd9d7b6ad8 Remove hover actions heavy tests. 2020-06-05 15:26:46 +03:00
vsrs
78c9223b7b Remove hover contents marking as trusted.
Hover contents might be extracted from raw
doc comments and need some validation.
2020-06-05 15:25:01 +03:00
vsrs
0fe43a124b Add capabilities tests. 2020-06-05 15:00:31 +03:00
vsrs
e35418ceb9 Apply suggestions from @kjeremy review 2020-06-05 15:00:31 +03:00
vsrs
5d0c1aa162 Rebase on the latest master. 2020-06-05 15:00:30 +03:00
vsrs
b147e6eb95 Code formatting 2020-06-05 15:00:30 +03:00
vsrs
7d0dd17b09 Add hover actions as LSP extension 2020-06-05 14:59:26 +03:00
bors[bot]
c19496f845
Merge #4740
4740: Remove unneeded "./" prefix affecting error messages r=kjeremy a=dtolnay

I noticed this in the error in the commit message of https://github.com/rust-analyzer/rust-analyzer/pull/4739.

Before:

```console
error[E0599]: no method named `initialize_finish` found for struct `lsp_server::Connection` in the current scope
  --> crates/rust-analyzer/./src/bin/main.rs:99:16
   |
99 |     connection.initialize_finish(initialize_id, initialize_result)?;
   |                ^^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`
```

After:

```console
error[E0599]: no method named `initialize_finish` found for struct `lsp_server::Connection` in the current scope
  --> crates/rust-analyzer/src/bin/main.rs:99:16
   |
99 |     connection.initialize_finish(initialize_id, initialize_result)?;
   |                ^^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`
```

```diff
-   --> crates/rust-analyzer/./src/bin/main.rs:99:16
+   --> crates/rust-analyzer/src/bin/main.rs:99:16
```

Co-authored-by: David Tolnay <dtolnay@gmail.com>
2020-06-04 13:04:24 +00:00
David Tolnay
7348040944
Remove unneeded "./" prefix affecting error messages
Before:

    error[E0599]: no method named `initialize_finish` found for struct `lsp_server::Connection` in the current scope
      --> crates/rust-analyzer/./src/bin/main.rs:99:16
       |
    99 |     connection.initialize_finish(initialize_id, initialize_result)?;
       |                ^^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`

After:

    error[E0599]: no method named `initialize_finish` found for struct `lsp_server::Connection` in the current scope
      --> crates/rust-analyzer/src/bin/main.rs:99:16
       |
    99 |     connection.initialize_finish(initialize_id, initialize_result)?;
       |                ^^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`
2020-06-03 18:02:09 -07:00
David Tolnay
19b27f2ec9
Declare required lsp-server dependency of rust-analyzer crate
My codebase already depended on lsp-server and introducing a dependency
on rust-analyzer failed at first because it assumes some functions that
were first present in lsp-server 0.3.2.

Without this change:

    error[E0599]: no method named `initialize_start` found for struct `lsp_server::Connection` in the current scope
      --> crates/rust-analyzer/./src/bin/main.rs:83:57
       |
    83 |     let (initialize_id, initialize_params) = connection.initialize_start()?;
       |                                                         ^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`

    error[E0599]: no method named `initialize_finish` found for struct `lsp_server::Connection` in the current scope
      --> crates/rust-analyzer/./src/bin/main.rs:99:16
       |
    99 |     connection.initialize_finish(initialize_id, initialize_result)?;
       |                ^^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`
2020-06-03 17:55:48 -07:00
Mikhail Rakhmanov
6cd2e04bd2 Fix more comments 2020-06-03 19:33:57 +02:00
Mikhail Rakhmanov
6a0083a519 Merge branch 'master' into compute-lazy-assits
# Conflicts:
#	crates/rust-analyzer/src/main_loop/handlers.rs
#	crates/rust-analyzer/src/to_proto.rs
2020-06-03 19:26:01 +02:00
Mikhail Rakhmanov
bacd0428fa Fix review comments 2020-06-03 18:39:01 +02:00
bors[bot]
a33cfcb55d
Merge #4502
4502: Mark fixes from diagnostics as quick fixes r=kjeremy a=kjeremy

Populates the diagnostic UI with fixes:

Before: 
![quickfix-before](https://user-images.githubusercontent.com/4325700/82165183-0e38df00-9882-11ea-96cf-7dab5faec4d4.PNG)

After:
![image](https://user-images.githubusercontent.com/4325700/82165193-1a24a100-9882-11ea-97d7-be1b64b135e0.png)


Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-06-03 13:39:30 +00:00
Jeremy Kolb
9e71fc0314 Mark fixes from diagnostics as quick fixes 2020-06-03 09:31:32 -04:00
Aleksey Kladov
fa019c8f56 Document rust-project.json 2020-06-03 15:17:26 +02:00
Aleksey Kladov
2e7d12d2f3 Drop test for old format 2020-06-03 12:39:11 +02:00
Aleksey Kladov
8baa4c5d07 Groundwork for specifying the set of projects via config 2020-06-03 12:22:01 +02:00
Aleksey Kladov
03a76191a1 Rename ProjectRoot -> ProjectManifest 2020-06-03 12:05:50 +02:00
Aleksey Kladov
0a88de809f Move project discovery 2020-06-03 12:04:27 +02:00
Aleksey Kladov
a87cd8ecc6 Rename WorldState -> GlobalState 2020-06-03 11:20:01 +02:00
Aleksey Kladov
ee181cf683 Drop no-project test
Eventually, we should support "just open random rust file" use case,
we don't really do this now, so let's avoid spending time on it until
we fix it properly.
2020-06-03 11:07:04 +02:00
Aleksey Kladov
d4b21476a8 Derive local roots from Workspaces 2020-06-03 10:52:35 +02:00
Aleksey Kladov
ac4782ef11
Merge pull request #4382 from woody77/json_cfgs
Begin transition to new fields for JsonProject crate cfgs
2020-06-03 10:28:15 +02:00
Gabriel Valfridsson
599c105e6f Hide squiggly for unused and unnecessary 2020-06-03 01:57:28 +02:00
Mikhail Rakhmanov
cb482e6351 Merge remote-tracking branch 'upstream/master' into compute-lazy-assits
# Conflicts:
#	crates/rust-analyzer/src/to_proto.rs
2020-06-02 23:22:45 +02:00
Mikhail Rakhmanov
57cd936c52 Preliminary implementation of lazy CodeAssits 2020-06-02 23:10:53 +02:00
bors[bot]
2f6ab77708
Merge #4710
4710: New runnables r=matklad a=matklad

bors d=@vsrs

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-02 20:44:56 +00:00
bors[bot]
0035dafbfa
Merge #4711
4711: Disable rust-analyzer.{cargo,checkOnSave}.allFeatures by default r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-02 16:16:38 +00:00
Laurențiu Nicola
7a66d99897 Disable rust-analyzer.{cargo,checkOnSave}.allFeatures by default 2020-06-02 19:14:34 +03:00
Aleksey Kladov
bc3db7c1de Fix tests 2020-06-02 18:09:12 +02:00
Aleksey Kladov
a83ab820a4 Spec better runnables 2020-06-02 17:34:18 +02:00
Aleksey Kladov
0303982119 New runnables API 2020-06-02 17:22:42 +02:00
Aleksey Kladov
31f282636b Minor 2020-06-02 16:30:47 +02:00
veetaha
d605ec9c32 Change Runnable.bin -> Runnable.kind
As per matklad, we now pass the responsibility for finding the binary to the frontend.
Also, added caching for finding the binary path to reduce
the amount of filesystem interactions.
2020-05-31 05:21:45 +03:00
veetaha
a419cedb1c Fix tests, apply code review proposals 2020-05-31 03:10:23 +03:00
veetaha
030d78345f Fix invoking cargo without consulting CARGO or standard installation paths 2020-05-31 03:10:23 +03:00
Roland Ruckerbauer
18aa4bcb03 Add semantic highlight to QUESTION token
Made it an operator with controlFlow modifier.
2020-05-29 21:17:14 +02:00
Aaron Loucks
a047f10839 Hover tooltip module name is monospace once again
The line separator is moved below the function signature to split
regions between the docs. This is very similar to how IntelliJ
displays tooltips. Adding an additional separator between the module
name and function signature currently has rendering issues.

Fixes #4594
Alternative to #4615
2020-05-25 23:18:45 -04:00
bors[bot]
30f058dfea
Merge #4602 #4603
4602: Add boolean literal semantic token type to package.json r=matklad a=lnicola

Closes #4583.

CC @GrayJack

4603: Add self keyword semantic token type r=matklad a=lnicola

Not sure if this is warranted a new token type or just a modifier.

---

CC #4583, @GrayJack

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-05-25 14:08:21 +00:00
Aleksey Kladov
0ebb25b29b Document parentModule experimental LSP request 2020-05-25 15:59:49 +02:00
Aleksey Kladov
a30bdd9795 Cleanup lsp extensions on the client side 2020-05-25 14:56:26 +02:00
Aleksey Kladov
76e170c3d0 Less rust-analyzer specific onEnter 2020-05-25 14:28:47 +02:00
Laurențiu Nicola
c2358365ad Add self keyword semantic token type 2020-05-25 12:08:58 +03:00
bors[bot]
fbb8b884a2
Merge #4593
4593: Document some rust-analyzer specific protocol extensions r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-24 15:05:20 +00:00
Aleksey Kladov
5276bfff81 Fix formatting 2020-05-24 17:04:17 +02:00
Aleksey Kladov
dec4ba8023 Document some rust-analyzer specific protocol extensions 2020-05-24 17:01:40 +02:00
Aleksey Kladov
9342273616 Document matchingBrace LSP request 2020-05-24 16:53:18 +02:00
Matthew Jasper
e2d36cb692 Highlight true and false as literals 2020-05-24 15:12:17 +01:00
Aleksey Kladov
130318b823
Merge pull request #4548 from bnjjj/fix_4464
add support of feature flag for runnables
2020-05-24 15:34:35 +02:00
Aleksey Kladov
f26b7928e0
Merge pull request #4495 from vsrs/fixture_meta
Test fixtures parsing improvements
2020-05-24 15:32:52 +02:00
Aleksey Kladov
ce7144a93d
Merge pull request #4474 from georgewfraser/color_attrs
Color attribute functions
2020-05-24 15:32:31 +02:00
Benjamin Coenen
27ed376bc4 add support of feature flag for runnables #4464
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-24 13:34:34 +02:00
Benjamin Coenen
48d7c61e26 add support of feature flag for runnables #4464
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-23 20:59:18 +02:00
bors[bot]
ca5e4596a0
Merge #4578
4578: Remove unnecessary clone that prevented clippy from moving on r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-05-23 11:24:28 +00:00
bors[bot]
88c292b1c2
Merge #4559
4559: Module name on hover shows another newline after it r=matklad a=Arthamys

This changes the display of hover information to add a newline between the module path of the item and the signature of the item, as suggested in #3813 

**Before**

![before_3813](https://user-images.githubusercontent.com/11710698/82609224-5d517d80-9bbc-11ea-9a08-0a1558409c6b.png)

**After**

![after_3813](https://user-images.githubusercontent.com/11710698/82609208-562a6f80-9bbc-11ea-8cb6-4430269c5800.png)

Co-authored-by: Galilée 'Bill' Enguehard <galilee.enguehard@gmail.com>
2020-05-23 11:09:24 +00:00