Commit Graph

9412 Commits

Author SHA1 Message Date
Aleksey Kladov
a8196ffe84 Correctly highlight ranges of diagnostics from macros
closes #2799
2020-04-17 13:56:38 +02:00
Aleksey Kladov
302bf97bbf Don't expose impl details of SyntaxPtr 2020-04-17 12:25:41 +02:00
bors[bot]
bd6b532224
Merge #4009
4009: Better snippet when completing trait method r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-17 10:06:01 +00:00
Aleksey Kladov
3b75bc154f Better snippet when completing trait method 2020-04-17 12:05:35 +02:00
bors[bot]
46105cdaba
Merge #4004
4004: Use mmap for proc macro libs r=matklad a=lnicola

Fixes #4002.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-17 09:40:53 +00:00
Laurențiu Nicola
93fcf1c133 Use mmap for proc macro libs 2020-04-17 12:38:38 +03:00
bors[bot]
f8016b8194
Merge #3996
3996: Fix path for proc-macro in nightly / stable release r=matklad a=edwin0cheng

I messed up that I forget we use different executable names for nightly / stable release, I changed to use the current executable name instead.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-17 09:31:57 +00:00
Benjamin Coenen
379787858b feat: improve dot completions with scoring
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 10:59:04 +02:00
bors[bot]
69f0cb6cd7
Merge #4008
4008: tests: add more info about what failed in tidy tests r=matklad a=bnjjj

Separate PR from #3954

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 08:40:02 +00:00
Benjamin Coenen
18802ebe41 revert tidy tests changes
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 10:34:58 +02:00
bors[bot]
d426462b48
Merge #4007
4007: Reduce allocations when looking up proc macro decl r=edwin0cheng a=lnicola

`libserde_derive` has about 21K symbols on Linux. It's not much, but let's ~~not be wasteful~~ avoid the allocations anyway.

r? @edwin0cheng

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-17 08:32:20 +00:00
Benjamin Coenen
828f69ce54 tests: add more info about what failed in tidy tests
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 10:32:12 +02:00
Benjamin Coenen
0a1585075c Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-04-17 10:30:39 +02:00
Benjamin Coenen
071ef268b5 feat: improve dot completions with scoring
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 10:29:32 +02:00
Laurențiu Nicola
02b96d522c Reduce allocations when looking up proc macro decl 2020-04-17 11:12:05 +03:00
Edwin Cheng
ef6ee16006 Fix path for proc-macro in nightly / stable build 2020-04-17 04:45:03 +08:00
bors[bot]
8d296be109
Merge #3995
3995: Separate project discovery from project loading r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-16 20:36:19 +00:00
Aleksey Kladov
422ae477ce Unmix error handling when discovering workspaces
Hitting an io::Error is a legit problem. Finding more than one
Cargo.toml is not.
2020-04-16 22:35:50 +02:00
bors[bot]
10d8cb913c
Merge #3958
3958: Add proc-macro related config and tests r=matklad a=edwin0cheng

This PR do the following things:

1. Add cli argument `proc-macro` for running proc-macro server.
2. Added support for proc-macro in bench and analysis-stats
3. Added typescript config for proc-macros
4. Added an heavy test for proc-macros. 

To test it out: 

1. run `cargo xtask install --proc-macro`
2. add `"rust-analyzer.cargo.loadOutDirsFromCheck": true"` and `"rust-analyzer.procMacro.enabled": true"` in vs code config.

[Edit] Change to use `rust-analyzer proc-macro` for running proc-macro standalone process.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-16 20:21:59 +00:00
Edwin Cheng
16a74cfd23 Remove ci changes 2020-04-17 04:11:49 +08:00
Edwin Cheng
b4c5ee33ae Fix extern_process args 2020-04-17 04:08:01 +08:00
Aleksey Kladov
be2654b0ed Decouple project loading from project discovery a bit 2020-04-16 22:02:10 +02:00
bors[bot]
a4cda3efbb
Merge #3994
3994: Don't expose SyntaxNodePtr impl details r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-16 19:01:30 +00:00
Aleksey Kladov
cae2498513 Don't expose SyntaxNodePtr impl details 2020-04-16 21:01:04 +02:00
Benjamin Coenen
6ebc8bbeb0 feat: improve dot completions with scoring
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-16 18:30:08 +02:00
bors[bot]
fc0a47a0c1
Merge #3992
3992: cargo update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-16 13:45:12 +00:00
Edwin Cheng
177becea98 Add proc-macro cli command for rust-analyzer 2020-04-16 21:13:57 +08:00
kjeremy
45b0826499 cargo update 2020-04-16 09:13:44 -04:00
bors[bot]
0390d62168
Merge #3979
3979: fix missing match arm false positive for enum with no variants r=flodiebold a=JoshMcguigan

fixes #3974

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-16 12:57:31 +00:00
bors[bot]
7d60a446fc
Merge #3990
3990: Switch to Chalk recursive solver r=matklad a=flodiebold

Before:
```
Expressions of unknown type: 5526 (3%)
Expressions of partially unknown type: 5415 (3%)
```
After:
```
Expressions of unknown type: 4600 (2%)
Expressions of partially unknown type: 4645 (2%)
```

