927ef0ce7e
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 |
||
---|---|---|
.. | ||
src | ||
tests | ||
.eslintignore | ||
.eslintrc.js | ||
.gitignore | ||
.vscodeignore | ||
icon.png | ||
language-configuration.json | ||
LICENSE | ||
package-lock.json | ||
package.json | ||
ra_syntax_tree.tmGrammar.json | ||
README.md | ||
tsconfig.eslint.json | ||
tsconfig.json |
rust-analyzer
This extension provides support for the Rust programming language.
Features
- code completion with imports insertion
- go to definition, implementation, type definition
- find all references, workspace symbol search, symbol renaming
- types and documentation on hover
- inlay hints for types and parameter names
- semantic syntax highlighting
- a lot of assists(code actions)
- apply suggestions from errors
- ... and many more, checkout the manual to see them all
Quick start
- Install rustup
- 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.