-
Notifications
You must be signed in to change notification settings - Fork 166
Error squiggles for Cargo.toml when build.rs requires environment variable #791
Comments
I have the same problem because I need to set the It feels like lots of people have been struggling with this limitation for many years but not getting any traction figuring out a good solution. E.g. some related issues I came across: rust-lang/cargo#97 |
Yay, I'm not alone! |
For reference I've proposed one way that Cargo could ideally help here to avoid the need for configuring all the various IDEs to see the same environment. rust-lang/cargo#4121 (comment) The basic idea is that Cargo would check for an |
Some custom build scripts (especially for -sys packages) expect to query environment variables to locate build resources (such as pre-built binaries) but these cause lots of trouble when considering the numerous different ways in which cargo may be invoked. For example each editor that invokes cargo as part of providing development diagnostics needs to offer some way to configure environment variables or users need to find their own way of controlling the environment variables of these different tools which is burdensome and can lead to an inconsistent duplication of state across tools. This introduces support for reading an (optional) environment.json found at the root of the current workspace that may contain a map of environment variable key, value pairs. These variables will be exported to all build scripts run under the workspace. The removes any need to configure tools and editors independently. The configuration is separate from any Config.toml since it's likely that the state shouldn't be under version control in many situations (generally locating resources for the project within a specific user's development environment). Fixes: rust-lang/issues/4121 Fixes: rust-lang/rls/issues/915 Fixes: rust-lang/vscode-rust/issues/791 Fixes: rust-lang/rust-analyzer/pull/6099 Fixes: intellij-rust/intellij-rust/issues/1569
Even with a custom build command (and ctrl-shift-b succeeding), Cargo.toml still renders everything with red squiggles under everything telling me that the package failed to build, i.e.
My tasks.json is:
The text was updated successfully, but these errors were encountered: