Commit Graph

1678 Commits

Author SHA1 Message Date
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
Laurențiu Nicola
d3d6267112 Switch to LSP inlay hints 2022-04-08 14:10:24 +03:00
bors[bot]
bc0825d135
Merge #10802
10802: Allow clients to configure the global workspace search limit r=Veykril a=knutwalker

Playing around with [helix](https://helix-editor.com) I realized that the global worksapce symbol search works different compared to vs-code.
Helix requires all possible symbols in one query and does no subsequent refinement searched.
This PR adds a configuration option to override the default search limit with the default being the currently hardocded value.
Helix users can increment this limit for their instance with a config like

```toml
[[language]]
name = "rust"
language-server = { command = "rust-analyzer" }
[language.config]
workspace = { symbol = { search = { limit = 65536 }}}
```

Other editors are not affected by this change.


Co-authored-by: Paul Horn <dev@knutwalker.engineer>
2022-04-03 12:03:46 +00:00
bors[bot]
40cba42e47
Merge #11821
11821: minor: Bump npm deps r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-04-03 07:14:14 +00:00
Laurențiu Nicola
a7e83418d5 Load @hpcc-js/wasm as a script, not worker 2022-04-03 10:05:39 +03:00
bors[bot]
ee84622c92
Merge #11796
11796: minor: Remove sponsors from readme files r=Veykril a=Veykril

No need to merge this now though

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-01 15:51:29 +00:00
Jonas Schievink
ec2d023383 Add "view file text" command to debug sync issues 2022-03-31 14:50:33 +02:00
Laurențiu Nicola
0690973f8e Bump npm deps 2022-03-25 20:35:44 +02:00
Jonas Schievink
44a99d6e49 Disable experimental diagnostics by default 2022-03-24 17:00:17 +01:00
Lukas Wirth
e528403579 minor: Remove sponsors from readme files 2022-03-22 22:47:48 +01:00
Lukas Wirth
ecf2c98859 fix: Fix lifetime elision hint configuration key 2022-03-22 16:28:36 +01:00
bors[bot]
966b692422
Merge #11771
11771: feat: Visualize compiler inserted reborrows via inlay hints r=Veykril a=Veykril

Disabled by default.

![image](https://user-images.githubusercontent.com/3757771/159165178-baaf968a-4381-468e-933f-5326ca1b203d.png)

Closes https://github.com/rust-analyzer/rust-analyzer/issues/11275


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 13:47:16 +00:00
Lukas Wirth
37b48ceb8f feat: Visualize compiler inserted reborrows via inlay hints 2022-03-20 14:38:16 +01:00
bors[bot]
7315d97347
Merge #11755
11755: feat: Implement lifetime elision hints r=Veykril a=Veykril

With names on:
![Code_erl26zKvuf](https://user-images.githubusercontent.com/3757771/159134856-e2c75d2d-f17c-45c7-9a78-3da5ee8b1acd.png)
With names off:
![Code_MRP1Pbfe9d](https://user-images.githubusercontent.com/3757771/159134857-30fac3a1-825e-4f49-ba9b-9fa0bb215694.png)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-19 19:15:06 +00:00
Lukas Wirth
7da5b80f25 Change skip trivial behaviour 2022-03-19 20:12:14 +01:00
Lukas Wirth
7ab0aaa82a Add option to skip trivial cases 2022-03-19 19:01:19 +01:00
Laurențiu Nicola
031967383e Remove Update GitHub API token command 2022-03-18 09:19:02 +02:00
Lukas Wirth
bd17933c31 feat: Add return type hints for closures with block bodies 2022-03-16 21:25:03 +01:00
Vladimir Serov
f7cf3b5503
editors/code: fix crash due to missing ID= field
Assuming ID=linux in isNixOs by default. You can get away with
default "", but why do that if there's a default value in spec?)

Also removed toLowerCase — it really shouldn't be needed.
Fixes #11709
2022-03-15 07:11:24 +03:00
Vladimir Serov
ce4b61003d
editors/code: fix nixos detection
Problem: NixOS started using quotes around it's id field in /etc/os-release
Solution: Parially parsing os-release, and detecting, whether `nixos` appears anywhere in "ID=" field\
See https://github.com/rust-analyzer/rust-analyzer/issues/11695
Closes #11695
2022-03-13 00:38:41 +03:00
Lukas Wirth
62265ee9cb fix: Allow configuration of colons in inlay-hints 2022-03-11 21:15:36 +01:00
bors[bot]
49646b71d4
Merge #11445
11445: Upstream inlay hints r=lnicola a=lnicola

Closes https://github.com/rust-analyzer/rust-analyzer/issues/2797
Closes https://github.com/rust-analyzer/rust-analyzer/issues/3394 (since now resolve the hints for the range given only, not for the whole document. We don't actually resolve anything due to [hard requirement](https://github.com/rust-analyzer/rust-analyzer/pull/11445#issuecomment-1035227434) on label being immutable. Any further heavy actions could go to the `resolve` method that's now available via the official Code API for hints)

Based on `@SomeoneToIgnore's` branch, with a couple of updates:

 - I squashed, more or less successfully, the commits on that branch
 - downloading the `.d.ts` no longer works, but you can get it manually from https://raw.githubusercontent.com/microsoft/vscode/release/1.64/src/vscode-dts/vscode.proposed.inlayHints.d.ts
 - you might need to pass `--enable-proposed-api matklad.rust-analyzer`
 - if I'm reading the definition right, `InlayHintKind` needs to be serialized as a number, not string
 - this doesn't work anyway -- the client-side gets the hints, but they don't display

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-07 16:49:12 +00:00
Laurențiu Nicola
97109d73f8 Add missing parameter 2022-03-07 15:42:20 +02:00
Laurențiu Nicola
04128de553 Bump esbuild 2022-03-07 15:24:42 +02:00
Laurențiu Nicola
b9d74fe2ed Update LSP docs 2022-03-07 15:09:31 +02:00
Lukas Wirth
e5bb661b7a Highlight Self as a keyword by default 2022-03-06 00:13:45 +01:00
Lukas Wirth
5c0aee013e Fix highlighting of Self 2022-03-05 23:34:37 +01:00
Laurențiu Nicola
9d43291533 Drop hint conversion 2022-03-04 08:08:59 +02:00
Laurențiu Nicola
8454358ba4 Bump vscode 2022-03-04 08:08:59 +02:00
Kirill Bulatov
9c0c199e96 Clean up the redundant hints code and config 2022-03-04 07:45:51 +02:00
Laurențiu Nicola
0b69717ab6 Fixes 2022-03-04 07:45:51 +02:00
Laurențiu Nicola
2ae8248cee Add log messages 2022-03-04 07:45:51 +02:00
Laurențiu Nicola
0f396d670b Bump deps 2022-03-04 07:45:51 +02:00
Kirill Bulatov
55371be807 Add experimental VSCode api 2022-03-04 07:45:51 +02:00
Lukas Wirth
2a7793d912 feat: Make private editable completions configurable, disable by default 2022-02-25 22:16:40 +01:00
Laurențiu Nicola
6e7b17374c Remove reference to updates.channel from settings 2022-02-23 06:38:01 +02:00
bors[bot]
ba33054802
Merge #11416
11416: Fix eslint language server not working r=Veykril a=jackos

Allows the language server for eslint to work inside VS Code.

Before change:
![image](https://user-images.githubusercontent.com/77730378/152661637-c5d90678-39dc-4018-b884-fc4b6135368e.png)

After change:
![image](https://user-images.githubusercontent.com/77730378/152661647-164c0655-aa6a-4c50-b49d-49cda112d149.png)

Co-authored-by: Jack Clayton <jackclayto@gmail.com>
2022-02-06 14:42:01 +00:00
Moritz Vetter
9f6c206ea0 fix two vulneabilities (moderate: 1, high: 1) by running npm audit 2022-02-06 15:23:48 +01:00
Jack Clayton
76ecf9a17d Fix eslint errors 2022-02-06 06:52:51 +08:00
Florian Diebold
b36c83032b Update README.md
I'm not currently sponsored anymore.
2022-01-30 14:21:52 +01:00
Andrew Onyshchuk
a05e09acbe Support <code> blocks from Rust docs 2022-01-27 11:46:04 -08:00
bors[bot]
2cb85c14b6
Merge #11281
11281: ide: parallel prime caches r=jonas-schievink a=jhgg

cache priming goes brrrr... the successor to #10149

---

this PR implements a parallel cache priming strategy that uses a topological work queue to feed a pool of worker threads the crates to index in parallel.

## todo
- [x] should we keep the old prime caches?
- [x] we should use num_cpus to detect how many cpus to use to prime caches. should we also expose a config for # of worker CPU threads to use?
- [x] something is wonky with cancellation, need to figure it out before this can merge. 

Co-authored-by: Jake Heinz <jh@discordapp.com>
2022-01-25 16:03:35 +00:00
Laurențiu Nicola
cd50c71631 Bump npm deps 2022-01-22 11:59:45 +02:00
Chris Price
c18ee35ce8
fix: remove pipe from surroundingPairs
Closes https://github.com/rust-analyzer/rust-analyzer/issues/11192
2022-01-17 20:08:39 +00:00
Jake Heinz
25f67b6939 make it a config 2022-01-15 02:47:47 +00:00
bors[bot]
40009e07d0
Merge #11145
11145: feat: add config to use reasonable default expression instead of todo! when filling missing fields r=Veykril a=bnjjj

Use `Default::default()` in struct fields when we ask to fill it instead of putting `todo!()` for every fields

before:

```rust
pub enum Other {
    One,
    Two,
}

pub struct Test {
    text: String,
    num: usize,
    other: Other,
}

fn t_test() {
    let test = Test {<|>};
}
``` 

after: 

```rust
pub enum Other {
    One,
    Two,
}

pub struct Test {
    text: String,
    num: usize,
    other: Other,
}

fn t_test() {
    let test = Test {
        text: String::new(),
        num: 0,
        other: todo!(),
    };
}
``` 



Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
2022-01-07 14:10:11 +00:00
Benjamin Coenen
8e0a05eb70 feat(diagnostics): use default expression instead of todo! when missing fields
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-07 15:01:37 +01:00
Benjamin Coenen
b60a29ca94 feat(diagnostics): use default expression instead of todo! when missing fields
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-07 14:13:34 +01:00
Lukas Wirth
f6eba28ef8 Adjust config name 2022-01-06 13:50:35 +01:00
Lukas Wirth
dd4b53402d Regenrate docs and package.json 2022-01-06 13:50:24 +01:00
Benjamin Coenen
336c899a07 add better default behavior on fill struct fields diagnostic
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-04 15:59:00 +01:00
Lukas Wirth
3a525c831f internal: Handle macro calls better in highlighting 2022-01-02 19:10:10 +01:00
Benjamin Coenen
df6fa50f92 feat(diagnostics): add new config to fill default expression
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-12-31 16:29:08 +01:00
Laurențiu Nicola
0182f74516 Fix server path on NixOS 2021-12-30 14:50:54 +02:00
Nixon Enraght-Moony
6ebb9ffd2a
Remove note about alpha status from vscode extension descritpion
See https://github.com/rust-analyzer/rust-analyzer.github.io/pull/156 and https://github.com/rust-analyzer/rust-analyzer/pull/8237
2021-12-27 01:26:25 +00:00
Laurențiu Nicola
af2bbce8d9 Spelling fix 2021-12-23 14:04:46 +02:00
Laurențiu Nicola
5bed9d6188 Simplify conflict check 2021-12-23 14:04:15 +02:00
Laurențiu Nicola
f872419847 Drop kalitaalexey.vscode-rust check 2021-12-23 14:04:15 +02:00
Laurențiu Nicola
c0d0ceefb2 Don't check for platform details 2021-12-23 14:04:15 +02:00
Laurențiu Nicola
8b304a72f6 Remove ETXTBUSY check, we don't overwrite binaries 2021-12-23 13:10:50 +02:00
Laurențiu Nicola
3835b3790e Improve NixOS handling 2021-12-23 13:10:50 +02:00
Laurențiu Nicola
e97569c998 Drop extensionUri copy 2021-12-23 09:36:55 +02:00
Laurențiu Nicola
f63690c058 Remove proxy settings 2021-12-23 09:23:56 +02:00
Laurențiu Nicola
650ec14e4f Remove channel and ask before download prefs 2021-12-23 09:23:56 +02:00
Laurențiu Nicola
c68dbc16f8 Remove node-fetch and https-proxy-agent deps 2021-12-23 09:23:56 +02:00
Laurențiu Nicola
53c183cc13 Remove network functions 2021-12-23 09:23:56 +02:00
Laurențiu Nicola
d5b4aa3037 Remove server download and update checks 2021-12-23 08:24:58 +02:00
Laurențiu Nicola
89cecff2bd Bump vscode in package.json 2021-12-20 20:58:09 +02:00
Laurențiu Nicola
9c74f646f4 Publish platform-specific Code VSIXes 2021-12-18 22:49:11 +02:00
Laurențiu Nicola
262a698875 Prepare Code extension for bundling 2021-12-18 17:44:16 +02:00
Lukas Wirth
9fe0f0d1d9 Add a few default snippets for VSCode 2021-12-17 16:24:29 +01:00
bors[bot]
6df9bd42f4
Merge #10972
10972: minor: Bump vscode to 1.62 r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-09 15:18:41 +00:00
Laurențiu Nicola
19c774b4c4 Bump eslint 2021-12-09 17:16:30 +02:00
Laurențiu Nicola
c1fc774b6e Bump vscode 2021-12-09 17:15:21 +02:00
Jonas Schievink
deb5c1426d internal: add "Shuffle Crate Graph" command 2021-12-07 16:37:19 +01:00
bors[bot]
b519a179b4
Merge #10940
10940: minor: Fix HttpsProxyAgent creation and avoid deprecated call r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-05 12:12:44 +00:00
Laurențiu Nicola
725b3fdd65 Fix HttpsProxyAgent creation and avoid deprecated call 2021-12-05 14:11:49 +02:00
bors[bot]
396f864134
Merge #10938
10938: minor: Bump d3 r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-05 11:40:23 +00:00
Laurențiu Nicola
6300d03acd Bump d3 2021-12-05 13:38:31 +02:00
bors[bot]
372a7cf981
Merge #10929
10929: internal: Split up macro/attribute semantic tokens a bit more r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9172

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-04 17:33:16 +00:00
Lukas Wirth
3472105ad9 Update semantic token docs 2021-12-04 18:23:25 +01:00
Laurențiu Nicola
341e3773c3 Bump rest of the npm deps 2021-12-04 14:28:48 +02:00
Laurențiu Nicola
29682445ac Bump node-fetch 2021-12-04 14:26:37 +02:00
Laurențiu Nicola
c3a97a9a9c Bump vsce 2021-12-04 14:26:14 +02:00
Laurențiu Nicola
98697b61b5 Bump eslint 2021-12-04 14:26:14 +02:00
Laurențiu Nicola
0cf031a18a Bump engine in lockfile 2021-12-04 14:26:14 +02:00
Laurențiu Nicola
65cdced805 Simplify .vscodeignore 2021-12-04 14:16:10 +02:00
Laurențiu Nicola
acd5c1f19b Add LICENSE file to make vsce happy 2021-12-04 12:29:27 +02:00
bors[bot]
348110dcd9
Merge #10919
10919: internal: Define missing semantic token hierarchies in package.json r=Veykril a=Veykril

Closes https://github.com/rust-analyzer/rust-analyzer/issues/10077
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-03 22:53:32 +00:00
Lukas Wirth
d74894abe2 Add some more semantic token to textmate grammar mapping 2021-12-03 22:17:56 +01:00
Lukas Wirth
90e9a49cb9 Define missing semantic token hierarchies in package.json 2021-12-03 21:59:34 +01:00
Laurențiu Nicola
3ed0f349f2 Bump engine 2021-12-03 20:53:46 +02:00
Laurențiu Nicola
51426c4299 Bump esbuild 2021-12-03 20:53:43 +02:00
Laurențiu Nicola
d790a6b991 Bump typescript 2021-12-03 20:49:38 +02:00
Laurențiu Nicola
c6a35531f3 Bump @types/vscode 2021-12-03 20:48:15 +02:00
Laurențiu Nicola
278e435d93 Bump eslint 2021-12-03 20:46:19 +02:00
Laurențiu Nicola
effe112130 Bump vscode-test 2021-12-03 20:40:29 +02:00
Laurențiu Nicola
300e4dfbcc Bump tslib 2021-12-03 20:35:22 +02:00
Laurențiu Nicola
f547d52d75 Bump node-fetch and @types/node-fetch 2021-12-03 20:33:14 +02:00
Laurențiu Nicola
37b60e5d2b Bump @types/node 2021-12-03 20:30:26 +02:00
Laurențiu Nicola
b236ce83bb Bump d3 2021-12-03 20:29:30 +02:00
bors[bot]
3b02aec0cc
Merge #10903
10903: internal: Replace `mocha` with a custom test runner r=Aloso a=lnicola

Closes #10723

r? `@Aloso`

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-02 17:37:56 +00:00
Laurențiu Nicola
157056db22 Fix proxyStrictSSL check 2021-12-02 15:46:23 +02:00
Laurențiu Nicola
76b3d437d3 Replace mocha with a custom test runner 2021-12-02 13:05:50 +02:00
Laurențiu Nicola
a59c1a0af0 Try to fix Code tests 2021-12-01 12:22:34 +02:00
Laurențiu Nicola
7d815b862f Refactor proxy settings 2021-11-28 10:54:35 +02:00
Laurențiu Nicola
2f5149886d Respect http.proxyStrictSSL 2021-11-27 07:29:44 +02:00
Laurențiu Nicola
a68ce62f6a Add toggle to disable cache priming 2021-11-19 19:30:11 +02:00
Paul Horn
553bb7f50a
Allow clients to configure the global workspace search limit 2021-11-18 17:52:02 +01:00
Jake Heinz
520ff62f4e flip the default 2021-11-13 23:39:34 +00:00
Jake Heinz
d3d768de0d inlay hints: add the option to always show constructor inlay hints 2021-11-13 23:12:29 +00:00
bors[bot]
f48b2622d8
Merge #10688
10688: internal: Type-check TS on CI and also turn off the strict setting `useUnknownInCatchVariables` r=lnicola a=ChayimFriedman2

We don't follow it and I found that turning it on will have little benefit.

I'm not sure if we should also type-check when building in launch.json.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2021-11-08 13:37:34 +00:00
Laurențiu Nicola
1fe48a7184 Avoid deprecated methods in client-side tests 2021-11-07 10:00:58 +02:00
Chayim Refael Friedman
36bdb5c94d Type-check TS on CI and also turn off the strict setting useUnknownInCatchVariables
We don't follow it and I found that turning it on will have little benefit.
2021-11-04 01:23:45 +02:00
bors[bot]
057558b756
Merge #10595
10595: internal: Fix a format error r=Veykril a=dzvon

Fixes #10581

Co-authored-by: Dezhi Wu <wu543065657@163.com>
2021-10-29 10:40:43 +00:00
Dezhi Wu
74396d27c0 Fix: correct markdown link form. 2021-10-29 18:25:32 +08:00
Dezhi Wu
ffc6cdd871 Fix: transform the asciidoc form link to markdown style when generating the package.json 2021-10-28 10:13:43 +08:00
Lukas Wirth
4c582ffe9f Don't ask the user to reload when chaning HoverAction configs in VSCode 2021-10-25 14:48:36 +02:00
Dezhi Wu
1a24ee9a1b Fix a format error 2021-10-20 20:13:03 +08:00
bors[bot]
f87debcf87
Merge #10434
10434: Allow `Locate parent module` command in Cargo.toml r=Veykril a=rainy-me

close #10355

Co-authored-by: rainy-me <github@rainy.me>
Co-authored-by: rainy-me <github@yue.coffee>
2021-10-14 10:56:08 +00:00
Laurențiu Nicola
e43e1240a7 Document rustc source auto-discovery 2021-10-14 08:57:07 +03:00
rainy-me
59c755227d Provide navigations to parent modules 2021-10-14 07:16:42 +09:00
bors[bot]
5ff992465e
Merge #10447
10447: Add enum variant references CodeLens. r=Veykril a=ericsampson



Co-authored-by: Eric Sampson <esampson@eaze.com>
2021-10-05 22:03:23 +00:00
Lukas Wirth
041cfbe0f4 Render the expansion of snippets as their docs 2021-10-05 18:11:22 +02:00
Lukas Wirth
ca1fdd75f1 Regen docs 2021-10-04 22:13:12 +02:00
Eric Sampson
99dd8066d9 need to update some generated files. 2021-10-04 02:30:46 -05:00
Eric Sampson
a0bb31587e Add enum variant references CodeLens. 2021-10-04 02:18:31 -05:00
Laurențiu Nicola
f5c9204ff2 Limit depth to 1 when searching for Cargo.toml 2021-10-03 17:58:03 +03:00
rainy-me
39044fe39c Allow locate parent module action in cargo toml 2021-10-03 11:58:10 +09:00
bors[bot]
c88277f676
Merge #10421
10421: minor: Bump npm non-dev deps r=lnicola a=lnicola

Fixes #10407

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-10-02 16:43:24 +00:00
Laurențiu Nicola
502fa1755a Remove temporary file on exception 2021-10-02 10:07:50 +03:00
Laurențiu Nicola
2c7b50217e Overwrite file when running patchelf 2021-10-02 10:05:39 +03:00
Laurențiu Nicola
aa88d7e0d6 Bump npm non-dev deps 2021-10-02 07:38:44 +03:00
hamidreza kalbasi
0dbaf64b12 add vscode native onEnterRules 2021-09-28 20:23:25 +03:30
Laurențiu Nicola
81891f7abe Enable attribute proc macros by default 2021-09-27 18:11:31 +03:00
Lukas Wirth
b24c8d5c89 Update semanticTokenModifiers in package.json 2021-09-25 14:10:46 +02:00
Carlos Menezes
8ad484b341 Add missing files 2021-09-24 14:53:11 +01:00
Laurențiu Nicola
db5e01189a Change the global setting when toggling inlay hints 2021-09-23 20:45:45 +03:00
Laurențiu Nicola
8522b4aece Add workaround for rename error reporting 2021-09-13 14:52:03 +03:00
IceSentry
d9e4b231c7 configure colorizedBracketPairs 2021-09-09 00:25:38 -04:00
Oliver Cooper
d246a5f58b
Undefined scope comment 2021-09-09 08:50:24 +12:00
Oliver Cooper
001608914b Removed deprecated Task constructor 2021-09-08 10:46:31 +12:00
Oliver Cooper
0517247bbc Don't filter cargo tasks by scope
Fixes #9093
2021-08-31 20:35:22 +12:00
Fumiaki MATSUSHIMA
7bbca5d6f3 Set esbuild target as node14 2021-08-28 14:43:44 +00:00
=
e3dd43ceba remove workaround from old node versions 2021-08-27 11:31:25 +02:00
unexge
3a9ba0e506 feat: join lines merges assignments 2021-08-22 21:28:39 +03:00
bors[bot]
19348bc478
Merge #9908
9908: fix check of the toolchain's path r=lnicola a=gfreezy

fixed #9907

Co-authored-by: Alex.F <gfreezy@gmail.com>
2021-08-21 13:41:09 +00:00
Alex.F
8e4039c7d7 inline await statement 2021-08-17 15:24:13 +08:00
Alex.F
635b89fdaa clean imports 2021-08-16 10:35:27 +08:00
Alex.F
6b3a6ddb39 fix lint 2021-08-16 00:21:12 +08:00
Alex.F
d13f6ba750 use async version 2021-08-16 00:19:45 +08:00
Laurențiu Nicola
743b016313 Don't call deprecated compile regex method 2021-08-13 14:16:33 +03:00
André Oliveira
25e1ca38ab Update 'package-lock.json' 2021-08-10 13:46:44 +00:00
André Oliveira
7666eb1fb8 Embed the scripts in the html template 2021-08-10 13:43:58 +00:00
André Oliveira
51a6d2204e Remove unecessary joinPaths 2021-08-10 13:43:58 +00:00
André Oliveira
f4a60e2af3 Include the needed node_modules files in the final extension bundle 2021-08-10 13:43:58 +00:00
André Oliveira
11bbaecca0 Formatting issues 2021-08-10 13:43:57 +00:00
André Oliveira
5e571a375b replace let by const 2021-08-10 13:43:57 +00:00
André Oliveira
b29508949d Remove debug logs 2021-08-10 13:43:57 +00:00
André Oliveira
6d59219d26 Reduce path handling code 2021-08-10 13:43:57 +00:00
André Oliveira
1039acb10a Add more features to the rendering
- Allow the zoom to go further than 10x
- Adapt css to dark and high constrast themess
- Use 'javascript/worker' for the wasm graphviz
- Add Ctrl + LeftMouseClick to reset zoom
2021-08-10 13:43:55 +00:00
André Oliveira
8a563e4a46 Use local node_modules to allow the graph to load offline
- Fix some warnings
2021-08-10 13:43:08 +00:00
André Oliveira
f4f68e62c2 Use d3-graphviz for rendering crates graph on the extension side 2021-08-10 13:40:49 +00:00
Mukund Lakshman
463860439f vscode extension: use esbuild instead of rollup. 2021-08-10 10:18:08 +01:00
Aleksey Kladov
bb8607434d internal: remove client-side support for latest requests
Companion for #9826
2021-08-09 19:24:43 +03:00
Ryan Levick
ac50e35325 Give better error message when the rust-analyzer binar path was set in the user's config but the binary is invalid 2021-08-03 14:03:49 +02:00
Gianluca Recchia
93433364ab
Exclude rust-analyzer.server.path from VS Code's sync feature
By changing the scope of this configuration to `machine-overridible`,
this setting becomes fully local for the VS Code instance the user is
running.

Having this setting excluded from syncing should help avoid
inconveniences for users who have VS Code installed on two different
operating systems, where the paths to the language server binary would
very likely mismatch.
2021-08-01 12:00:41 +02:00
Aleksey Kladov
be84f85c1d feat: gate custom clint-side commands behind capabilities
Some features of rust-analyzer requires support for custom commands on
the client side. Specifically, hover & code lens need this.

Stock LSP doesn't have a way for the server to know which client-side
commands are available. For that reason, we historically were just
sending the commands, not worrying whether the client supports then or
not.

That's not really great though, so in this PR we add infrastructure for
the client to explicitly opt-into custom commands, via `extensions`
field of the ClientCapabilities.

To preserve backwards compatability, if the client doesn't set the
field, we assume that it does support all custom commands. In the
future, we'll start treating that case as if the client doesn't support
commands.

So, if you maintain a rust-analyzer client and implement
`rust-analyzer/runSingle` and such, please also advertise this via a
capability.
2021-07-30 19:16:33 +03:00
Alexander Gonzalez
cff2a0fe32 lint: Format the typescript files properly 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
ca85185bc6 docs: Update the lsp-extensions.md with the Hover Range capability 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
1a0a5da1a4 refactor: Make handle_hover handle ranges too 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
2b5798e927 fix: Unregister the removed command 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
9f21891950 refactor: Remove unnecessary command 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
18644720eb feat: Completed the client side implementation of rust-analyzer/hoverRange 2021-07-27 18:29:22 -04:00
Kevin DeLorey
5b9f173254 Removed all dead config accessors. 2021-07-23 07:50:37 -06:00
Kevin DeLorey
d8f0213316 removed dead code 2021-07-23 07:41:55 -06:00