mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Merge commit 'baee6b338b
' into sync-from-ra
This commit is contained in:
parent
0155385b57
commit
aa55ce9567
139 changed files with 4248 additions and 1042 deletions
10
editors/code/package-lock.json
generated
10
editors/code/package-lock.json
generated
|
@ -18,7 +18,7 @@
|
|||
"devDependencies": {
|
||||
"@tsconfig/strictest": "^2.0.1",
|
||||
"@types/node": "~16.11.7",
|
||||
"@types/vscode": "~1.78.1",
|
||||
"@types/vscode": "~1.75",
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"@vscode/test-electron": "^2.3.3",
|
||||
|
@ -32,7 +32,7 @@
|
|||
"typescript": "^5.1.6"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.78.0"
|
||||
"vscode": "^1.75.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@aashutoshrathi/word-wrap": {
|
||||
|
@ -565,9 +565,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/@types/vscode": {
|
||||
"version": "1.78.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.78.1.tgz",
|
||||
"integrity": "sha512-wEA+54axejHu7DhcUfnFBan1IqFD1gBDxAFz8LoX06NbNDMRJv/T6OGthOs52yZccasKfN588EyffHWABkR0fg==",
|
||||
"version": "1.75.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.75.1.tgz",
|
||||
"integrity": "sha512-emg7wdsTFzdi+elvoyoA+Q8keEautdQHyY5LNmHVM4PTpY8JgOTVADrGVyXGepJ6dVW2OS5/xnLUWh+nZxvdiA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
}
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.78.0"
|
||||
"vscode": "^1.75.0"
|
||||
},
|
||||
"enabledApiProposals": [],
|
||||
"scripts": {
|
||||
|
@ -53,7 +53,7 @@
|
|||
"devDependencies": {
|
||||
"@tsconfig/strictest": "^2.0.1",
|
||||
"@types/node": "~16.11.7",
|
||||
"@types/vscode": "~1.78.1",
|
||||
"@types/vscode": "~1.75",
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"@vscode/test-electron": "^2.3.3",
|
||||
|
@ -328,6 +328,15 @@
|
|||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"platform": {
|
||||
"type": [
|
||||
"null",
|
||||
"string",
|
||||
"array"
|
||||
],
|
||||
"default": null,
|
||||
"markdownDescription": "Platform(s) filter like \"win32\" or [\"linux\", \"win32\"]. See [process.platform](https://nodejs.org/api/process.html#processplatform) values."
|
||||
},
|
||||
"mask": {
|
||||
"type": "string",
|
||||
"description": "Runnable name mask"
|
||||
|
|
|
@ -6,10 +6,12 @@ import type { Env } from "./client";
|
|||
import { log } from "./util";
|
||||
import { expectNotUndefined, unwrapUndefinable } from "./undefinable";
|
||||
|
||||
export type RunnableEnvCfg =
|
||||
| undefined
|
||||
| Record<string, string>
|
||||
| { mask?: string; env: Record<string, string> }[];
|
||||
export type RunnableEnvCfgItem = {
|
||||
mask?: string;
|
||||
env: Record<string, string>;
|
||||
platform?: string | string[];
|
||||
};
|
||||
export type RunnableEnvCfg = undefined | Record<string, string> | RunnableEnvCfgItem[];
|
||||
|
||||
export class Config {
|
||||
readonly extensionId = "rust-lang.rust-analyzer";
|
||||
|
|
|
@ -414,7 +414,7 @@ export class Ctx {
|
|||
statusBar.tooltip.appendText(status.message ?? "Ready");
|
||||
statusBar.color = undefined;
|
||||
statusBar.backgroundColor = undefined;
|
||||
statusBar.command = "rust-analyzer.stopServer";
|
||||
statusBar.command = "rust-analyzer.openLogs";
|
||||
this.dependencies?.refresh();
|
||||
break;
|
||||
case "warning":
|
||||
|
@ -442,14 +442,16 @@ export class Ctx {
|
|||
statusBar.tooltip.appendMarkdown(
|
||||
"\n\n[Start server](command:rust-analyzer.startServer)",
|
||||
);
|
||||
statusBar.color = undefined;
|
||||
statusBar.backgroundColor = undefined;
|
||||
statusBar.color = new vscode.ThemeColor("statusBarItem.warningForeground");
|
||||
statusBar.backgroundColor = new vscode.ThemeColor(
|
||||
"statusBarItem.warningBackground",
|
||||
);
|
||||
statusBar.command = "rust-analyzer.startServer";
|
||||
statusBar.text = `$(stop-circle) rust-analyzer`;
|
||||
return;
|
||||
}
|
||||
if (statusBar.tooltip.value) {
|
||||
statusBar.tooltip.appendText("\n\n");
|
||||
statusBar.tooltip.appendMarkdown("\n\n---\n\n");
|
||||
}
|
||||
statusBar.tooltip.appendMarkdown("\n\n[Open logs](command:rust-analyzer.openLogs)");
|
||||
statusBar.tooltip.appendMarkdown(
|
||||
|
|
|
@ -5,7 +5,7 @@ import * as tasks from "./tasks";
|
|||
|
||||
import type { CtxInit } from "./ctx";
|
||||
import { makeDebugConfig } from "./debug";
|
||||
import type { Config, RunnableEnvCfg } from "./config";
|
||||
import type { Config, RunnableEnvCfg, RunnableEnvCfgItem } from "./config";
|
||||
import { unwrapUndefinable } from "./undefinable";
|
||||
|
||||
const quickPickButtons = [
|
||||
|
@ -112,11 +112,21 @@ export function prepareEnv(
|
|||
}
|
||||
|
||||
Object.assign(env, process.env as { [key: string]: string });
|
||||
const platform = process.platform;
|
||||
|
||||
const checkPlatform = (it: RunnableEnvCfgItem) => {
|
||||
if (it.platform) {
|
||||
const platforms = Array.isArray(it.platform) ? it.platform : [it.platform];
|
||||
return platforms.indexOf(platform) >= 0;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
if (runnableEnvCfg) {
|
||||
if (Array.isArray(runnableEnvCfg)) {
|
||||
for (const it of runnableEnvCfg) {
|
||||
if (!it.mask || new RegExp(it.mask).test(runnable.label)) {
|
||||
const masked = !it.mask || new RegExp(it.mask).test(runnable.label);
|
||||
if (masked && checkPlatform(it)) {
|
||||
Object.assign(env, it.env);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue