rust/editors/code
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
..
src Auto merge of #12215 - listochkin:Support-variable-substitution-in-vscode-settings, r=Veykril 2022-05-12 11:05:21 +00:00
tests VSCode variables support for substitutions 2022-05-11 15:50:59 +01:00
.eslintignore
.eslintrc.js Fix eslint errors 2022-02-06 06:52:51 +08:00
.gitignore Add experimental VSCode api 2022-03-04 07:45:51 +02:00
.vscodeignore Prepare Code extension for bundling 2021-12-18 17:44:16 +02:00
icon.png
language-configuration.json fix: remove angle brackets from language configuration 2022-04-20 16:43:24 +02:00
LICENSE Add LICENSE file to make vsce happy 2021-12-04 12:29:27 +02:00
package-lock.json handle references to external environment variables 2022-05-11 15:50:25 +01:00
package.json Auto merge of #12215 - listochkin:Support-variable-substitution-in-vscode-settings, r=Veykril 2022-05-12 11:05:21 +00:00
ra_syntax_tree.tmGrammar.json
README.md Fix typo in VSCode readme 2022-04-30 21:03:51 +03:00
tsconfig.eslint.json Fix eslint errors 2022-02-06 06:52:51 +08:00
tsconfig.json Bump target JS version 2022-04-15 18:18:18 +03:00

rust-analyzer

This extension provides support for the Rust programming language.

Features

Quick start

  1. Install rustup
  2. Install the rust-analyzer extension

Configuration

This extension provides configurations through VSCode's configuration settings. All the configurations are under rust-analyzer.*.

See https://rust-analyzer.github.io/manual.html#vs-code-2 for more information on VSCode specific configurations.

Communication

For usage and troubleshooting requests, please use "IDEs and Editors" category of the Rust forum:

https://users.rust-lang.org/c/ide/14

Documentation

See https://rust-analyzer.github.io/ for more information.