diff options
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r-- | editors/code/src/main.ts | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 282240d84..694da9409 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -105,6 +105,7 @@ async function tryActivate(context: vscode.ExtensionContext) { | |||
105 | ctx.registerCommand('joinLines', commands.joinLines); | 105 | ctx.registerCommand('joinLines', commands.joinLines); |
106 | ctx.registerCommand('parentModule', commands.parentModule); | 106 | ctx.registerCommand('parentModule', commands.parentModule); |
107 | ctx.registerCommand('syntaxTree', commands.syntaxTree); | 107 | ctx.registerCommand('syntaxTree', commands.syntaxTree); |
108 | ctx.registerCommand('viewHir', commands.viewHir); | ||
108 | ctx.registerCommand('expandMacro', commands.expandMacro); | 109 | ctx.registerCommand('expandMacro', commands.expandMacro); |
109 | ctx.registerCommand('run', commands.run); | 110 | ctx.registerCommand('run', commands.run); |
110 | ctx.registerCommand('debug', commands.debug); | 111 | ctx.registerCommand('debug', commands.debug); |
@@ -166,6 +167,7 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi | |||
166 | } | 167 | } |
167 | return; | 168 | return; |
168 | }; | 169 | }; |
170 | if (serverPath(config) !== null) return; | ||
169 | 171 | ||
170 | const now = Date.now(); | 172 | const now = Date.now(); |
171 | if (config.package.releaseTag === NIGHTLY_TAG) { | 173 | if (config.package.releaseTag === NIGHTLY_TAG) { |
@@ -277,7 +279,7 @@ async function patchelf(dest: PathLike): Promise<void> { | |||
277 | } | 279 | } |
278 | 280 | ||
279 | async function getServer(config: Config, state: PersistentState): Promise<string | undefined> { | 281 | async function getServer(config: Config, state: PersistentState): Promise<string | undefined> { |
280 | const explicitPath = process.env.__RA_LSP_SERVER_DEBUG ?? config.serverPath; | 282 | const explicitPath = serverPath(config); |
281 | if (explicitPath) { | 283 | if (explicitPath) { |
282 | if (explicitPath.startsWith("~/")) { | 284 | if (explicitPath.startsWith("~/")) { |
283 | return os.homedir() + explicitPath.slice("~".length); | 285 | return os.homedir() + explicitPath.slice("~".length); |
@@ -286,16 +288,15 @@ async function getServer(config: Config, state: PersistentState): Promise<string | |||
286 | }; | 288 | }; |
287 | if (config.package.releaseTag === null) return "rust-analyzer"; | 289 | if (config.package.releaseTag === null) return "rust-analyzer"; |
288 | 290 | ||
289 | let platform: string | undefined; | 291 | const platforms: { [key: string]: string } = { |
290 | if ((process.arch === "x64" || process.arch === "ia32") && process.platform === "win32") { | 292 | "ia32 win32": "x86_64-pc-windows-msvc", |
291 | platform = "x86_64-pc-windows-msvc"; | 293 | "x64 win32": "x86_64-pc-windows-msvc", |
292 | } else if (process.arch === "x64" && process.platform === "linux") { | 294 | "x64 linux": "x86_64-unknown-linux-gnu", |
293 | platform = "x86_64-unknown-linux-gnu"; | 295 | "x64 darwin": "x86_64-apple-darwin", |
294 | } else if (process.arch === "x64" && process.platform === "darwin") { | 296 | "arm64 win32": "aarch64-pc-windows-msvc", |
295 | platform = "x86_64-apple-darwin"; | 297 | "arm64 darwin": "aarch64-apple-darwin", |
296 | } else if (process.arch === "arm64" && process.platform === "darwin") { | 298 | }; |
297 | platform = "aarch64-apple-darwin"; | 299 | const platform = platforms[`${process.arch} ${process.platform}`]; |
298 | } | ||
299 | if (platform === undefined) { | 300 | if (platform === undefined) { |
300 | vscode.window.showErrorMessage( | 301 | vscode.window.showErrorMessage( |
301 | "Unfortunately we don't ship binaries for your platform yet. " + | 302 | "Unfortunately we don't ship binaries for your platform yet. " + |
@@ -351,6 +352,10 @@ async function getServer(config: Config, state: PersistentState): Promise<string | |||
351 | return dest; | 352 | return dest; |
352 | } | 353 | } |
353 | 354 | ||
355 | function serverPath(config: Config): string | null { | ||
356 | return process.env.__RA_LSP_SERVER_DEBUG ?? config.serverPath; | ||
357 | } | ||
358 | |||
354 | async function isNixOs(): Promise<boolean> { | 359 | async function isNixOs(): Promise<boolean> { |
355 | try { | 360 | try { |
356 | const contents = await fs.readFile("/etc/os-release"); | 361 | const contents = await fs.readFile("/etc/os-release"); |