On the other hand,
```
'./target/release/rust-analyzer analysis-stats -q . # old solver' ran
    1.24 ± 0.04 times faster than 'rust-analyzer analysis-stats -q . # new solver'
```
I think part of this just comes from the fact that we're inferring more types now; but apart from that, it should be possible to improve the performance a bunch, and I'll make looking into that a priority.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-16 12:50:19 +00:00
Josh Mcguigan
360bdf653b fix false positive for enum with no variants 2020-04-16 05:37:49 -07:00
Edwin Cheng
ca7dc69a8e Add tests for proc_macro 2020-04-16 19:28:06 +08:00
Edwin Cheng
a4b0ce07f8 Add config for proc_macro 2020-04-16 19:28:06 +08:00
Edwin Cheng
22e33f308a Add with-proc-macro in bench ,stats and diagnositcs 2020-04-16 19:27:44 +08:00
Florian Diebold
39fe3a6486 Test for non-working proc macro server assoc types 2020-04-16 13:06:23 +02:00
Florian Diebold
14570df015 Switch Chalk to recursive solver
+ various fixes related to that.
2020-04-16 13:06:23 +02:00
bors[bot]
364415b7d6
Merge #3989
3989: Update Chalk r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-16 10:50:21 +00:00
Florian Diebold
e8d0d79a0c Update Chalk 2020-04-16 12:39:00 +02:00
bors[bot]
aa887d7ab4
Merge #3948
3948: fix: inlay hints config desyncronization between the frontend and the backend r=matklad a=Veetaha

See the explanation in the issue comment:
https://github.com/rust-analyzer/rust-analyzer/issues/3924#issuecomment-612444566

Workaround-ly fixes: #3924

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-16 09:35:42 +00:00
Benjamin Coenen
06076f95a7 feat: improve dot completions in a struct literal expression
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-15 22:10:57 +02:00
bors[bot]
f1a07dbf55
Merge #3962
3962: Fix parentModule shortcut conflict r=matklad a=CodeSandwich

The default parentModule shortcut conflicts with VSCode's built-in undo selection

Co-authored-by: Igor Żuk <igor.zuk@protonmail.com>
2020-04-15 10:11:20 +00:00
bors[bot]
1e0ba04033
Merge #3966 #3968
3966: Add support for bounds on associated types in trait definitions r=matklad a=flodiebold

E.g.
```rust
trait Trait {
    type Item: SomeOtherTrait;
}
```
Note that these don't simply desugar to where clauses; as I understand it, where clauses have to be proved by the *user* of the trait, but these bounds are proved by the *implementor*. (Also, where clauses on associated types are unstable.)

(Another one from my recursive solver branch...)

3968: Remove format from syntax_bridge hot path r=matklad a=edwin0cheng

Although only around 1% speed up by running:

```
Measure-Command {start-process .\target\release\rust-analyzer "analysis-stats -q ." -NoNewWindow -wait}
```

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-15 09:29:36 +00:00
bors[bot]
d61909f904
Merge #3964 #3965 #3967
3964: Nicer Chalk debug logs r=matklad a=flodiebold

I'm looking at a lot of Chalk debug logs at the moment, so here's a few changes to make them slightly nicer...

3965: Implement inline associated type bounds r=matklad a=flodiebold

Like `Iterator<Item: SomeTrait>`.

This is an unstable feature, but it's used in the standard library e.g. in the definition of Flatten, so we can't get away with not implementing it :)

(This is cherry-picked from my recursive solver branch, where it works better, but I did manage to write a test that works with the current Chalk solver as well...)

3967: Handle `Self::Type` in trait definitions when referring to own associated type r=matklad a=flodiebold

It was implemented for other generic parameters for the trait, but not for `Self`.

(Last one off my recursive solver branch 😄 )

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-15 09:19:46 +00:00
bors[bot]
9726401eae
Merge #3963
3963: Upgrade Chalk r=matklad a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-15 09:08:39 +00:00
bors[bot]
923efa72bd
Merge #3969
3969: Change add_function assist to use todo!() instead of unimplemented!() r=matklad a=TimoFreiberg

In the spirit of #3935

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-04-15 08:55:44 +00:00
bors[bot]
61cb87e506
Merge #3976
3976: Bump @types/vscode and vscode-languageclient r=matklad a=kjeremy

Brings us inline with proposed LSP 3.16.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-15 08:43:15 +00:00
bors[bot]
d6327297e4
Merge #3978
3978: insta 0.16 r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-15 08:31:18 +00:00
bors[bot]
b495e56b0d
Merge #3971
3971: add diagnostics subcommand to rust-analyzer CLI r=JoshMcguigan a=JoshMcguigan

This PR adds a `diagnostics` subcommand to the rust-analyzer CLI. The intent is to detect all diagnostics on a workspace. It returns a non-zero status code if any error diagnostics are detected. Ideally I'd like to run this in CI against the rust analyzer project as a guard against false positives.

```
$ cargo run --release --bin rust-analyzer -- diagnostics .
```

Questions for reviewers:

1. Is this the proper way to get all diagnostics for a workspace? It seems there are at least a few ways this can be done, and I'm not sure if this is the most appropriate mechanism to do this.
2. It currently prints out the relative file path as it is collecting diagnostics, but it doesn't print the crate name. Since the file name is relative to the crate there can be repeated names, so it would be nice to print some identifier for the crate as well, but it wasn't clear to me how best to accomplish this. 

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-14 23:35:50 +00:00
Josh Mcguigan
6be972770e diagnostics cli, iterate over members 2020-04-14 16:26:03 -07:00
kjeremy
eedab116ab insta 0.16 2020-04-14 13:57:02 -04:00