aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/package.json12
-rw-r--r--editors/code/src/config.ts4
-rw-r--r--editors/code/src/main.ts26
3 files changed, 28 insertions, 14 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 3e55a3523..3e6ebd7ed 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -280,7 +280,7 @@
280 "default": true, 280 "default": true,
281 "description": "Whether to ask for permission before downloading any files from the Internet." 281 "description": "Whether to ask for permission before downloading any files from the Internet."
282 }, 282 },
283 "rust-analyzer.serverPath": { 283 "rust-analyzer.server.path": {
284 "type": [ 284 "type": [
285 "null", 285 "null",
286 "string" 286 "string"
@@ -349,7 +349,7 @@
349 "default": {}, 349 "default": {},
350 "markdownDescription": "Optional settings passed to the debug engine. Example: `{ \"lldb\": { \"terminal\":\"external\"} }`" 350 "markdownDescription": "Optional settings passed to the debug engine. Example: `{ \"lldb\": { \"terminal\":\"external\"} }`"
351 }, 351 },
352 "rust-analyzer.assist.importMergeBehaviour": { 352 "rust-analyzer.assist.importMergeBehavior": {
353 "markdownDescription": "The strategy to use when inserting new imports or merging imports.", 353 "markdownDescription": "The strategy to use when inserting new imports or merging imports.",
354 "default": "full", 354 "default": "full",
355 "type": "string", 355 "type": "string",
@@ -663,6 +663,14 @@
663 "default": false, 663 "default": false,
664 "type": "boolean" 664 "type": "boolean"
665 }, 665 },
666 "rust-analyzer.procMacro.server": {
667 "markdownDescription": "Internal config, path to proc-macro server executable (typically, this is rust-analyzer itself, but we override this in tests).",
668 "default": null,
669 "type": [
670 "null",
671 "string"
672 ]
673 },
666 "rust-analyzer.runnables.overrideCargo": { 674 "rust-analyzer.runnables.overrideCargo": {
667 "markdownDescription": "Command to be executed instead of 'cargo' for runnables.", 675 "markdownDescription": "Command to be executed instead of 'cargo' for runnables.",
668 "default": null, 676 "default": null,
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index fe9f3b4a8..ebe4de1ea 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -93,7 +93,9 @@ export class Config {
93 return this.cfg.get<T>(path)!; 93 return this.cfg.get<T>(path)!;
94 } 94 }
95 95
96 get serverPath() { return this.get<null | string>("serverPath"); } 96 get serverPath() {
97 return this.get<null | string>("server.path") ?? this.get<null | string>("serverPath");
98 }
97 get serverExtraEnv() { return this.get<Env | null>("server.extraEnv") ?? {}; } 99 get serverExtraEnv() { return this.get<Env | null>("server.extraEnv") ?? {}; }
98 get channel() { return this.get<UpdatesChannel>("updates.channel"); } 100 get channel() { return this.get<UpdatesChannel>("updates.channel"); }
99 get askBeforeDownload() { return this.get<boolean>("updates.askBeforeDownload"); } 101 get askBeforeDownload() { return this.get<boolean>("updates.askBeforeDownload"); }
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 60907dfd4..694da9409 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -167,6 +167,7 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
167 } 167 }
168 return; 168 return;
169 }; 169 };
170 if (serverPath(config) !== null) return;
170 171
171 const now = Date.now(); 172 const now = Date.now();
172 if (config.package.releaseTag === NIGHTLY_TAG) { 173 if (config.package.releaseTag === NIGHTLY_TAG) {
@@ -278,7 +279,7 @@ async function patchelf(dest: PathLike): Promise<void> {
278} 279}
279 280
280async function getServer(config: Config, state: PersistentState): Promise<string | undefined> { 281async function getServer(config: Config, state: PersistentState): Promise<string | undefined> {
281 const explicitPath = process.env.__RA_LSP_SERVER_DEBUG ?? config.serverPath; 282 const explicitPath = serverPath(config);
282 if (explicitPath) { 283 if (explicitPath) {
283 if (explicitPath.startsWith("~/")) { 284 if (explicitPath.startsWith("~/")) {
284 return os.homedir() + explicitPath.slice("~".length); 285 return os.homedir() + explicitPath.slice("~".length);
@@ -287,16 +288,15 @@ async function getServer(config: Config, state: PersistentState): Promise<string
287 }; 288 };
288 if (config.package.releaseTag === null) return "rust-analyzer"; 289 if (config.package.releaseTag === null) return "rust-analyzer";
289 290
290 let platform: string | undefined; 291 const platforms: { [key: string]: string } = {
291 if ((process.arch === "x64" || process.arch === "ia32") && process.platform === "win32") { 292 "ia32 win32": "x86_64-pc-windows-msvc",
292 platform = "x86_64-pc-windows-msvc"; 293 "x64 win32": "x86_64-pc-windows-msvc",
293 } else if (process.arch === "x64" && process.platform === "linux") { 294 "x64 linux": "x86_64-unknown-linux-gnu",
294 platform = "x86_64-unknown-linux-gnu"; 295 "x64 darwin": "x86_64-apple-darwin",
295 } else if (process.arch === "x64" && process.platform === "darwin") { 296 "arm64 win32": "aarch64-pc-windows-msvc",
296 platform = "x86_64-apple-darwin"; 297 "arm64 darwin": "aarch64-apple-darwin",
297 } else if (process.arch === "arm64" && process.platform === "darwin") { 298 };
298 platform = "aarch64-apple-darwin"; 299 const platform = platforms[`${process.arch} ${process.platform}`];
299 }
300 if (platform === undefined) { 300 if (platform === undefined) {
301 vscode.window.showErrorMessage( 301 vscode.window.showErrorMessage(
302 "Unfortunately we don't ship binaries for your platform yet. " + 302 "Unfortunately we don't ship binaries for your platform yet. " +
@@ -352,6 +352,10 @@ async function getServer(config: Config, state: PersistentState): Promise<string
352 return dest; 352 return dest;
353} 353}
354 354
355function serverPath(config: Config): string | null {
356 return process.env.__RA_LSP_SERVER_DEBUG ?? config.serverPath;
357}
358
355async function isNixOs(): Promise<boolean> { 359async function isNixOs(): Promise<boolean> {
356 try { 360 try {
357 const contents = await fs.readFile("/etc/os-release"); 361 const contents = await fs.readFile("/etc/os-release");