Commit Graph

21879 Commits

Author SHA1 Message Date
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
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
Jonas Schievink
ac3c18bc17 Include assoc. types in trait signature help 2022-05-10 16:54:31 +02:00
Jonas Schievink
92e56e0c70 Fix inverted signature help setting 2022-05-10 16:54:13 +02:00
bors
254bfdd2c3 Auto merge of #12204 - Veykril:completions, r=Veykril
internal: Move keyword expressions to expr completions module
2022-05-10 13:08:27 +00:00
Lukas Wirth
b2abe1bca1 Move keyword expressions to expr completions module 2022-05-10 15:00:58 +02:00
bors
4a4e9c0ae0 Auto merge of #12203 - Veykril:completions, r=Veykril
internal: Simplify
2022-05-10 12:36:46 +00:00
Lukas Wirth
40bb8006cd Don't parse files in module completion 2022-05-10 14:31:43 +02:00
Lukas Wirth
26fef97d59 Simplify 2022-05-10 14:31:28 +02:00
bors
cc695363e4 Auto merge of #12202 - iDawer:ide.sig_help-fix, r=lnicola
fix: don't panic at fully qualified call syntax in signature help

Closes  #12200
Regressed from #12082
2022-05-10 12:28:34 +00:00
iDawer
956b8fb954 signature_help: detect fully qualified call syntax for parameter fallback 2022-05-10 17:18:42 +05: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
cf152e8a94 Auto merge of #12201 - Veykril:inlay-hide, r=Veykril
fix: Add cast expressions to param name inlay hint heuristics
2022-05-10 11:44:06 +00:00
Lukas Wirth
822d9b55b7 fix: Add cast expressions to param name inlay hint heuristics 2022-05-10 13:43:43 +02:00
bors
ad6df5b12e Auto merge of #12199 - jonas-schievink:no-invalid-assoc-ty-completions, r=jonas-schievink
fix: Don't show assoc. type binding completions when invalid

Fixes https://github.com/rust-lang/rust-analyzer/issues/12165
2022-05-09 16:12:47 +00:00
Jonas Schievink
5a2398d775 Don't show assoc. type binding completions when invalid 2022-05-09 18:12:12 +02:00
bors
ab558053f5 Auto merge of #12198 - jonas-schievink:ide-resolve-supertrait-assoc-types, r=jonas-schievink
fix: Resolve assoc. types of supertraits in the IDE layer

Fixes https://github.com/rust-lang/rust-analyzer/issues/12166
2022-05-09 15:40:45 +00:00
Jonas Schievink
2156815f12 Make completion work too 2022-05-09 17:39:13 +02:00
Jonas Schievink
7e45915aa4 Resolve assoc. types of supertraits in the IDE layer 2022-05-09 17:30:49 +02:00
bors
c42cb9af48 Auto merge of #12197 - Veykril:insert-use-fix, r=Veykril
fix: Fix import insertion inserting after last comment in a file
2022-05-09 10:13:08 +00:00
Lukas Wirth
c0feb389ed fix: Fix import insertion inserting after last comment in a file 2022-05-09 12:12:41 +02:00
bors
3d2d209638 Auto merge of #11983 - jhpratt:remove-rustc_deprecated, r=lnicola
Remove handling of `#[rustc_deprecated]`

This should be merged along with rust-lang/rust#95960.

Because the attribute still exists in rustc, I've left the definition here. With that said, any use of it is an error, so I've removed any handling of `#[rustc_deprecated]`.
2022-05-09 08:33:18 +00:00
bors
5d5bbec9b6 Auto merge of #12187 - Veykril:completion-rev, r=Veykril
internal: More completion context refactoring
2022-05-07 14:25:12 +00:00
bors
bfb241afa3 Auto merge of #12188 - Veykril:auto-import, r=Veykril
fix: Allow auto importing starting segments of use items
2022-05-07 14:16:00 +00:00
Lukas Wirth
61e074f016 fix: Allow auto importing starting segments of use items 2022-05-07 15:52:22 +02:00
Lukas Wirth
a0fc649269 fix unreachable pub 2022-05-07 15:50:01 +02:00