Commit graph

1864 commits

Author SHA1 Message Date
bors
3f4c6dac3d Auto merge of #16372 - davidsemakula:import-granularity-one, r=Veykril
feat: Add "One" import granularity

Adds a new import granularity option "One" that merges all imports into a single use statement as long as they have the same visibility and attributes.

This is similar to [rustfmt's `imports_granularity = "One"`](https://rust-lang.github.io/rustfmt/?version=v1.6.0&search=import#imports_granularity).

Fixes: #11361
2024-01-18 15:40:12 +00:00
Ali Bektas
21020919e3 v2 2024-01-18 12:09:23 +01:00
Ali Bektas
9bd9a17ce5 Add a new config to allow renaming of non-local items
With #15656 we started disallowing renaming of non-local items.
Although this makes sense there are some false positives that
impacted users' workflows. So this config aims to mitigate this
by giving users the liberty to disable this feature.
2024-01-18 00:26:22 +01:00
davidsemakula
4f176b3f7f update import granularity config and docs 2024-01-18 01:44:57 +03:00
Lukas Wirth
c7eb52dd7b internal: Add unstable config for loading the sysroot sources via cargo metadata 2024-01-15 09:59:32 +01:00
dependabot[bot]
3926ff5d20
Bump follow-redirects from 1.15.2 to 1.15.4 in /editors/code
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.2...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-09 08:49:11 +00:00
riverbl
3c378b9c70 Add inlay hint for exclusive ranges
Adds an inlay hint containing a '<' character to exclusive range expressions and patterns that specify an upper bound.
2024-01-07 09:33:56 +00:00
Lukas Wirth
3fc043ce9b internal: Remove unnecessary Arc allocations in macro_expand 2024-01-03 15:21:18 +01:00
bors
9f46ff501d Auto merge of #16062 - davidbarsky:david/fix-references-to-removed-settings, r=Veykril
fix: Correct references from `rust-analyzer.cargo.check` to `rust-analyzer.check`

When reading the manual, I noticed that the documentation referenced configurations that have since been renamed. This PR updates those references to their new names.
2024-01-02 09:57:48 +00:00
bors
f1de7d7273 Auto merge of #16011 - ClSlaid:feat/settings/proc-macro/rebuild-on-save, r=Veykril
feat: add proc-macro rebuild on save option

Related: #15033

I need some advice on how to test it.
2024-01-02 09:46:21 +00:00
cui fliter
638df27f99 Fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-12-29 11:50:24 +08:00
bors
3ab1666370 Auto merge of #16096 - LuisFerLCC:master, r=lnicola
fix: update VSCode rust-panic problem matcher

Corrected the `rust-panic` task problem matcher for the VSCode Extension to match the new panic message pattern.

From:
```
thread 'main' panicked at 'PANIC_MESSAGE', src/main.rs:L:C
```
To:
```
thread 'main' panicked at src/main.rs:L:C:
PANIC_MESSAGE
```
2023-12-27 13:51:54 +00:00
bors
831d0e01b3 Auto merge of #16162 - sanjaiyan-dev:sanjaiyan-async-concurrent, r=lnicola
minor: Optimizing Performance with `Promise.all` 🏎

Hello,

This pull request introduces a modest performance improvement by executing asynchronous tasks using `Promise.all`, thereby enhancing the efficient utilization of hardware resources.

Thank you for considering this enhancement.

Ref-: https://github.com/rust-lang/rust/pull/119108
2023-12-19 09:31:34 +00:00
Laurențiu Nicola
f178a8becd Bump test-electron 2023-12-19 10:32:56 +02:00
Sanjaiyan Parthipan
f587b54340
perf: Run async task in concurrent 2023-12-19 13:16:55 +05:30
LuisFerLCC
054272381d
Formatting 2023-12-11 22:08:23 -06:00
LuisFerLCC
7251b86cb4
VSCode rust-panic problem matcher 2023-12-11 21:52:23 -06:00
David Barsky
f556c79db8 fix: Correct references from rust-analyzer.cargo.check to rust-analyzer.check 2023-12-08 14:26:58 -05:00
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
蔡略
ad27b6e053 patch: only rerun build scripts when saved.
Signed-off-by: 蔡略 <cailue@bupt.edu.cn>
2023-12-08 11:31:56 +08:00
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
Mine Starks
ec3f35bf63 Show placeholder while run command gets runnables from server 2023-11-14 14:39:17 -08: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