Commit Graph

1112 Commits

Author SHA1 Message Date
Laurențiu Nicola
a01e4f8b72 Add basic support for Native Debug 2024-02-29 16:14:58 +02:00
DropDemBits
bcf14e27ce
Work around snippet edits doubling up extra indentation
We can't tell vscode to not add in the extra indentation, so we instead opt to remove it from the edits themselves, and then let vscode add it back in.
2024-02-15 18:39:17 -05:00
DropDemBits
d846586bc9
fix: Support multiple tab stops in completions in VSCode
Uses the native VSCode support for `SnippetTextEdit`s, but in a semi-hacky way as it's not fully supported yet.
2024-02-15 18:13:04 -05:00
bors
113f054274 Auto merge of #16558 - Wilfred:json_project_ts, r=lnicola
Update JsonProject to include optional fields

These were documented in #15014 in the manual, but this definition wasn't updated to match.
2024-02-14 06:24:56 +00:00
Wilfred Hughes
931f563a89 Update JsonProject to include optional fields
These were documented in #15014 in the manual, but this definition
wasn't updated to match.
2024-02-13 14:29:20 -08:00
David Barsky
6330b028b3 feature: Add a UnindexedProject notification and a corresponding setting. 2024-02-08 14:23:00 -05:00
Young-Flash
bec1e0f616 minor: polish warning msg 2024-02-04 18:37:09 +08:00
Young-Flash
4facb6253e minor: update warning msg 2024-01-30 20:33:15 +08:00
Young-Flash
96ebad0409 minor: update conflict extension detect logic 2024-01-26 20:12:13 +08:00
Young-Flash
56f54c87e7 fix lint and fmt 2024-01-22 19:33:26 +08:00
Young-Flash
e15f40e842 feat: add conflict ext (panicbit.cargo) detect 2024-01-22 18:49:39 +08:00
Lukas Wirth
3fc043ce9b internal: Remove unnecessary Arc allocations in macro_expand 2024-01-03 15:21:18 +01:00
cui fliter
638df27f99 Fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-12-29 11:50:24 +08:00
Sanjaiyan Parthipan
f587b54340
perf: Run async task in concurrent 2023-12-19 13:16:55 +05:30
bors
c27fc0c945 Auto merge of #15896 - minestarks:run-quickpick, r=Veykril
Show placeholder while run command gets runnables from server

This PR fixes a UI annoyance in the VS Code extension when working in large codebases where rust-analyzer can take a few moments to interact with the server. Scenario:

1. Invoke "rust-analyzer: Run" from the command palette or hotkey
2. Quickly start typing to filter the list (or press Enter to accept the last runnable)

We often do this quickly from muscle memory without waiting to see the picker. The picker often takes several seconds to come up, causing us to type garbage into the currently open editor.

Fix:

Show a placeholder item before we call out to the server.

![image](https://github.com/rust-lang/rust-analyzer/assets/16928427/09de6a1c-6f3c-4d29-8031-ba4baeb43282)

Selecting this item does nothing so if the user accidentally hits Enter nothing happens.

The list is populated and the placeholder dismissed when the actual runnables are retrieved. From here the behavior is the same as before.

![image](https://github.com/rust-lang/rust-analyzer/assets/16928427/837c7dfc-c060-4d68-bbf6-df8aa3101b78)
2023-12-08 10:00:37 +00:00
Laurențiu Nicola
9dc38214c0 Fix runnable cwd on Windows 2023-12-05 13:09:01 +02:00
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
jprochazk
0d147b382f detect internal error via error.code instead of error message 2023-11-15 12:36:08 +01:00
Mine Starks
ec3f35bf63 Show placeholder while run command gets runnables from server 2023-11-14 14:39:17 -08:00
jprochazk
c566136854 add configuration option 2023-11-07 16:33:45 +01: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
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
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
dfireBird
ab091b73d0
Add config for the default click action of extension status bar 2023-10-04 21:07:50 +05:30
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
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
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
Wilfred Hughes
1e76b11a20 Set the default status bar action to openLogs
Previously, clicking 'rust-analyzer' would stop the server
entirely. This was easy to do accidentally, and then the user has to
wait for the server to start up again.
2023-08-04 11:03:41 -07:00
Lukas Wirth
bd6ec06237 Write proc-macro server spawn errors to the status text 2023-07-30 14:38:25 +02:00
bors
bc1b0bfa7f Auto merge of #15308 - vsrs:runnable_env_per_platform, r=HKalbasi
Runnable env per platform

This PR adds an option to specify runnables `env` per platform (win32, linux, etc.):
```
{
    "rust-analyzer.runnables.extraEnv": [
            {
                "platform": "win32",
                "env": {
                    "SCITER_BIN_FOLDER": "C:\\Projects\\3rd\\sciter-js-sdk\\bin\\windows\\x64",
                }
            },
            {
                "platform":["linux","darwin"],
                "env": {
                    "SCITER_BIN_FOLDER": "/home/vit/Projects/sciter/sciter-js-sdk/bin/linux/x64",
                }
            }
        ]
}
```
2023-07-28 07:03:09 +00:00
igorskyflyer
5d67cbea43 Use notification command links for debugger installation 2023-07-20 15:41:08 +02:00
vsrs
08b3b2a56d Fix lint 2023-07-18 18:06:20 +07:00
vsrs
3468b093bd Platform specific runnables env 2023-07-18 17:51:57 +07:00
Tetsuharu Ohzeki
f7823f3106 editor/code: Re-apply code format 2023-07-13 22:44:29 +09:00
Tetsuharu Ohzeki
445b4fc27f editor/code: Sort the style to import types
see:
- https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/consistent-type-imports.md
- https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-import-type-side-effects.md
2023-07-11 06:12:00 +09:00
Tetsuharu Ohzeki
444bc5b3ba editor/code: Enable TypeScript's --useUnknownInCatchVariables option
see: https://www.typescriptlang.org/tsconfig#useUnknownInCatchVariables
2023-07-10 23:13:36 +09:00
Tetsuharu Ohzeki
a66b7e3eba editor/code: Remove unused sendRequestWithRetry 2023-07-10 23:13:36 +09:00
Tetsuharu Ohzeki
fd31006646 editor/code: Assert types in catch in sendRequestWithRetry() properly 2023-07-10 23:13:36 +09:00
Adenine
1dd54eb44a change viewMemoryLayoutParams to be textPositionParams 2023-07-08 12:25:54 -04:00
Adenine
4d5c66986e cleanup + docs + tests 2023-07-07 23:12:09 -04:00