Commit Graph

816 Commits

Author SHA1 Message Date
Ryan Levick ac50e35325 Give better error message when the rust-analyzer binar path was set in the user's config but the binary is invalid 2021-08-03 14:03:49 +02:00
Aleksey Kladov be84f85c1d feat: gate custom clint-side commands behind capabilities
Some features of rust-analyzer requires support for custom commands on
the client side. Specifically, hover & code lens need this.

Stock LSP doesn't have a way for the server to know which client-side
commands are available. For that reason, we historically were just
sending the commands, not worrying whether the client supports then or
not.

That's not really great though, so in this PR we add infrastructure for
the client to explicitly opt-into custom commands, via `extensions`
field of the ClientCapabilities.

To preserve backwards compatability, if the client doesn't set the
field, we assume that it does support all custom commands. In the
future, we'll start treating that case as if the client doesn't support
commands.

So, if you maintain a rust-analyzer client and implement
`rust-analyzer/runSingle` and such, please also advertise this via a
capability.
2021-07-30 19:16:33 +03:00
Alexander Gonzalez cff2a0fe32 lint: Format the typescript files properly 2021-07-27 18:31:21 -04:00
Alexander Gonzalez ca85185bc6 docs: Update the lsp-extensions.md with the Hover Range capability 2021-07-27 18:31:21 -04:00
Alexander Gonzalez 1a0a5da1a4 refactor: Make handle_hover handle ranges too 2021-07-27 18:29:22 -04:00
Alexander Gonzalez 2b5798e927 fix: Unregister the removed command 2021-07-27 18:29:22 -04:00
Alexander Gonzalez 9f21891950 refactor: Remove unnecessary command 2021-07-27 18:29:22 -04:00
Alexander Gonzalez 18644720eb feat: Completed the client side implementation of rust-analyzer/hoverRange 2021-07-27 18:29:22 -04:00
Kevin DeLorey 5b9f173254 Removed all dead config accessors. 2021-07-23 07:50:37 -06:00
Kevin DeLorey d8f0213316 removed dead code 2021-07-23 07:41:55 -06:00
Kevin DeLorey b75e0e7bb1 Initial commit of highlight related configuration w/ implementation. 2021-07-22 19:35:47 -06:00
Laurențiu Nicola cfaf186d02 Rename the old server before update 2021-07-13 09:10:25 +03:00
Jonas Schievink 5f13fb9db9 Add "View Crate Graph (Full)" 2021-07-02 00:10:33 +02: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
wxb1ank 7a8a72c38f Use Uri.toString() for URLs 2021-06-14 23:29:38 -04: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
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
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
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
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
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
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
Kirill Bulatov 223dbd2187 Style fix 2021-05-23 13:43:06 +03:00
Kirill Bulatov 95c51d8f1d Don't use a deprecated accessor 2021-05-23 11:54:03 +03:00
Kirill Bulatov 230ed3304a Better releaseId naming 2021-05-23 11:51:35 +03:00
Kirill Bulatov be3e997ddf Remove nightly release id from local storage for stable extensions 2021-05-23 11:49:34 +03:00
Kirill Bulatov b8635a8e60 Download nightly extension when configured and run from stable extension version 2021-05-23 11:28:06 +03:00
Jonas Schievink 463ecefc64 Use .rs file ending to get syntax highlighting 2021-05-22 00:11:54 +02:00
Jonas Schievink 271ec6b990 Add a "Debug ItemTree" LSP request 2021-05-21 23:59:52 +02:00
Jonas Schievink a85a2c4d15 Allow viewing the crate graph in a webview 2021-05-11 16:15:31 +02:00
bors[bot] fb45d2adec Merge #8624
8624: Automatically detect rust library source file map  r=vsrs a=vsrs

This PR adds a new possible `rust-analyzer.debug.sourceFileMap` value:
```json
{
    "rust-analyzer.debug.sourceFileMap": "auto"
}
```

I did not make it the default because it uses two shell calls (`rustc --print sysroot` and `rustc -V -v`). First one can be slow (https://github.com/rust-lang/rustup/issues/783)

Fixes #8619

Co-authored-by: vsrs <vit@conrlab.com>
2021-04-27 20:41:35 +00:00
Jorge Mederos Alvarado 0230f22d2a Fix how and when old inlay hint decorations are disposed 2021-04-26 20:29:54 -04:00
Jorge Mederos Alvarado 9e5ef0ce72 Add option to opt out from smaller inlay hints font size 2021-04-26 20:29:54 -04:00
vsrs 1b4197cb35 Use explicit rustc commit-hash
Required for lldb on mac
2021-04-22 18:59:03 +03:00
vsrs 1ebfe11730 Add special auto value for debug.sourceFileMap 2021-04-22 16:09:46 +03:00