Commit Graph

988 Commits

Author SHA1 Message Date
Tomoki Nakagawa
e4b184a776 Respect $CARGO_HOME when looking up toolchains. 2023-02-26 15:37:04 +09:00
Lukas Wirth
95fa278f30 Don't assume VSCode internal commands in the server 2023-02-14 14:45:48 +01:00
bors
8011029d3a Auto merge of #13975 - DropDemBits:on-enter-after-dot-chains, r=DropDemBits
fix: Suppress extra indent after the end of field and function chains

(spurred on by <https://github.com/rust-lang/rust-analyzer/issues/4182#issuecomment-671275652>)

Caveat that this doesn't work for after tail expressions, although there shouldn't be anything after those anyways.

This also complicates when to reload the language configuration by nature of now always having a language configuration applicable.

Examples of indentation fixes:

```rs
fn main() {
    println!("Hello!"); // < enter here!
    // ... indents down here

    fs::read_to_string("soup") // < enter here!
    // ... still indents down here :(
        .map(|_| ())
        .map(|_| ()) // < enter here!
        // ... still indents down here :D
        .map_err(|_| ())
        .unwrap(); // < enter here!
    // ... indents down here :D

    // ... and subsequent enters stay at the same indent

    0.0f64
        .to_radians()
        .to_radians()
        .to_radians() // force semi on a new line
        ; // < enter here!
    // ... indents down here :D
}

fn tail_end() -> i32 {
    0i32.wrapping_abs()
        .wrapping_abs()
        .wrapping_abs()
        .wrapping_abs() // < enter here!
        // ... still indents here 🤷
}
```
2023-02-10 20:10:54 +00:00
DropDemBits
c7bd3c682f
Always reload onEnter configuration
Configuration reload doesn't happen often anyway,
and there will always be a set of onEnter rules to load
2023-02-10 14:55:17 -05:00
Jonas Schievink
5b1187a046 Remove some types ¯\_(ツ)_/¯ 2023-01-31 15:49:39 +01:00
Jonas Schievink
56f81ebc3e Lazily create the trace output channel 2023-01-31 15:43:47 +01:00
Lukas Wirth
e6ad8a2edc fix: config substitution failing extension activation 2023-01-25 09:17:49 +01:00
Lukas Wirth
ec9476015c Substitute VSCode variables more generally 2023-01-24 13:46:56 +01:00
Lukas Wirth
64110714f0 🧹 lsp_ext.ts 2023-01-23 16:58:35 +01:00
Lukas Wirth
b9fe5afb30 Add a 'open server logs' button to the error notification 2023-01-23 13:24:42 +01:00
OmarTawfik
7198cd04ac allow using vscode variables in config.serverPath 2023-01-20 13:22:11 -08:00
DropDemBits
992bafa773
Fix change detection for relevant lang config opts 2023-01-17 16:41:33 -05:00
DropDemBits
1c454736a4
Suppress extra indent after the end of dot chains 2023-01-17 15:29:52 -05:00
Lukas Wirth
4267b11c40
Revert "Use ZWNJ to prevent VSCode from forming ligatures between hints and code" 2023-01-10 09:43:08 +01:00
Ian Chamberlain
65cf7abbe2
Use experimental capability to enable color codes 2023-01-09 11:50:35 -05:00
Ian Chamberlain
738ce83d85
Strip colors before matching preview diagnostics 2023-01-09 11:49:59 -05:00
Ian Chamberlain
1b8141b54c
Parse + decorate rendered ANSI cargo output
Use ANSI control characters to display text decorations matching the
VScode terminal theme, and strip them out when providing text content
for rustc diagnostics.

This adds the small `anser` library to parse the control codes, and it
also supports HTML output so it should be fairly easy to switch to a
rendered HTML/webview implementation if desired.
2023-01-09 11:46:29 -05:00
Lukas Wirth
c4d8cf1dad Use ZWNJ to prevent VSCode from forming ligatures between hints and code 2023-01-03 12:32:38 +01:00
Alex Veber
ddc0147d53 Fix diagnostic code 2023-01-03 08:33:27 +02:00
Lukas Wirth
cf8d89e46b Add a command to clear flycheck diagnostics 2022-12-17 23:43:26 +01:00
Lukas Wirth
d8ddde27f9 Make cancelFlycheck request a notification 2022-12-17 23:29:31 +01:00
Lukas Wirth
a04feb915a Add command for manually running flychecks 2022-12-16 22:47:19 +01:00
Maria José Solano
8661740626 Use typed notification method 2022-11-27 09:46:37 -08:00
Lukas Wirth
073a63b93e feat: Allow viewing the full compiler diagnostic in a readonly textview 2022-11-18 19:56:08 +01:00
Lukas Wirth
fccf8eb1fd Properly handle vscode workspace changes 2022-10-29 01:41:02 +02:00
Lukas Wirth
2071d00fd2 Always set up VSCode commands 2022-10-29 00:44:37 +02:00
Lukas Wirth
274df54885 feat: Clicking the status bar item stops and starts the server 2022-10-28 23:10:10 +02:00
bors
8ee23f4f0a Auto merge of #13453 - Veykril:disabled-commands, r=Veykril
internal: Properly handle commands in the VSCode client when the server is stopped
2022-10-21 14:05:25 +00:00
Lukas Wirth
1cb46079e4 internal: Properly handle commands in the VSCode client when the server is stopped 2022-10-21 16:00:43 +02:00
bors
69f01fdff5 Auto merge of #13451 - Veykril:lang-config, r=Veykril
internal: Properly handle language configuration config changes
2022-10-20 19:15:30 +00:00
Lukas Wirth
a8e0a20ce4 internal: Properly handle language configuration config changes 2022-10-20 21:14:36 +02:00
Yotam Ofek
e05df93b8e Workaround the python vscode extension's polyfill 2022-10-20 17:56:51 +00:00
Lukas Wirth
69b845674c Don't catch the server activation error 2022-10-20 11:32:02 +02:00
Lukas Wirth
d63c44e650 Cleanup output channels 2022-10-17 16:01:39 +02:00
Lukas Wirth
0421756b42 Implement stop and start server commands 2022-10-17 15:45:57 +02:00
Lukas Wirth
d68616a140 Make more things private 2022-10-17 15:05:20 +02:00
Lukas Wirth
8aaafddee8 Properly reload changed configs for server start 2022-10-17 14:53:46 +02:00
Lukas Wirth
6f435977df Refactor language client handling 2022-10-17 14:21:12 +02:00
Lukas Wirth
d5f467aa4a Substitute some VSCode variables in the VSCode client 2022-10-16 19:45:08 +02:00
bors
c09151c619 Auto merge of #13402 - HKalbasi:patch-1, r=Veykril
Cast runnableEnv items to string

fix #13390

An alternative approach could be raising an error if there is non string values.
2022-10-16 09:20:38 +00:00
Jonas Schievink
55fdcbe339
Revert "fix: in VSCode, correctly resolve relative paths to errors" 2022-10-14 09:28:44 +02:00
HKalbasi
58e5452a9b
fix formatting 2022-10-12 14:14:59 -07:00
HKalbasi
983ae1b1c9
Cast runnableEnv items to string 2022-10-12 20:40:49 +03:30
Aleksey Kladov
5bbfea03cc fix: in VSCode, correctly resolve relative paths to errors
VS Code problem matcher are restricted to be static "regexes". You can't
create a problem matcher dynamically, and you can't use custom code in
lieu of problem matcher.

This creates a problem for rust/cargo compiler errors. They use paths
relative to the root of the Cargo workspace, but VS Code doesn't
necessary know where that root is.

Luckily, there's a way out: our current problem matcher is defined like
this:

    "fileLocation": [ "autoDetect", "${workspaceRoot}" ],

That means that relative pahts would be resoleved relative to workspace
root. VS Code allows to specify a command inside `${}`. So we can plug
custom logic there to fetch Cargo's workspace root!

And that's exactly what this PR is doing!
2022-10-08 23:25:13 +01:00
Lukas Wirth
9c97997af9 Remove the toggleInlayHints command from VSCode
Inlay hints are no longer something specifc to r-a as it has been
upstreamed into the LSP, we don't have a reason to give the config
for this feature special treatment in regards to toggling. There are
plenty of other options out there in the VSCode marketplace to create
toggle commands/hotkeys for configurations in general which I believe
we should nudge people towards instead.
2022-09-10 11:50:55 +02:00
bors
e8e598f641 Auto merge of #13133 - Veykril:diag-hack, r=Veykril
Move empty diagnostics workaround back into the server

This only touches on the diagnostics in one place instead of multiple as was previously done, since all published diagnostics will go through this code path anyways.

Closes https://github.com/rust-lang/rust-analyzer/issues/13130
2022-08-28 09:56:06 +00:00
Lukas Wirth
9ad0a8c467 Move empty diagnostics workaround back into the server 2022-08-28 11:54:46 +02:00
bors
6bea872edd Auto merge of #13095 - jonas-schievink:avoid-liveshare-error, r=jonas-schievink
fix: Avoid error popup when using in Live Share

cc https://github.com/rust-lang/rust-analyzer/issues/8844

Not sure if there's a better way to do this, feedback appreciated!
2022-08-26 18:39:53 +00:00
bors
55bf51df41 Auto merge of #13087 - Veykril:config-update, r=Veykril
Remove auto-config patching from the VSCode client

This was introduced 4 months ago when we drastically changed the config keys. I'd like to remove this given I always felt uneasy doing edits to a users config from within r-a, and by now most if not all users should've swapped to a new enough version of r-a that should've updated their configs.

The extension will continue to work fine even with the outdated keys afterwards since we still do patching server side as well, and that one we'll have to support for quite some more time (if not until a proper 1.0 release where I assume we can allow ourselves some more user facing breakage)

(There also might've been a small bug in here that prevented users with certain outdated keys to prevent them from enabling certain keys for some reason)
2022-08-26 16:22:57 +00:00
Laurențiu Nicola
10617938b1 Remove unused UpdatesChannel type 2022-08-25 21:33:42 +03:00