Commit graph

731 commits

Author SHA1 Message Date
Laurențiu Nicola
83a87fcd11 Restore line index micro-optimization 2020-07-25 12:56:39 +03:00
Aleksey Kladov
451edcc098 Add rustc-perf to metrics 2020-07-25 10:35:45 +02:00
bors[bot]
a09a00a560
Merge #5520
5520: Add DocumentData to represent in-memory document with LSP info r=matklad a=kjeremy

At the moment this only holds document version information but in the near-future it will hold other things like semantic token delta info.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-24 20:31:44 +00:00
Jonas Schievink
92a4ec80a0 Only display experimental diagnostics when enabled 2020-07-24 17:39:44 +02:00
Jonas Schievink
f6f49735e8 Add toggle for experimental diagnostics 2020-07-24 17:39:16 +02:00
kjeremy
48da2d4c16 Add DocumentData to represent in-memory document with LSP info 2020-07-24 09:02:57 -04:00
David Lattimore
757f755c29 SSR: Match paths based on what they resolve to
Also render template paths appropriately for their context.
2020-07-24 21:34:00 +10:00
David Lattimore
3975952601 SSR: Pass current file position through to SSR code.
In a subsequent commit, it will be used for resolving paths.
2020-07-24 21:34:00 +10:00
David Lattimore
a45682ed96 Move iteration over all files into the SSR crate
The methods `edits_for_file` and `find_matches_in_file` are replaced with just `edits` and `matches`. This simplifies the API a bit, but more importantly it makes it possible in a subsequent commit for SSR to decide to not search all files.
2020-07-24 21:34:00 +10:00
bors[bot]
6ddcdb8b29
Merge #5511
5511: Set the document version after changes are applied but before vfs r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-23 21:49:51 +00:00
kjeremy
c9531dc797 Set the document version after changes are applied but before vfs 2020-07-23 17:46:21 -04:00
Aleksey Kladov
be06aaecde Lighter weight tempdir 2020-07-23 22:26:25 +02:00
Aleksey Kladov
7c0743293e Require quotes around key-value cfg flags in rust-project.json
This matches rustc command-line flags, as well as the build.rs format.
2020-07-23 19:03:17 +02:00
bors[bot]
8df105b8b2
Merge #5505
5505: Cleanup CFG API r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-23 14:55:22 +00:00
Aleksey Kladov
38e38d9b29 Cleanup CFG API 2020-07-23 16:53:12 +02:00
bors[bot]
7bada8a76d
Merge #5473
5473: Changes to rust-project.json r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-23 13:58:45 +00:00
Aleksey Kladov
c2d8829d56 minor 2020-07-23 10:26:56 +02:00
kjeremy
7eedf19cfa Move deprecated attribute to where it is needed 2020-07-22 15:41:38 -04:00
kjeremy
9a9c0e1105 Use symbol tags 2020-07-22 12:18:48 -04:00
bors[bot]
1c7d5f513c
Merge #5481
5481: Track document versions in the server r=kjeremy a=kjeremy

This also pushes diagnostics for the correct file version on close so that when it is reopened stale diagnostics are not shown.

Closes #5452 

Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-07-22 13:04:30 +00:00
Jeremy Kolb
4f4582a6ad
Update crates/rust-analyzer/src/main_loop.rs
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-22 08:59:05 -04:00
Aleksey Kladov
9ad41eb908 Setup global allocator in the correct crate
It worked before, but was roundabout
2020-07-22 13:42:53 +02:00
Aleksey Kladov
deed44a472 Remove support for jemalloc
We only used it for measuring memory usage, but now we can use glibc's
allocator for that just fine
2020-07-22 13:40:45 +02:00
kjeremy
79a3dd085c Clear diagnostics for known file version on close 2020-07-21 14:18:22 -04:00
kjeremy
97927146db Store document version and pass back to the client 2020-07-21 14:07:42 -04:00
Aleksey Kladov
39a2bc5e3c Expose package roots more directly 2020-07-21 12:52:51 +02:00
bors[bot]
818aeb8a24
Merge #5467
5467: Allow null or empty values for configuration r=matklad a=kjeremy

Allow the client to respond to `workspace/configuration` with `null` values. This is allowed per the spec if the client doesn't know about the configuration we've requested.

This also protects against `null` or `{}` during initialize. I'm not sure if we want to interpret `{}` as "don't change anything" but I think that's a reasonable approach to take.

This should help with LSP clients working out of the box.

Fixes #5464 

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-21 09:41:54 +00:00
Aleksey Kladov
8f3fdf3315 Typo 2020-07-21 10:50:24 +02:00
Aleksey Kladov
a20b8d751b Propagate cargo.target to checkOnSave 2020-07-21 10:30:54 +02:00
kjeremy
a32dd9c478 Protect against {} 2020-07-20 18:11:32 -04:00
kjeremy
adc4bb5406 Allow client to respond to workspace/configuration with null values
This is allowed per the spec if the client doesn't know about the configuration
we've requested.
2020-07-20 17:42:48 -04:00
Jeremy Kolb
17f4d27f12 Minor perf tweaks per clippy 2020-07-19 14:26:24 -04:00
Aleksey Kladov
46ac9ff5e3 Simplify exclusion logic 2020-07-18 16:40:10 +02:00
Aleksey Kladov
b38f6b3c41 Don't show docs in concise signature help 2020-07-18 15:14:44 +02:00
bors[bot]
2ca0e9e00e
Merge #5327
5327: Mark fixes from check as preferred r=matklad a=kjeremy

This allows us to run the auto fix command from vscode to automatically fix diagnostics in the file.

They are also distinguished in the UI.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-07-17 11:12:40 +00:00
Aleksey Kladov
d7548a36a7 Unclutter NavigationTarget API 2020-07-17 12:42:48 +02:00
Aleksey Kladov
e1e79cf064 Take label offets client capability into account 2020-07-16 18:48:02 +02:00
Aleksey Kladov
a4e9681c79 Better module structure 2020-07-16 18:13:43 +02:00
Aleksey Kladov
ff0312fa32 Semantical call info 2020-07-16 18:03:04 +02:00
Jeremy Kolb
d7cd88b1a2 Mark machine applicable fixes as preferred
This allows us to run the auto fix command from vscode to automatically
fix all diagnostics in the file.

They are also distinguished in the UI.
2020-07-16 10:51:25 -04:00
Jeremy Kolb
7fba2274d9 Update lsp-types for HoverOptions 2020-07-15 18:17:46 -04:00
bors[bot]
b63e23e98e
Merge #5350
5350: Filter assists r=matklad a=kjeremy

Uses the `CodeActionContext::only` field to compute only those assists the client cares about.

It works but I don't really like the implementation.

Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-07-15 17:58:46 +00:00
Leander Tentrup
119e71d9ea Add new Punctuation highlight tag 2020-07-15 16:42:47 +02:00
Jeremy Kolb
21c1504ca9 Move allow list into AssistConfig 2020-07-15 09:45:30 -04:00
bors[bot]
fbdc3c7849
Merge #5390
5390: Don't drop flycheck messages during restart r=matklad a=matklad

closes #5386



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-15 12:38:24 +00:00
Aleksey Kladov
a40e05dd5d Don't drop flycheck messages during restart
closes #5386
2020-07-15 14:37:44 +02:00
Jeremy Kolb
6a7d1d4412 Invert condition 2020-07-15 08:17:48 -04:00
Jeremy Kolb
26725fcfbb Fix conversion 2020-07-15 08:17:32 -04:00
bors[bot]
2c67ca0146
Merge #5387
5387: Add --memory-usage to analysis-bench r=matklad a=jonas-schievink



Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-07-15 12:07:05 +00:00
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