@@ -13,20 +13,6 @@ export function createClient(
13
13
) {
14
14
let serverExecPath : string ;
15
15
16
- if ( process . arch == 'arm64' && process . platform == 'darwin' ) {
17
- // On arm64 darwin use the x64 darwin executable thanks to Apple Rosetta.
18
- serverExecPath = context . asAbsolutePath ( `x64/darwin/ada_language_server` ) ;
19
- } else {
20
- serverExecPath = context . asAbsolutePath (
21
- `${ process . arch } /${ process . platform } /ada_language_server`
22
- ) ;
23
- }
24
-
25
- if ( process . platform == 'win32' ) {
26
- // Add the extension for the file lookup further below
27
- serverExecPath = `${ serverExecPath } .exe` ;
28
- }
29
-
30
16
// If the ALS environment variable is specified, use it as the path of the
31
17
// server executable.
32
18
if ( process . env . ALS ) {
@@ -39,6 +25,28 @@ export function createClient(
39
25
) ;
40
26
}
41
27
} else {
28
+ serverExecPath = context . asAbsolutePath (
29
+ `${ process . arch } /${ process . platform } /ada_language_server`
30
+ ) ;
31
+
32
+ if ( process . arch == 'arm64' && process . platform == 'darwin' ) {
33
+ // On arm64 darwin check if the executable exists, and if not, try to
34
+ // fallback to the x64 darwin executable thanks to Apple Rosetta.
35
+ if ( ! existsSync ( serverExecPath ) ) {
36
+ // The arm64 executable doesn't exist. Try x86.
37
+ const alternateExecPath = context . asAbsolutePath (
38
+ `x64/${ process . platform } /ada_language_server`
39
+ ) ;
40
+ if ( existsSync ( alternateExecPath ) ) {
41
+ // The x86 executable exists, use that instead.
42
+ serverExecPath = alternateExecPath ;
43
+ }
44
+ }
45
+ } else if ( process . platform == 'win32' ) {
46
+ // Add the extension for the file lookup further below
47
+ serverExecPath = `${ serverExecPath } .exe` ;
48
+ }
49
+
42
50
if ( ! existsSync ( serverExecPath ) ) {
43
51
logErrorAndThrow (
44
52
`This installation of the Ada extension does not have the Ada ` +
0 commit comments