Commit graph

9327 commits

Author SHA1 Message Date
Aleksey Kladov
f5b01d6544 WIP: uniformalize external tools config 2020-03-31 15:55:05 +02:00
kjeremy
b3b8d31c5e Update node deps 2020-03-31 09:47:53 -04:00
veetaha
09a760e52e vscode: add syntax tree inspection hovers and highlights 2020-03-31 16:20:59 +03:00
bors[bot]
35675defe7
Merge #3788
3788: Update deps r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-03-31 13:11:50 +00:00
kjeremy
a1c5905d8d Update deps 2020-03-31 09:09:16 -04:00
bors[bot]
30466e068b
Merge #3778
3778: Use more functional programming in ArenaMap::insert r=matklad a=kjeremy

I find this more readable and it flattens out the body a little. Others may disagree.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-03-31 13:04:54 +00:00
kjeremy
7ca5ef67e8 Use resize_with 2020-03-31 09:02:12 -04:00
bors[bot]
2cdeb7363a
Merge #3786
3786: When adding match arm, don't let the floating comma r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-31 12:53:51 +00:00
Aleksey Kladov
2fe6e23138 When adding match arm, don't let the floating comma 2020-03-31 14:52:20 +02:00
bors[bot]
d63bb8565e
Merge #3781
3781: Add crate versions when running cargo -p commands. r=matklad a=o0Ignition0o

If someone (unfortunately) creates a project that happens to have the same name as one of its (future) dependencies, there is [a way for them to change the dependency's alias in the Cargo.toml file](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml), to mitigate the name conflict. Unfortunately cargo -p commands don't seem to pick it up, which seems to put rust-analyzer run commands in a tough situation: 

```
> Executing task: cargo test --package config --example default -- tests --nocapture <

error: There are multiple `config` packages in your project, and the specification `config` is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
  config:0.1.0
  config:0.9.3
The terminal process terminated with exit code: 101
```

cargo suggests us to be more specific and refer to a package by its name and version, which this PR achieves.

I passed the version as a String because I don't really understand how the ra_db types work, but I would love to switch it to [a fully fledged Version type](https://steveklabnik.github.io/semver/semver/index.html) if you guide me towards that :)



Co-authored-by: o0Ignition0o <jeremy.lempereur@gmail.com>
2020-03-31 12:45:39 +00:00
o0Ignition0o
331d1db317 Add crate versions when running cargo -p commands.
Until now cargo commands with the -p flag would pass the package name only.
It doesn't play super well with the toml Renaming dependencies feature.
This commit specifies the package name and version when a cargo command is run with the -p flag,
to avoid ambiguities.
2020-03-31 14:43:39 +02:00
bors[bot]
a932ccd53d
Merge #3785
3785: Attach doc-comment to declaration if there are newlines in between r=matklad a=ltentrup

This commit changes the parser to attach doc-comments to the corresponding declaration in case there are newlines in between the doc-comment and the declaration.

Implements the changes proposed in #3757 

Co-authored-by: Leander Tentrup <tentrup@react.uni-saarland.de>
2020-03-31 12:36:51 +00:00
Leander Tentrup
77f89a700b Attach doc-comment to declaration if there are newlines in between
This commit changes the parser to attach doc-comments to the corresponding declaration in case there are newlines in between the doc-comment and the declaration.
2020-03-31 14:27:23 +02:00
bors[bot]
668980d865
Merge #3777 #3784
3777: Add basic task support r=matklad a=Timmmm

This adds basic support for running `cargo build`, `cargo run`, etc.

Fixes #1935

I have tested this and it seems to work. There are two things I'm not sure about:

1. The workspace folder handling seems wrong - just get the first workspace folder? Is this just a TODO item? I don't know if it is right to lift `workspaceFolder` up to `activate()` but I couldn't see another way.
2. If you manually add an entry to `tasks.json` like this:

```
    {
      "type": "cargo",
      "command": "build",
      "problemMatcher": [
        "$rustc"
      ],
      "group": "build"
    }
```

then VSCode somehow magically knows to run `cargo build`. The documentation for `resolveTask` *sounds* like I should have to implement that for it to work:

```
 * Resolves a task that has no [`execution`](#Task.execution) set. Tasks are
 * often created from information found in the `tasks.json`-file. Such tasks miss
 * the information on how to execute them and a task provider must fill in
 * the missing information in the `resolveTask`-method.
```

But then it also says this:

```
* This method will not be
 * called for tasks returned from the above `provideTasks` method since those
 * tasks are always fully resolved. A valid default implementation for the
 * `resolveTask` method is to return `undefined`.
```

Either way, it works without implementing it so the only thing I can think is that it is doing some kind of crazy pattern matching of the tasks returned by `provideTasks()` and the ones found in `tasks.json`.

3784: Ignore createProgress request in tests r=matklad a=matklad

closes #3783



bors r+
🤖

Co-authored-by: Tim <tdhutt@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-31 10:41:56 +00:00
Aleksey Kladov
6b2f02fdfd Ignore createProgress request in tests
closes #3783
2020-03-31 12:02:47 +02:00
Tim
3eb45b9922 Pass string instread of WorkspaceFolder 2020-03-31 10:24:01 +01:00
Tim
9ef1e9efc6 Remove unnecessary null check 2020-03-31 09:11:22 +01:00
Tim
a781a58fe2 Throw error if no folder is opened 2020-03-31 09:06:52 +01:00
Tim
6e535915bd Use namespace import 2020-03-31 09:06:46 +01:00
kjeremy
f633f69e36 Do not call reserve since extend will handle it.
`Take` implements `TrustedLen` so we are guaranteed that only one
reserve call will be made.
2020-03-30 17:09:21 -04:00
Tim
768aa4259f Add basic task support
This adds basic support for running `cargo build`, `cargo run`, etc.
2020-03-30 21:23:21 +01:00
kjeremy
c39725212c Use more functional programming in ArenaMap::insert
I find this more readable and it flattens out the body a little.
2020-03-30 16:15:28 -04:00
bors[bot]
6f0d8db529
Merge #3775
3775: Fix typo r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-30 16:51:56 +00:00
Aleksey Kladov
beab6f34ce Fix typo 2020-03-30 18:51:30 +02:00
bors[bot]
159393745e
Merge #3774
3774: Simplify SemanticTokensBuilder build method r=matklad a=kjeremy

This matches the next stable vscode api

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-03-30 16:38:53 +00:00
kjeremy
d4c317320d Simplify SemanticTokensBuilder build method
This matches the next stable vscode api
2020-03-30 12:07:27 -04:00
bors[bot]
671926ac93
Merge #3666
3666: Reload part of the server configuration without restarts r=matklad a=SomeoneToIgnore

Partially addresses https://github.com/rust-analyzer/rust-analyzer/issues/2857

Closes #3751

Reloads all server configuration that's not related to VFS without restarts.

The VFS-related parameters are not considered, since VFS is planned to be rewritten/replaced in the future and I have a suspicion that with the current code, swapping the VFS and the file watchers on the fly will cause big troubles.

I have to store and process the config request id separately, since the `workspace/configuration` response returns `any[]` (https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_configuration), if there's a better way to handle those responses, let me know.



Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-03-30 12:45:49 +00:00
Kirill Bulatov
4c897d8d2d Fix the endless progress bar issue 2020-03-30 14:38:01 +03:00
Kirill Bulatov
8e78371222 Rebase fixes 2020-03-30 13:39:14 +03:00
Kirill Bulatov
2a19459ee9 Avoid failing on incorrect settings response 2020-03-30 13:39:14 +03:00
Kirill Bulatov
fbef0127ba Small style fix 2020-03-30 13:39:14 +03:00
Kirill Bulatov
b892a48740 Code review fixes
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-03-30 13:39:14 +03:00
Kirill Bulatov
590af37bff Small style fix
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-03-30 13:39:14 +03:00
Kirill Bulatov
392eb74b5f Remove an obsolete fixme 2020-03-30 13:39:14 +03:00
Kirill Bulatov
bbe59c7197 Reload watcher configuration 2020-03-30 13:39:14 +03:00
Kirill Bulatov
8a23bec2cd Style fixes 2020-03-30 13:39:14 +03:00
Kirill Bulatov
332799d914 Reload only the properties that do not affect vfs 2020-03-30 13:39:14 +03:00
Kirill Bulatov
2feaef91bd Read new config on the server side 2020-03-30 13:39:14 +03:00
Kirill Bulatov
a9dd442733 Send the config from the client 2020-03-30 13:39:14 +03:00
Kirill Bulatov
019f269a0a Process configuration response draft 2020-03-30 13:39:14 +03:00
Kirill Bulatov
8c4aab0c80 Client side draft 2020-03-30 13:39:14 +03:00
bors[bot]
9e12b9e6fd
Merge #3771
3771: Use IntoIter r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-30 10:30:23 +00:00
Aleksey Kladov
0cfa9eb445 Use IntoIter 2020-03-30 12:28:22 +02:00
bors[bot]
d2ea3f25b5
Merge #3761
3761: Append new match arms rather than replacing all of them r=matklad a=mattyhall

This means we now retain comments when filling in match arms. This fixes #3687. This is my first contribution so apologies if it needs a rethink! I think in particular the way I find the position to append to and remove_if_only_whitespace are a little hairy.

Co-authored-by: Matthew Hall <matthew@quickbeam.me.uk>
2020-03-30 10:19:02 +00:00
bors[bot]
3901198e87
Merge #3763
3763: Simplify r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-30 09:57:40 +00:00
bors[bot]
78a2678b6d
Merge #3770
3770: Pull options outwards r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-30 09:48:50 +00:00
Aleksey Kladov
4c9272583c Pull options outwards 2020-03-30 11:46:04 +02:00
bors[bot]
df8752bf3f
Merge #3754
3754: Use automatic thread joining for cargo-watch r=matklad a=matklad

r? @kiljacken 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-30 09:33:43 +00:00
Aleksey Kladov
12297ab675 Fix race in the tests 2020-03-30 11:33:01 +02:00
Aleksey Kladov
f7df0b56a7 Use automatic thread joining for cargo-watch 2020-03-30 11:33:01 +02:00