mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
handle references to external environment variables
use cross-env to enable env variables on Windows
This commit is contained in:
parent
a86db5d0d1
commit
6c769ac00d
4 changed files with 69 additions and 5 deletions
|
@ -232,7 +232,30 @@ export function substituteVariablesInEnv(env: Env): Env {
|
|||
}));
|
||||
|
||||
const resolved = new Set<string>();
|
||||
// TODO: handle missing dependencies
|
||||
for (const dep of missingDeps) {
|
||||
const match = /(?<prefix>.*?):(?<body>.+)/.exec(dep);
|
||||
if (match) {
|
||||
const { prefix, body } = match.groups!;
|
||||
if (prefix === 'env') {
|
||||
const envName = body;
|
||||
envWithDeps[dep] = {
|
||||
value: process.env[envName] ?? '',
|
||||
deps: []
|
||||
};
|
||||
resolved.add(dep);
|
||||
} else {
|
||||
// we can't handle other prefixes at the moment
|
||||
// leave values as is, but still mark them as resolved
|
||||
envWithDeps[dep] = {
|
||||
value: '${' + dep + '}',
|
||||
deps: []
|
||||
};
|
||||
resolved.add(dep);
|
||||
}
|
||||
} else {
|
||||
// TODO: handle VSCode variables
|
||||
}
|
||||
}
|
||||
const toResolve = new Set(Object.keys(envWithDeps));
|
||||
|
||||
let leftToResolveSize;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue