Commit Graph

1653 Commits

Author SHA1 Message Date
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
5424c51158 Add config for supplying sysroot path 2022-10-01 21:17:06 +02:00
Lukas Wirth
a6c067c06d Simplify 2022-09-19 17:31:08 +02:00
bors
11bf2e7ffb Auto merge of #13058 - dpaoliello:extraenv, r=Veykril
Add a new configuration settings to set env vars when running cargo, rustc, etc. commands: cargo.extraEnv and checkOnSave.extraEnv

It can be extremely useful to be able to set environment variables when rust-analyzer is running various cargo or rustc commands (such as `cargo check`, `cargo --print cfg` or `cargo metadata`): users may want to set custom `RUSTFLAGS`, change `PATH` to use a custom toolchain or set a different `CARGO_HOME`.

There is the existing `server.extraEnv` setting that allows env vars to be set when the rust-analyzer server is launched, but using this as the recommended mechanism to also configure cargo/rust has some drawbacks:
- It convolutes configuring the rust-analyzer server with configuring cargo/rustc (one may want to change the `PATH` for cargo/rustc without affecting the rust-analyzer server).
- The name `server.extraEnv` doesn't indicate that cargo/rustc will be affected but renaming it to `cargo.extraEnv` doesn't indicate that the rust-analyzer server would be affected.
- To make the setting useful, it needs to be dynamically reloaded without requiring that the entire extension is reloaded. It might be possible to do this, but it would require the client communicating to the server what the overwritten env vars were at first launch, which isn't easy to do.

This change adds two new configuration settings: `cargo.extraEnv` and `checkOnSave.extraEnv` that can be used to change the environment for the rust-analyzer server after launch (thus affecting any process that rust-analyzer invokes) and the `cargo check` command respectively. `cargo.extraEnv` supports dynamic changes by keeping track of the pre-change values of environment variables, thus it can undo changes made previously before applying the new configuration (and then requesting a workspace reload).
2022-09-18 17:43:46 +00:00
Daniel Paoliello
c407cc554e Add cargo.extraEnv setting 2022-09-13 11:29:14 -07:00
bors
dbb8fedf8b Auto merge of #13221 - mdx97:mdx97/annotations-above-whole-item, r=Veykril
Allow configuration of annotation location.

I've added the ability to configure where lens annotations render relevant to the item they describe. Previously, these would render directly above the line the item is declared on. Now, there is the ability to render these annotations above the entire item (including doc comments, and attributes).

The names of the config options are up for debate, I did what seemed best to me but if anyone has better ideas let me know.

This is my first contribution so if I've missed anything please let me know.

Here's a preview of what the new option looks like:

<img width="577" alt="Screen Shot 2022-09-11 at 10 39 51 PM" src="https://user-images.githubusercontent.com/33100798/189570298-b4fcbf9c-ee49-4b79-aae6-1037ae4f26af.png">

closes https://github.com/rust-lang/rust-analyzer/issues/13218
2022-09-13 15:09:53 +00:00
Lukas Wirth
a8ecaa1979 Restructure find_path into a separate functions for modules and non-module items
Also renames `prefer_core` imports config to `prefer_no_std` and changes the behavior of no_std path searching by preferring `core` paths `over` alloc
2022-09-13 15:15:27 +02:00
Mathew Horner
f57c15f3e9 Address comments and fix build. 2022-09-12 16:34:13 -05:00
bors
b54d22d96a Auto merge of #13215 - Veykril:toggle-inlay, r=Veykril
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-12 13:45:25 +00:00
bors
e38dfe5536 Auto merge of #13186 - enomado:master, r=Veykril
Filter imports on find-all-references

Attempt to #13184
2022-09-12 12:09:57 +00:00
Mathew Horner
8a2803d9ae Allow configuration of annotation location.
Previously, annotations would only appear above the name of an item (function signature, struct declaration, etc).

Now, rust-analyzer can be configured to show annotations either above the name or above the whole item (including doc comments and attributes).
2022-09-11 22:40:33 -05: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
Lukas Wirth
7d19971666 Add config to unconditionally prefer core imports over std
Fixes https://github.com/rust-lang/rust-analyzer/issues/12979
2022-09-09 20:04:56 +02:00
Stanislav
f7f4792f4f fixes 2022-09-09 20:58:06 +03:00
Stanislav
773f9b38e3 fix. round 4 2022-09-09 01:19:34 +03:00
Stanislav
ab0b64b26c fix comment round 3 2022-09-08 22:55:04 +03:00
Stanislav
9f6553e1d6 add config for import filtering 2022-09-08 01:53:20 +03: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
Jonas Schievink
dcbbb7f211 ForGoT tO RuN prEttIeR¿ 2022-08-23 15:56:02 +02:00
Jonas Schievink
16a0eb1829 Avoid error popup when using in Live Share 2022-08-23 15:45:02 +02:00
Lukas Wirth
eadc2673c0 Regen docs 2022-08-23 14:05:56 +02:00
Lukas Wirth
b19f78b022 Remove auto-config patching from the VSCode client 2022-08-22 17:13:49 +02:00
Ralf Jung
4af9829dcf document interaction of checkOnSave.overrideCommand and multiple linked projects 2022-08-19 08:57:22 -04:00
Lukas Wirth
45b7b6a60a Implement lsp extension for cancelling running flychecks 2022-08-19 08:54:53 +02:00
bors
917bd68b37 Auto merge of #13039 - davidbarsky:davidbarsky/remove-used-nightly-checking-code, r=Veykril
chore: remove unused `currentExtensionIsNightly()` in `config.ts`

I was debugging an unrelated issue in rust-analyzer, but came across this unused code and figured that it's fine to send a fully red PR :)
2022-08-18 16:06:18 +00:00
Dezhi Wu
23747419ca fix: a bunch of typos
This PR will fix some typos detected by [typos].

There are also some other typos in the function names, variable names, and file
names, which I leave as they are. I'm more certain that typos in comments
should be fixed.

[typos]: https://github.com/crate-ci/typos
2022-08-17 21:44:58 +08:00
David Barsky
a0b257c9d9 chore: remove unused currentExtensionIsNightly() in config.ts 2022-08-16 13:38:50 -04:00
Jonas Schievink
7fb7c248c7 Add .enable suffix 2022-08-16 18:12:15 +02:00
Jonas Schievink
0616cee92b Add a setting for keyword hover popups 2022-08-16 16:51:40 +02:00
Jonas Schievink
dcbe892d7c Add an HIR pretty-printer 2022-08-15 13:51:45 +02:00
Lukas Wirth
614969baa7 Pad empty diagnostic messages in relatedInformation as well 2022-08-13 20:49:00 +02:00
Lukas Wirth
ec8256dd80 Move VSCode diagnostics workaroudn into client code 2022-08-13 20:30:30 +02:00
Laurențiu Nicola
19da03291d Upgrade npm lockfile 2022-08-12 18:22:14 +03:00
Jake Heinz
4b648d8f6c [code] make toggleInlayHints understand {off,on}UntilPressed 2022-08-08 02:32:49 +00:00
bors
4904b2bdf8 Auto merge of #12934 - Veykril:typing, r=Veykril
Add a setting to disable comment continuation in VSCode

Fixes https://github.com/rust-lang/rust-analyzer/issues/12928
2022-08-03 16:23:49 +00:00
Lukas Wirth
46d6357994 Add a setting to disable comment continuation in VSCode 2022-08-03 18:22:45 +02:00
Jonas Schievink
bd7dfac5eb Fix r-a spelling in some places 2022-08-01 13:47:09 +02:00
bors
fbb1337eb3 Auto merge of #12850 - Veykril:display-fix, r=Veykril
fix: Fix error tooltip message for VSCode status bar item
2022-07-22 22:52:53 +00:00
Lukas Wirth
e223d20d97 fix: Fix error tooltip message for VSCode status bar item 2022-07-23 00:52:12 +02:00
Lukas Wirth
f1b5e38563 Revert 03a62c180e 2022-07-23 00:14:34 +02:00
Jonas Schievink
ec1142c0d0 Improve file watcher config 2022-07-18 17:50:56 +02:00
Lukas Wirth
def89af1ef fix: Fix VSCode status bar tooltip not showing the error messages 2022-07-13 13:26:23 +02:00
Laurențiu Nicola
cb38145714 Bump transitive npm deps 2022-07-09 23:20:06 +03:00
Laurențiu Nicola
a059e79ccb Bump @vscode/test-electron 2022-07-09 23:17:56 +03:00
Laurențiu Nicola
358d6c6dcc Bump @types/node to 16 2022-07-09 23:17:12 +03:00
Laurențiu Nicola
2c9e39553c Bump typescript and tslib 2022-07-09 23:14:17 +03:00
Laurențiu Nicola
8e889ac3b5 Bump prettier 2022-07-09 23:10:39 +03:00
Laurențiu Nicola
d03ed83863 Bump @typescript-eslint 2022-07-09 23:10:07 +03:00
Laurențiu Nicola
0e38961046 Bump vsce 2022-07-09 23:08:59 +03:00
Laurențiu Nicola
7b1b711ecc Bump eslint 2022-07-09 23:07:31 +03:00
Laurențiu Nicola
1b138b11cf Bump esbuild 2022-07-09 23:06:45 +03:00
Laurențiu Nicola
b43708c930 Bump d3 and d3-graphviz 2022-07-09 23:06:06 +03:00
Laurențiu Nicola
03a62c180e Bump vscode-languageclient 2022-07-09 23:04:14 +03:00
Jonas Schievink
6c6ae965ba Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
Laurențiu Nicola
ad5a8514a0 Code: use different schemes for the custom views 2022-07-06 18:42:15 +03:00
Florian Diebold
5235732d82 Add back restartServerOnConfigChange option 2022-07-04 18:53:55 +02:00
Florian Diebold
ccf854bc2e Improve documentation for buildScripts.overrideCommand / checkOnSave.overrideCommand 2022-07-04 18:51:18 +02:00
Chayim Refael Friedman
979d9511a1 Ignore the bin artifact for bench targets
Just like `test`.
2022-06-29 14:16:55 +03:00
Laurențiu Nicola
21642a2d85 Try to publish releases to OpenVSX 2022-06-23 22:18:08 +03:00
bors
15c63c4119 Auto merge of #12541 - Veykril:vs-reload, r=Veykril
fix: Clear proc-macro changed flag when reloading workspace
2022-06-15 12:29:34 +00:00
Lukas Wirth
664a751f2b fix: Clear proc-macro changed flag when reloading workspace 2022-06-15 14:29:13 +02:00
Kevin Ushey
3cbbaf014e fix typo in package.json 2022-06-14 14:44:23 -07:00
Lukas Wirth
002447d6cb fix: Ask the user to reload the vscode window when changing server settings 2022-06-14 11:11:08 +02:00
Hasan Ali
213fe5755c Add restartServerOnConfigChange setting 2022-06-06 08:51:50 +01:00
Hasan Ali
92241d65ae Restart server automatically on settings changes 2022-06-05 21:36:42 +01:00
bors
995a17fbd9 Auto merge of #12472 - Veykril:output-ch, r=Veykril
internal: Keep output channels across restarts

cc https://github.com/rust-lang/rust-analyzer/pull/12470
2022-06-05 12:20:21 +00:00
Lukas Wirth
1127d2508f internal: Keep output channels across restarts 2022-06-05 14:20:06 +02:00
Lukas Wirth
2a8ea089bf fix: Restart the server instead of reloading the window when config changes 2022-06-05 13:29:08 +02:00
Lukas Wirth
fd298b3994 fix: Cleanup output channels when restarting server 2022-06-05 13:24:39 +02:00
Jake Heinz
a965161dce [editors/vscode] cleaer status bar bg color / command when server status returns to OK 2022-06-01 06:58:16 +00:00
Lukas Wirth
3e25c853cf fix: Fix VSCode config patching incorrectly patching some configs 2022-05-31 13:38:48 +02:00
harpsword
55509548e8 fix: add an option to show inlay hint for return type of closures without block 2022-05-28 22:12:30 +08:00
Hofer-Julian
2916cd2a86
Fix typo 2022-05-26 19:12:49 +02:00
Lukas Wirth
02c2377229 internal: Use statusBarItem colors for status item in VSCode 2022-05-26 12:31:07 +02:00
Lukas Wirth
f02c915eb5 internal: Make autoclosing angle brackets configurable, disabled by default 2022-05-25 12:42:07 +02:00
Jake Heinz
b8ee992b57 prettier 2022-05-24 03:11:30 +00:00
Jake Heinz
d1aa6d3216 vscode: fix extraEnv handling numeric values 2022-05-24 03:00:29 +00:00
Laurențiu Nicola
1e617f4fc6 Fix broken async callback in join lines 2022-05-21 18:38:10 +03:00
Jonas Schievink
c99a5ae312 Add "cargo clippy" task preset 2022-05-20 15:25:37 +02:00
andylizi
2b1c1a934c
feat: hide type inlay hints for initializations of closures 2022-05-20 17:42:56 +08:00
Equinox
7197042ac4 remove duplicate 'to' in cachePriming.numThreads option description 2022-05-20 02:05:48 +12:00
Andrei Listochkin
e87e1bc33d "Show implementations" link display error fix
While VSCode [uses it's own implementation for URIs](https://github.com/microsoft/vscode-uri)
which notably doesn't have any limits of URI size, the renderer itself
relies on Web platform engine, that limits the length of the URLs and
bails out when the attribute length of an `href` inside `a` tag is too
long.

Command URIs have a form of `command:command-name?arguments`, where
`arguments` is a percent-encoded array of data we want to pass along to
the command function. For "Show References" this is a list of all file
URIs with locations of every reference, and it can get quite long.

This PR introduces another intermediary `linkToCommand` command. When
we render a command link, a reference to a command with all its arguments
is stored in a map, and instead a `linkToCommand` link is rendered
with the key to that map.

For now the map is cleaned up periodically (I've set it to every
10 minutes). In general case we'll probably need to introduce TTLs or
flags to denote ephemeral links (like these in hover popups) and
persistent links and clean those separately. But for now simply keeping
the last few links in the map should be good enough. Likewise, we could
add code to remove a target command from the map after the link is
clicked, but assuming most links in hover sheets won't be clicked anyway
this code won't change the overall memory use much.

Closes #9926
2022-05-18 14:12:23 +01:00
Andrei Listochkin
00a97272f2 automate braceless return substitution for long lines
Per [bjorn3][https://github.com/bjorn3] suggestion resolves cases where
an early return is moved to a separate line due to line width formatting.

This setting changes
```
if (a very long condition) return;
```
to
```
if (a very long
    condition) {
  return;
}
```
while keeping
```
if (short) return;
```
as is.

In pathological cases this may cause `npm run fix` not to fix formatting
in one go and may require running it twice.
2022-05-17 18:31:51 +01:00
Andrei Listochkin
e0df2c9bee remove tsfmt from dependencies 2022-05-17 18:16:04 +01:00
Andrei Listochkin
f247090558 prettier run 2022-05-17 18:15:06 +01:00
Andrei Listochkin
8e9f54f238 use prettier to format the code 2022-05-17 18:14:28 +01:00
Andrei Listochkin
4fcdb0fea0 prettier config
[Prettier][1] is an up-to date code formatter for JavaScript ecosystem.

For settings we rely on [EditorConfig][2] for things like tab style and
size (with added bonus that the code editor with an EditorConfig plugin
does some automated code formatting on file save for you). Unfortunately,
Prettier's Glob handling isn't great:
 1. `*.{ts,js,json}` has no effect
 2. Similarly, in a list of globs `*.ts,*.js,*.json` only the first glob
has an effect, the rest are ignored.
That's why the file looks the way it does.

The only other setting we change is line width. [Lukas][3] suggested we
use 100 instead of 80, because that's what Rustfmt is using.

[1]: https://prettier.io
[2]: https://editorconfig.org
[3]: https://github.com/Veykril
2022-05-17 18:12:49 +01:00
Jonas Schievink
21b6ce8b8e Bump extension version 2022-05-17 16:02:07 +02:00
Lukas Wirth
d43b9dae56
Fix incorrect config key in client config update
Closes https://github.com/rust-lang/rust-analyzer/issues/12288
2022-05-17 14:56:08 +02:00
Jonas Schievink
867a7dc7a0 Show inlay hints after a } to indicate the closed item 2022-05-16 14:55:47 +02:00
bors
1dc25e51a0 Auto merge of #12253 - Veykril:bm, r=Veykril
feat: Add binding mode inlay hints

![image](https://user-images.githubusercontent.com/3757771/168427387-2f299438-a0cc-496b-a9a5-d689ef6a2b55.png)
2022-05-16 11:16:22 +00:00
bors
ac4ce4259b Auto merge of #12242 - flodiebold:extension-description, r=flodiebold
Improve extension description and README
2022-05-15 18:11:32 +00:00
Lukas Wirth
977f0ba968 Update package.json 2022-05-14 15:18:18 +02:00
Lukas Wirth
622defb373 internal: Make VSCode config more GUI edit friendly 2022-05-14 13:53:41 +02:00
Florian Diebold
3dcf9e0f2e Change description 2022-05-13 22:13:23 +02:00
Lukas Wirth
8496633c87 Don't make r-a fail to initialize if updating the config fails 2022-05-13 21:20:37 +02:00
Lukas Wirth
8ac429dad9 fix: Fix incorrect hover actions config keys 2022-05-13 21:17:03 +02:00
Florian Diebold
85fe9391d3 Improve extension description and README 2022-05-13 18:15:33 +02:00
Lukas Wirth
99a51dfe9b Update package description 2022-05-13 14:11:09 +02:00
Lukas Wirth
a8133680af fix: Fix typo in publisher field 2022-05-13 14:10:37 +02:00
Lukas Wirth
e47f4597d4 feat: Change VSCode extension publisher to rust-lang 2022-05-13 13:21:52 +02:00
Lukas Wirth
d57beac7e6 fix: Fix vscode config descriptions not recognizing all valid values 2022-05-12 18:15:48 +02:00
bors
135164f547 Auto merge of #12226 - Veykril:reborrow-inlay-hints, r=Veykril
feat: Allow reborrow inlay hints to be restricted to mutable reborrows only
2022-05-12 12:21:06 +00:00
Lukas Wirth
c2190ad87c feat: Allow reborrow inlay hints to be restricted to mutable reborrows only 2022-05-12 14:00:06 +02:00
bors
927ef0ce7e Auto merge of #12215 - listochkin:Support-variable-substitution-in-vscode-settings, r=Veykril
feat: Support variable substitution in VSCode settings

Currently support a subset of [variables provided by VSCode](https://code.visualstudio.com/docs/editor/variables-reference) in `server.extraEnv` section of Rust-Analyzer settings:

  * `workspaceFolder`
  * `workspaceFolderBasename`
  * `cwd`
  * `execPath`
  * `pathSeparator`

Also, this PR adds support for general environment variables resolution. You can declare environment variables and reference them from other variables like this:

```JSON
"rust-analyzer.server.extraEnv": {
    "RUSTFLAGS": "-L${env:OPEN_XR_SDK_PATH}",
    "OPEN_XR_SDK_PATH": "${workspaceFolder}\\..\\OpenXR-SDK\\build\\src\\loader\\Release"
},
```
The order of variable declaration doesn't matter, you can reference variables before defining them. If the variable is not present in `extraEnv` section, VSCode will search for them in your environment. Missing variables will be replaced with empty string. Circular references won't be resolved and will be passed to rust-analyzer server process as is.

Closes #9626, but doesn't address use cases where people want to use values provided by `rustc` or `cargo`, such as `${targetTriple}` proposal #11649
2022-05-12 11:05:21 +00:00
Lukas Wirth
84176f6b24 internal: Rename primeCaches config keys 2022-05-12 12:30:00 +02:00
Luna Razzaghipour
23ec7cfec4
Fix character semantic token type definition 2022-05-12 18:15:39 +10:00
Andrei Listochkin
33d2c8a3f9 Enable variable substitutions before passing them over to R-A server 2022-05-11 15:53:28 +01:00
Andrei Listochkin
684fa2794f VSCode variables support for substitutions
Tests now open Rust-Analyzer extension code in order to populate
VSCode variables.
2022-05-11 15:50:59 +01:00
Andrei Listochkin
6c769ac00d handle references to external environment variables
use cross-env to enable env variables on Windows
2022-05-11 15:50:25 +01:00
Andrei Listochkin
a86db5d0d1 iterative dependency solver
First, we go through every environment variable key and record all cases
where there are reference to other variables / dependencies.

We track two sets of variables - resolved and yet-to-be-resolved.
We pass over a list of variables over and over again and when all
variable's dependencies were resolved during previous passes we perform
a replacement for that variable, too.

Over time the size of `toResolve` set should go down to zero, however
circular dependencies may prevent that. We track the size of `toResolve`
between iterations to avoid infinite looping.

At the end we produce an object of the same size and shape as
the original, but with the values replace with resolved versions.
2022-05-11 15:05:41 +01:00
Andrei Listochkin
18d2fb81a7 search for test files instead of explicitly name them 2022-05-11 15:03:34 +01:00
bors
94fa8a6534 Auto merge of #12213 - Veykril:config-fix, r=Veykril
fix: Fix incorrect config patching for runBuildScripts
2022-05-11 10:38:56 +00:00
Lukas Wirth
e68352a9f5 fix: Fix incorrect config patching for runBuildScripts 2022-05-11 12:38:21 +02:00
Elliot Roberts
2298a76222 fix typo in inlayHints.renderColons option description 2022-05-10 19:15:07 -07:00
bors
460e389f54 Auto merge of #12010 - Veykril:r-a-config, r=Veykril
Config revamp

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

This PR changes a lot of config names, and a few ones are being merged or split apart. The reason for this is that our configuration names currently are rather inconsistent and some where poorly chosen in regards to extensability. This PR plans to fix that.

We still allow the old config names by patching them to the new ones before deserializing to keep backwards compatability with other clients (the VSCode client will auto update the config) but ideally we will get rid of that layer in the future.

Here is a list of the changes:

These are simple renames `old_name | alias1 | alias2 ... -> new_name` (the vscode client will fix these up automagically):
```
assist_allowMergingIntoGlobImports -> imports_merge_glob
assist_exprFillDefault -> assist_expressionFillDefault
assist_importEnforceGranularity -> imports_granularity_enforce
assist_importGranularity | assist_importMergeBehavior | assist_importMergeBehaviour -> imports_granularity_group
assist_importGroup -> imports_group_enable
assist_importPrefix -> imports_prefix

cache_warmup -> primeCaches_enable

cargo_loadOutDirsFromCheck -> cargo_buildScripts_enable
cargo_runBuildScripts | cargo_runBuildScriptsCommand -> cargo_runBuildScripts_overrideCommand
cargo_useRustcWrapperForBuildScripts -> cargo_runBuildScripts_useRustcWrapper

completion_snippets -> completion_snippets_custom

diagnostics_enableExperimental -> diagnostics_experimental_enable

experimental_procAttrMacros -> procMacro_attributes_enable

highlighting_strings -> semanticHighlighting_strings_enable

highlightRelated_breakPoints -> semanticHighlighting_breakPoints_enable
highlightRelated_exitPoints -> semanticHighlighting_exitPoints_enable
highlightRelated_yieldPoints -> semanticHighlighting_yieldPoints_enable
highlightRelated_references -> semanticHighlighting_references_enable

hover_documentation -> hover_documentation_enable
hover_linksInHover | hoverActions_linksInHover -> hover_links_enable
hoverActions_debug -> hoverActions_debug_enable
hoverActions_enable -> hoverActions_enable_enable
hoverActions_gotoTypeDef -> hoverActions_gotoTypeDef_enable
hoverActions_implementations -> hoverActions_implementations_enable
hoverActions_references -> hoverActions_references_enable
hoverActions_run -> hoverActions_run_enable

inlayHints_chainingHints -> inlayHints_chainingHints_enable
inlayHints_closureReturnTypeHints -> inlayHints_closureReturnTypeHints_enable
inlayHints_hideNamedConstructorHints -> inlayHints_typeHints_hideNamedConstructorHints
inlayHints_parameterHints -> inlayHints_parameterHints_enable
inlayHints_reborrowHints -> inlayHints_reborrowHints_enable
inlayHints_typeHints -> inlayHints_typeHints_enable

lruCapacity -> lru_capacity

runnables_cargoExtraArgs -> runnables_extraArgs
runnables_overrideCargo -> runnables_command

rustcSource -> rustc_source

rustfmt_enableRangeFormatting -> rustfmt_rangeFormatting_enable
```

These are configs that have been merged or split apart, which have to be manually updated by the user:

```
callInfo_full -> signatureInfo_detail, signatureInfo_documentation_enable

cargo_allFeatures, cargo_features -> cargo_features
checkOnSave_allFeatures, checkOnSave_features -> checkOnSave_features
completion_addCallArgumentSnippets completion_addCallParenthesis -> completion_callable_snippets
```
2022-05-10 12:07:24 +00:00
bors
9e10d4b717 Auto merge of #12093 - nico-abram:uwu, r=Veykril
Reload project on .cargo/config[.toml] changes

Fixes #11024

Not adding tests as discussed in the issue
2022-05-02 12:21:42 +00:00
Lukas Wirth
291f94e22e Fix up config docs 2022-05-01 19:57:09 +02:00
Lukas Wirth
d6dba1c97c auto update old configurations to newer ones 2022-05-01 19:57:09 +02:00
Lukas Wirth
1f11b70c3b Final fixups 2022-05-01 19:57:09 +02:00
Lukas Wirth
3d17261972 Adjust signature info and enum variant lenses 2022-05-01 19:57:08 +02:00
Lukas Wirth
b84f3cc98f Update docs and config 2022-05-01 19:57:08 +02:00
Mika Lehtinen
2a714590b2
Fix typo in VSCode readme 2022-04-30 21:03:51 +03:00
unknown
b373e62f1a Reload project on .cargo/config[.toml] changes
Fixes #11024
2022-04-27 12:10:43 -03:00
Will Crichton
d607c1b558 Export lc.LanguageClient from VSCode extension 2022-04-21 13:39:53 -07:00
Jonas Schievink
c1a28ccf8c fix: remove angle brackets from language configuration 2022-04-20 16:43:24 +02:00
Laurențiu Nicola
ad751e08ec Pass the language id when toggling inlay hints 2022-04-20 07:34:00 +03:00
Laurențiu Nicola
4de7793425 Actually remove rust-analyzer.inlayHints.enable 2022-04-20 07:33:26 +03:00
Jonas Schievink
c6ffffccbd Allows triggering commands after an assist edit 2022-04-19 18:45:48 +02:00
bors
66c232d03b Auto merge of #12006 - lnicola:toggle-inlay-hints, r=lnicola
fix: Remove old inlay hints settings

Closes #11998
2022-04-16 05:10:17 +00:00
Laurențiu Nicola
f77adb3a23 Remove old inlay hints settings 2022-04-16 08:05:07 +03:00
bors
9ed459751f Auto merge of #11997 - lnicola:es-target, r=lnicola
minor: Bump target JS version
2022-04-15 18:17:23 +00:00
Lukas Wirth
77a9d951bd Update feature listing in extension README 2022-04-15 19:11:56 +02:00
Laurențiu Nicola
1698afc05d Bump target JS version 2022-04-15 18:18:18 +03:00
bors
15844bf48c Auto merge of #11956 - fee1-dead:master, r=flodiebold
feat: allow customizing the command for running build scripts

I have tested this locally and it fixed #9201 with some small changes on the compiler side with suggestions from https://github.com/rust-analyzer/rust-analyzer/issues/9201#issuecomment-1019554086.

I have also added an environment variable `IS_RA_BUILDSCRIPT_CHECK` for crates to detect that it is a check for buildscripts, and allows defaulting to bogus values for expected environment variables.
2022-04-13 22:53:31 +00:00
Deadbeef
73a033e77c
feat: allow customizing the command for running build scripts 2022-04-13 23:45:51 +10:00
Laurențiu Nicola
bfa2a08da1 Update for languageclient API changes 2022-04-08 14:24:28 +03:00