Commit Graph

22407 Commits

Author SHA1 Message Date
Lukas Wirth
622defb373 internal: Make VSCode config more GUI edit friendly 2022-05-14 13:53:41 +02:00
harpsword
7bd4c11e13 fix diagnostics location map incorrectly from rustc span to lsp position for non-BMP char 2022-05-14 19:19:55 +08:00
Florian Diebold
3dcf9e0f2e Change description 2022-05-13 22:13:23 +02:00
bors
06448c5548 Auto merge of #12246 - Veykril:config, r=Veykril
fix: Fix incorrect hover actions config keys
2022-05-13 19:36:32 +00: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
bors
a123f8dd66 Auto merge of #12245 - Veykril:compl-snip, r=Veykril
fix: Fix fill-arguments completions not working

Fixes https://github.com/rust-lang/rust-analyzer/issues/12243
2022-05-13 17:53:23 +00:00
Lukas Wirth
3577c44dee fix: Fix fill-arguments completions not working 2022-05-13 19:52:44 +02:00
Florian Diebold
85fe9391d3 Improve extension description and README 2022-05-13 18:15:33 +02:00
bors
4f6b2a20fd Auto merge of #12241 - jonas-schievink:does-not-float-my-boat, r=jonas-schievink
fix: revert float parsing "fix" to avoid macro-related panics

Reverts https://github.com/rust-lang/rust-analyzer/pull/12149 and the follow-up fixes, while keeping their tests.

https://github.com/rust-lang/rust-analyzer/pull/12149 has caused many unexpected panics related to macros, and the fixes for those are not straightforward and further complicate the MBE token conversion logic, which was already fairly hard to follow before these fixes.
2022-05-13 15:02:00 +00:00
Jonas Schievink
0831f3123b Fix tests 2022-05-13 15:54:46 +02:00
Jonas Schievink
9bd11459ba Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink"
This reverts commit cc9ae2b89e, reversing
changes made to 7dfd1cb572.
2022-05-13 15:08:14 +02:00
Jonas Schievink
2287ae22c6 Revert "Skip only the tt::Literal when consuming float tokens"
This reverts commit 7db55313a1.
2022-05-13 15:06:16 +02:00
Jonas Schievink
bde036b74e Revert "Fix conversion of float literals in TtTreeSink"
This reverts commit 43a066c5a8.
2022-05-13 15:05:34 +02:00
Jonas Schievink
4fcdb96789 Revert "fix: Remap float parts as integers when parsed as indices"
This reverts commit dbb066b99e.
2022-05-13 15:05:03 +02:00
Jonas Schievink
73e0e17b52 Revert "Don't remap float tokens to INT_NUMBER"
This reverts commit cb5e8da88a.
2022-05-13 15:04:36 +02:00
bors
0f9ffb5e35 Auto merge of #12239 - Veykril:publisher, r=Veykril
minor: Fix typo in publisher field
2022-05-13 12:38:08 +00: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
bors
da969635a4 Auto merge of #12238 - Veykril:publisher, r=Veykril
feat: Change VSCode extension publisher to `rust-lang`
2022-05-13 11:26:43 +00:00
Lukas Wirth
e47f4597d4 feat: Change VSCode extension publisher to rust-lang 2022-05-13 13:21:52 +02:00
bors
0c881e882e Auto merge of #12231 - jonas-schievink:fix-float-macro-panic, r=jonas-schievink
fix: fix "X is not a valid punct" panic with floats in macros

