Commit graph

1200 commits

Author SHA1 Message Date
kjeremy
b88019c610 Update vscode-languageclient 2021-06-21 11:39:13 -04:00
bors[bot]
25bf451c84
Merge #9264
9264: feat: Make documentation on hover configurable r=Veykril a=Veykril

This also implements deprecation support for config options as this renames `hoverActions_linksInHover` to `hover_linksInHover`.

Fixes #9232

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-21 14:15:49 +00:00
Lukas Wirth
43098d99ae Remove deprecation support in config 2021-06-21 16:15:25 +02:00
Jade
8b77e2692c Implement a config override for the default #[cfg(test)] in cargo crates
Fixes crates which vanish when the 'test' cfg atom is set.

Fix #7243.
Fix #9203.
Fix #7225.
2021-06-19 01:09:19 -07:00
bors[bot]
d9666ce509
Merge #9334
9334: feat: Allow to disable import insertion on single path glob imports r=Veykril a=Veykril

On by default as I feel like this is something the majority would prefer.

Closes #8490

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-18 21:23:22 +00:00
Lukas Wirth
2ee090faaf Allow to disable import insertion on single path glob imports 2021-06-18 23:11:56 +02:00
kjeremy
e66dd9c85f Update css-what
npm audit flagged out version of css-what
2021-06-18 13:57:48 -04:00
bors[bot]
f6e73d510d
Merge #9258
9258: minor: Give `ImportPrefix` variants better config names r=matklad a=Veykril

I feel like `crate` and `self` work better than `by_crate` and `by_self`. The only reason for the current names were that `Self` doesn't work for the variant name on the rust side so I forgot about setting proper config names on serde layer.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-16 14:53:06 +00:00
bors[bot]
2980fd430d
Merge #9267 #9279
9267: fix: Code: update the LSP server without asking r=matklad a=lnicola

Most LSP extensions seem to do the same thing, and this is causing some
confusion for users who don't notice the update prompt before Code hides
it.

9279: minor: Document installation via Homebrew r=matklad a=Svetlitski

`rust-analyzer` can be installed via [Homebrew](https://brew.sh) (AKA`brew`) on macOS. I've added instructions on how to do so to the documentation. Additionally, I added a `.gitignore` rule to ignore the HTML documentation produced by  `asciidoctor manual.adoc` so that it is not accidentally checked into `git`.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Kevin Svetlitski <kevin_svetlitski@berkeley.edu>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-15 20:45:54 +00:00
bors[bot]
d0f2bc3b87
Merge #9292
9292: fix: Code: clean-up #8951 r=wxb1ank a=wxb1ank

#8951 was a major change in the VS Code extension and caused quite a few problems. This PR is a catch-all for bugs and improvements in the new code.

This should fix:
- #9284
- [this unreported bug](https://github.com/rust-analyzer/rust-analyzer/pull/8951/files#r651570446)
- ...and one or two uncaught exceptions I just found

The original lack of testing was my own fault, but this area of the VS Code API is also tricky for a couple reasons:
- The [FileSystem](https://github.com/rust-analyzer/rust-analyzer/pull/8951/files#r651570446) API does not list or warn about any exceptions, but [FileSystemProvider](https://github.com/rust-analyzer/rust-analyzer/pull/8951/files#r651570446) (which `FileSystem` is a wrapper of, AFAICT) does.
- At first glance, [Uri.path](https://github.com/rust-analyzer/rust-analyzer/pull/8951/files#r651570446) *looks* like it works for FS operations. It does not, at least, on Windows. You need to use `Uri.fsPath`.

I only use Windows, so I need people on macOS, Linux, and (possibly) NixOS to test this.

Co-authored-by: wxb1ank <wxblank@gmail.com>
2021-06-15 20:05:07 +00:00
wxb1ank
a6b0c056de Use .then() for Thenable 2021-06-15 14:03:34 -04:00
wxb1ank
56e128a979 fix: clean-up #8951 2021-06-15 13:29:02 -04:00
bors[bot]
7d363755a2
Merge #9282
9282: fix: Use objects instead of bools for markers in package.json r=lnicola a=lnicola

Addresses https://github.com/rust-analyzer/rust-analyzer/issues/9174#issue-913980665.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-06-15 06:47:33 +00:00
Laurențiu Nicola
41949748a6 Use objects instead of bools for markers in package.json 2021-06-15 09:40:43 +03:00
wxb1ank
7a8a72c38f Use Uri.toString() for URLs 2021-06-14 23:29:38 -04:00
Laurențiu Nicola
6cbb18e570 Code: automatically update the LSP server
Most LSP extensions seem to do the same thing, and this is causing some
confusion for users who don't notice the update prompt before Code hides
it.
2021-06-14 17:44:29 +03:00
Lukas Wirth
178b5ffba3 Add configuration deprecation 2021-06-14 15:49:57 +02:00
Lukas Wirth
a93d166f0f Make documentation on hover configurable 2021-06-14 15:25:10 +02:00
bors[bot]
388a91c8a8
Merge #8951
8951: internal: migrate to vscode.FileSystem API r=matklad a=wxb1ank

I encountered an error where `bootstrap()` attempts to create a directory with the path `C:\C:\...`. I couldn't find this reported anywhere else. Using the `vscode.FileSystem` API instead of the `fs` one works here. I assume the latter automatically prepends `C:\` to paths whereas the former does not. I don't know if this suggests `vscode.FileSystem` should be used in more places for consistency.

Co-authored-by: wxb1ank <wxblank@gmail.com>
2021-06-14 10:30:10 +00:00
Lukas Wirth
b58c1c9eb2 Give ImportPrefix variants better config names 2021-06-13 22:00:39 +02:00
Aleksey Kladov
16e142cd39 Revert "Merge #9177"
This reverts commit f1818cb7ba, reversing
changes made to 6c9362d61b.

This broke things
2021-06-08 15:31:36 +03:00
bors[bot]
f1818cb7ba
Merge #9177
9177: ⬆️ npm packages r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-08 11:00:19 +00:00
Aleksey Kladov
6d2cfb1bdc ⬆️ npm packages 2021-06-08 13:55:20 +03:00
Milo
b8eeef4dfa fix 2021-06-07 17:56:40 +01:00
Milo
42e5e5b458 fix 2021-06-06 00:21:50 +01:00
Milo
ab57c25d1e when you click status bar icon it now restarts server 2021-06-06 00:17:16 +01:00
Lukas Wirth
07394316ff Add function references hover action 2021-06-04 15:54:55 +02:00
Jonas Schievink
9fdb8f9037 Make it opt-in 2021-06-03 18:09:21 +02:00
Lukas Wirth
d304352407 Document that addCallArgumentSnippets requires `addCallParenthesis 2021-06-02 22:10:09 +02:00
wxb1ank
388a1945ac Lint toolchain.ts 2021-06-02 13:58:14 -04:00
wxb1ank
0448b73646 migrate from fs to vscode.FileSystem API 2021-06-02 12:11:32 -04:00
wxb1ank
3ca7f61a8d internal: use vscode.FileSystem API in main.ts 2021-06-02 12:07:13 -04:00
Kirill Bulatov
60e7817e9c Fix opening single files 2021-05-31 21:37:08 +03:00
Aleksey Kladov
ee995dbfd4 fix: fix shell injection in task spawning
closes #9058
2021-05-31 20:11:36 +03:00
Lukas Wirth
fb7105a580 Add config setting for self-on-the-fly 2021-05-31 15:14:56 +02:00
Lucas Schwiderski
9a057c0ff4
Fix incorrect setting descriptions
Descriptions for diagnostic warning hint and info display were swapped.

Fixes #8485.

Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
2021-05-29 18:08:14 +02:00
bors[bot]
b4015b6aaa
Merge #8995
8995: fix: Create tasks for all workspaces r=matklad a=SomeoneToIgnore

Follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/8955#discussion_r637897170

Before: 
<img width="593" alt="image" src="https://user-images.githubusercontent.com/2690773/119575267-712b5300-bdbf-11eb-833c-f688f7a7dd0f.png">

After: 
<img width="643" alt="image" src="https://user-images.githubusercontent.com/2690773/119575273-74264380-bdbf-11eb-8283-a78bbcb7346e.png">

This is the first time I've used multiple workspaces feature in VSCode, but so far looks like
* opening detached files works
* run and debug lens work
* Rust Analyzer: Run action works
* run task works and now shows tasks for all workspaces
* there are no platform-specific changes involved

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-05-26 20:58:07 +00:00
bors[bot]
8c80a21772
Merge #9001
9001: minor: explicitly set the focus to false r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-26 10:04:37 +00:00
Aleksey Kladov
249e22b325 minor: explicitly set the focus to false 2021-05-26 13:04:01 +03:00
Kirill Bulatov
a05163db14 Create tasks for all workspaces 2021-05-26 01:11:52 +03:00
bors[bot]
835cf55887
Merge #8767
8767: implement range formatting r=matklad a=euclio

Fixes #7580.

This PR implements the `textDocument/rangeFormatting` request using `rustfmt`'s `--file-lines` option.

Still needs some tests. What I want to know is how I should handle the instability of the `--file-lines` option. It's still unstable in rustfmt, so it's only available on nightly, and needs a special flag to enable. Is there a way for `rust-analyzer` to detect if it's using nightly rustfmt, or for users to opt-in?

Co-authored-by: Andy Russell <arussell123@gmail.com>
2021-05-25 12:15:48 +00:00
Eduardo Canellas
3dce8a3924 fix: cursor position after item move command
closes Item movers need some fixes #8492
2021-05-24 13:17:28 -03:00
bors[bot]
05fc97e31b
Merge #8955
8955: feature: Support standalone Rust files r=matklad a=SomeoneToIgnore

![standalone](https://user-images.githubusercontent.com/2690773/119277037-0b579380-bc26-11eb-8d77-20d46ab4916a.gif)

Closes https://github.com/rust-analyzer/rust-analyzer/issues/6388

Caveats: 

* I've decided to support multiple detached files in the code (anticipating the scratch files), but I found no way to open multiple files in VSCode at once: running `code *.rs` makes the plugin to register in the `vscode.workspace.textDocuments` only the first file, while code actually displays all files later.
Apparently what happens is the same as when you have VSCode open at some workplace already and then run `code some_other_file.rs`: it gets opened in the same workspace of the same VSCode with no server to support it.
If there's a way to override it, I'd appreciate the pointer.

* No way to toggle inlay hints, since the setting is updated for the workspace (which does not exist for a single file opened)
> [2021-05-24 00:22:49.100] [exthost] [error] Error: Unable to write to Workspace Settings because no workspace is opened. Please open a workspace first and try again.

* No runners/lens to run or check the code are implemented for this mode. 
In theory, we can detect `rustc`, run it on a file and run the resulting binary, but not sure if worth doing it at this stage.

Otherwise imports, hints, completion and other features work.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-05-24 12:40:25 +00:00
Aleksey Kladov
df146341c5 fix: can download server binary on windows again
Closes #8956

See https://github.com/rust-analyzer/rust-analyzer/pull/8951#issuecomment-846716999
2021-05-24 11:52:25 +03:00
Kirill Bulatov
c1f6a5a0b0 Fix ts lint errors 2021-05-23 23:47:58 +03:00
Aleksey Kladov
a6633a88a8 fix: reveal snippets 2021-05-23 23:40:19 +03:00
Andy Russell
a90b9a5872
implement range formatting 2021-05-23 15:50:36 -04:00
Kirill Bulatov
b3383b0661 Send detached files info to server via init params 2021-05-23 22:46:20 +03:00
Kirill Bulatov
d9a5490646 Start rust-analyzer server for arbitrary rust files 2021-05-23 22:46:20 +03:00
Kirill Bulatov
daedcc2b77 More style fixes 2021-05-23 13:57:04 +03:00