Commit Graph

1843 Commits

Author SHA1 Message Date
Laurențiu Nicola
9dc38214c0 Fix runnable cwd on Windows 2023-12-05 13:09:01 +02:00
bors
6e6a0b0a3d Auto merge of #16000 - HKalbasi:drop-inlay-hint, r=HKalbasi
Initial support for implicit drop inlay hint

cc #15785
2023-12-01 13:36:08 +00:00
hkalbasi
4d55cac466 Initial support for implicit drop inlay hint 2023-12-01 16:16:46 +03:30
meowtec
4ca86edac9 Debug use cargo workspace root as cwd. fixes #13022 2023-11-30 19:21:59 +08:00
bors
fec3828c5f Auto merge of #15846 - jprochazk:disable-error-notification, r=Veykril
editor/code: add option to suppress error notifications

Fixes https://github.com/rust-lang/rust-analyzer/issues/14193

- Added the `rust-analyzer.showRequestFailedErrorNotification` configuration option, which defaults to `true`
- If `rust-analyzer.showRequestFailedErrorNotification` is set to `true`, the current behavior is preserved.
- If `rust-analyzer.showRequestFailedErrorNotification` is set to `false`, no error toasts will be displayed for any of the failed requests caused by panics in r-a. This _only_ applies to events that are triggered "implicitly", such as `textDocument/hover`.

To test this, you can manually introduce a panic in one of the language server LSP handlers for non-command events. I added an explicit `panic!()` in the `textDocument/hover` event handler:

#### `rust-analyzer.showRequestFailedErrorNotification` set to `true` (default)

[2023-11-07 17-17-48.webm](https://github.com/rust-lang/rust-analyzer/assets/1665677/d0408ab8-79d1-42cf-a4e7-94e99d9783ec)

#### `rust-analyzer.showRequestFailedErrorNotification` set to `false`

[2023-11-07 17-16-49.webm](https://github.com/rust-lang/rust-analyzer/assets/1665677/0496d8d0-fb53-4bc6-a279-1a47f412dbdb)
2023-11-24 14:06:07 +00:00
David Barsky
0cd68bfed3 code: expose workspaces to other extensions; remove addProject command 2023-11-16 12:38:15 -05:00
bors
bae9c084e9 Auto merge of #15904 - davidbarsky:davidbarsky/bump-minimum-vscode-version-to-1.78, r=lnicola
editor/code: bump minimum version of VS Code to 1.78

Undoes https://github.com/rust-lang/rust-analyzer/pull/15333.
2023-11-15 15:34:26 +00:00
David Barsky
df7fa7f680 editor/code: bump minimum version of VS Code to 1.78 2023-11-15 10:32:40 -05:00
Laurențiu Nicola
8e8e7de93b Tweak tsconfig.json 2023-11-15 17:08:39 +02:00
Jan Procházka
9c8727eea5
Update editors/code/package.json
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2023-11-15 12:41:54 +01:00
jprochazk
0d147b382f detect internal error via error.code instead of error message 2023-11-15 12:36:08 +01:00
Lukas Wirth
d6b908ec41 Fix import preference config keys 2023-11-12 17:48:40 +01:00
bors
1152f593b3 Auto merge of #15870 - lnicola:expand-macro, r=lnicola
minor: Make "Expand macro" command title more explicit

Closes [#15856](https://github.com/rust-lang/rust-analyzer/issues/15856).

I opted for "caret", since it's the better term (cursor is the mouse), but I'm not sure how popular it is these days.
2023-11-12 13:48:43 +00:00
Laurențiu Nicola
cace36cade Make Expand macro command title more explicit 2023-11-12 11:43:46 +02:00
Lukas Wirth
ba61766217 Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
jprochazk
c566136854 add configuration option 2023-11-07 16:33:45 +01:00
Peter Tripp
fccdde63c9
Maybe not a linter. 2023-11-02 18:21:31 -04:00
Peter Tripp
1b7bb9a7bd
VSCode search: 'category:formatters rust' metadata. 2023-11-02 15:54:32 -04:00
jprochazk
3e4de963a2 override language client 2023-10-28 16:34:00 +02:00
Lukas Wirth
4296fe52ba Add command for only opening external docs and attempt to fix vscode-remote issue 2023-10-18 14:06:07 +02:00
bors
8a2331450a Auto merge of #15728 - EliasHolzmann:feature/local_documentation_vscode, r=Veykril
feat: vscode: Support opening local documentation if available

This PR implements the VS code support for opening local documentation (server side support was already implemented in #14662).

[local_docs.webm](https://github.com/rust-lang/rust-analyzer/assets/9659253/715b84dd-4f14-4ba0-a904-749b847eb3d5)

Displaying local instead of web docs can have many benefits:
- the web version may have different features enabled than locally selected
- the standard library may be a different version than is available online
- the user may not be online and therefore cannot access the web documentation
- the documentation may not be available online at all, for example because it is for a new feature in a library the user is currently developing

If the documentation is not available locally, the extension still falls back to the web version.

Closes #12867.

-----

If my implementation isn't really idiomatic TypeScript: Sorry, I'm not much of a TypeScript developer. I am open to feedback, however.
2023-10-10 06:33:10 +00:00
Elias Holzmann
e8372e0484 vscode: Support opening local documentation if available
Displaying local instead of web docs can have many benefits:
- the web version may have different features enabled than locally selected
- the standard library may be a different version than is available online
- the user may not be online and therefore cannot access the web documentation
- the documentation may not be available online at all, for example because it
  is for a new feature in a library the user is currently developing

If the documentation is not available locally, the extension still falls back to
the web version.
2023-10-09 20:11:53 +02:00
Victor Song
a39d2076db Addressed PR style comments 2023-10-09 02:15:05 -05:00
Victor Song
ef0b3bbef1 Clarify documentation on new parameter 2023-10-09 02:15:05 -05:00
Victor Song
aeef7b644b Add config option to use rust-analyzer specific target dir
Adds a Rust Analyzer configuration option to set a custom
target directory for builds. This is a workaround for Rust Analyzer
blocking debug builds while running `cargo check`. This change
should close #6007
2023-10-09 02:15:05 -05:00
Elias Holzmann
3dfc1bfc67 Use vscode.env.openExternal instead of the vscode.open command for docs
According to the VS Code documentation, the vscode.open command opens the URL
_in the editor_ (https://code.visualstudio.com/api/references/commands).
However, in reality, it seems to do so only for file:// URLs, falling back to
other applications for other URL schemes (at least for HTTP/HTTPS).

Until now, the URL to the documentation was always HTTP based, so using the
vscode.open command was perfectly fine. However, displaying local documentation
will be supported from now on (see next commit). Local documentation is not
HTTP-based, but instead addressed via a file:// URL. The file URL would
therefore be opened in VS Code instead of in the browser — this is definitely
not what the user wants.

Therefore, the vscode.env.openExternal function is used instead, this function
never opens the URL in VS Code.
2023-10-08 04:56:48 +02:00
bors
54866a0df7 Auto merge of #15668 - connorskees:feat/close-backtick, r=Veykril
feat: add backtick to surrounding and auto-closing pairs

Makes backticks always complete as a pair and also surround the current selection, similar to double quotes. This is useful primarily in the context of markdown doc comments, but is applied globally for simplicity.

Closes https://github.com/rust-lang/rust-analyzer/issues/11381
2023-10-05 22:08:15 +00:00
bors
b57658d9a9 Auto merge of #15707 - dfireBird:default-statusbar-action-config, r=lnicola
Add configuration for the default action of the status bar click action in VSCode

Fixes #15441

Please suggest any changes if necessary.
2023-10-04 17:31:44 +00:00
dfireBird
ab091b73d0
Add config for the default click action of extension status bar 2023-10-04 21:07:50 +05:30
Martin Nordholts
dd8ea977b7 vscode: Fix line and col regexp for problem matcher
When building the Rust compiler with `./x check` from within VS Code,
the current `rustc` problem matcher thinks that the output from that
command that looks like this:

    Build completed successfully in 0:00:26

is about a problem in a file named `0` on line 00, col 26. This wouldn't
be so bad if it wasn't for that VS Code tends to get stuck on this
problem because of problems with opening the file '0'.

The rust compiler will never output problems with a line or a column
that starts with 0, so change the regexp to require lines and cols to
begin with [1-9] to fix this problem.
2023-09-29 17:46:58 +02:00
Alex Veber
5b04a7d338
Update editors/code/package.json
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2023-09-27 18:33:22 +03:00
Alex Veber
6c907e1e20
Improve useRustcErrorCode description 2023-09-27 02:19:50 +03:00
Connor Skees
6ca48d98c4 feat: add backtick to surrounding and auto-closing pairs 2023-09-26 06:36:37 +00:00
bors
e5e937ae5e Auto merge of #15582 - vxpm:master, r=HKalbasi
add option to show full function signatures in completion docs

implements #15538

with `"rust-analyzer.completion.fullFunctionSignatures.enable": false`:
![image](https://github.com/rust-lang/rust-analyzer/assets/59714841/ff739ad1-9975-461f-a62d-22c7823e7b71)

with `"rust-analyzer.completion.fullFunctionSignatures.enable": true`:
![image](https://github.com/rust-lang/rust-analyzer/assets/59714841/9bc98300-cef6-44ef-a353-dcf35cd36fce)
2023-09-24 07:38:38 +00:00
bors
2b580a1f3c Auto merge of #15492 - RalfJung:invocation, r=Veykril
extend check.overrideCommand and buildScripts.overrideCommand docs

Extend check.overrideCommand and buildScripts.overrideCommand docs regarding invocation strategy and location.

However something still seems a bit odd -- the docs for `invocationStrategy`/`invocationLocation` talk about "workspaces", but the setting that controls which workspaces are considered is called `linkedProjects`. Is a project the same as a workspace here or is there some subtle difference?
2023-09-22 16:09:01 +00:00
Lukas Wirth
ba7f2bfb85 Update config docs 2023-09-22 17:46:17 +02:00
vxpm
6b487ed4be fix & run tests 2023-09-08 22:03:42 -03:00
David Barsky
6260c635ee fmt 2023-09-05 15:45:52 -04:00
David Barsky
68781aeab0 fix some more lints 2023-09-05 12:38:33 -04:00
David Barsky
1ee7f54fa6 fix lints 2023-09-05 12:38:33 -04:00
David Barsky
b1b044f2d5 code: yeet rust-analyzer.discoverProjectCommand 2023-09-05 12:38:33 -04:00
Ralf Jung
887cc48ba8 fix help text for rust-analyzer.check.invocation{Strategy,Location} 2023-08-21 09:54:24 +02:00
bors
d548146c30 Auto merge of #15420 - Wilfred:discover_command_max_buffer, r=Veykril
Increase the buffer size for discover project command

The default value for maxBuffer is 1 MiB[1]. If the discover project command returns stdout or stderr that is greater than 1 MiB, the extension would error with "RangeError: stderr maxBuffer length exceeded".

Set the default value for maxBuffer to 10 MiB for project discovery.

[1] https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback
2023-08-15 12:13:12 +00:00
Lukas Wirth
e76d20e072 Add status bar button to toggle check on save state 2023-08-15 11:39:53 +02:00
Lukas Wirth
33f9250d21 Pass server extraEnv to isValidExecutable 2023-08-12 07:10:20 +02:00
Wilfred Hughes
0ef541e535 Increase the buffer size for discover project command
The default value for maxBuffer is 1 MiB[1]. If the discover project
command returns stdout or stderr that is greater than 1 MiB, the
extension would error with "RangeError: stderr maxBuffer length
exceeded".

Set the default value for maxBuffer to 10 MiB for project discovery.

[1] https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback
2023-08-10 12:28:50 -07:00
bors
e13fac379e Auto merge of #15262 - adamse:master, r=HKalbasi
add check.ignore to list cargo check diagnostics to ignore (dead_code, unused_imports, ...)

fixes #14798
2023-08-08 18:49:45 +00:00
Adam Sandberg Ericsson
9cb1f45e6f add check.ignore to list cargo check diagnostics to ignore (dead_code, unused_imports, ...)
fixes #14798
2023-08-08 14:28:35 +02:00
bors
eed86c0d98 Auto merge of #15392 - Wilfred:stopped_color, r=lnicola
Use the warning color when rust-analyzer is stopped

If the rust-analyzer server isn't running, we can't do much. Treat this state as a warning color, so it's more obvious.
2023-08-05 12:20:39 +00:00
Wilfred Hughes
253d68459d Use the warning color when rust-analyzer is stopped
If the rust-analyzer server isn't running, we can't do much. Treat
this state as a warning color, so it's more obvious.
2023-08-04 11:07:22 -07:00