Should fix https://github.com/rust-lang/rust-analyzer/issues/12211
2022-05-12 17:03:22 +00:00
Jonas Schievink
cb5e8da88a Don't remap float tokens to INT_NUMBER 2022-05-12 19:01:09 +02:00
bors
f8c0062d4e Auto merge of #12229 - Veykril:configfix, r=Veykril
fix: Fix vscode config descriptions not recognizing all valid values
2022-05-12 16:16:20 +00:00
Lukas Wirth
d57beac7e6 fix: Fix vscode config descriptions not recognizing all valid values 2022-05-12 18:15:48 +02:00
bors
1491013417 Auto merge of #12228 - Veykril:configfix, r=Veykril
fix: Fix old config patching overwriting callable snippet config unconditionally
2022-05-12 15:55:50 +00:00
Lukas Wirth
252ffbf77a fix: Fix old config patching overwriting callable snippet config unconditionally 2022-05-12 17:55:25 +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
5901dfdf1b Auto merge of #12224 - Veykril:anno-redundant, r=Veykril
internal: Remove redundant offset data in annotations

cc https://github.com/rust-lang/rust-analyzer/issues/12221
2022-05-12 11:31:11 +00:00
bors
3a69bfd0c2 Auto merge of #12225 - Veykril:tmapfloats, r=Veykril
internal: Add token mapping test for float literals

cc https://github.com/rust-lang/rust-analyzer/issues/12216
2022-05-12 11:18:36 +00:00
Lukas Wirth
4b505ce0f9 internal: Add token mapping test for float literals 2022-05-12 13:17:53 +02:00
Lukas Wirth
ca46c68b04 internal: Remove redundant offset data in annotations 2022-05-12 13:06:49 +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
bors
7a55863c3d Auto merge of #12223 - Veykril:config-stuff, r=Veykril
internal: Rename primeCaches config keys
2022-05-12 10:30:37 +00:00
Lukas Wirth
84176f6b24 internal: Rename primeCaches config keys 2022-05-12 12:30:00 +02:00
bors
d121307977 Auto merge of #12220 - arzg:fix-character-semantic-token, r=arzg
Fix `character` semantic token type definition

The semantic token type for character literals is called `character`:

94fa8a6534/crates/rust-analyzer/src/semantic_tokens.rs (L51)

and yet the definition in `package.json` uses `char`. In practice this means trying to highlight `char` doesn’t have any effect, while `character` doesn’t have any hover documentation and doesn’t appear in autocomplete. The definition also defines the fallback semantic token type as `type`; luckily since it currently references the non-existent `char` this doesn’t have any effect, since it doesn’t really make sense to highlight character literals as types.

This PR fixes the definition in `package.json` to correctly reference `character`, and also defines the fallback type as `number`. I’d say character literals are closer to a shorthand for writing a number than a string, though this is debatable and I’d be happy to change it to `string`, or anything else.
2022-05-12 08:16:46 +00: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
bors
be770a78a2 Auto merge of #12212 - Elliot-Roberts:hint_typo, r=lnicola
Fix a typo in the `inlayHints.renderColons` option description

The description said the same thing twice: "trailing colons for parameter hints, and trailing colons for parameter hints".
I'm assuming one of those is supposed to be about the leading colon for type hints.

Also, I wasn't sure how to regenerate the generated file(s?) so I just manually updated them. Hopefully that isn't a problem. If how to do that is in the documentation somewhere I'd love to know.
2022-05-11 07:26:28 +00:00
Elliot Roberts
2298a76222 fix typo in inlayHints.renderColons option description 2022-05-10 19:15:07 -07:00
bors
b350a1bf6f Auto merge of #12209 - Veykril:config-fix, r=Veykril
fix: Fix config patching failing when appending suffixes
2022-05-10 19:15:06 +00:00
Lukas Wirth
b271ef8fd1 fix: Fix config patching failing when appending suffixes 2022-05-10 21:14:22 +02:00
bors
4d94cf34b8 Auto merge of #12208 - jonas-schievink:assoc-ty-signature-info, r=jonas-schievink
feat: include associated types in trait signature help

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

![screenshot-2022-05-10-16:55:19](https://user-images.githubusercontent.com/1786438/167658642-8df42fba-523a-46fe-a0f6-e0e041b3659d.png)
2022-05-10 14:55:59 +00:00