File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1
1
import * as path from "path" ;
2
2
3
- let platformDir =
3
+ export let platformDir =
4
4
process . arch == "arm64" ? process . platform + process . arch : process . platform ;
5
5
6
6
// See https://microsoft.github.io/language-server-protocol/specification Abstract Message
Original file line number Diff line number Diff line change @@ -108,12 +108,28 @@ let findRescriptBinary = (projectRootPath: p.DocumentUri) =>
108
108
let findBscBinary = ( projectRootPath : p . DocumentUri ) => {
109
109
let rescriptBinaryPath = findRescriptBinary ( projectRootPath ) ;
110
110
if ( rescriptBinaryPath !== null ) {
111
- return path . join (
111
+ let rescriptDirPath = path . join (
112
112
path . dirname ( rescriptBinaryPath ) ,
113
113
".." ,
114
- c . platformPath ,
115
- c . bscExeName
114
+ "rescript"
116
115
) ;
116
+
117
+ let bscBinaryPath = path . join ( rescriptDirPath , c . platformDir , c . bscExeName ) ;
118
+
119
+ // Workaround for darwinarm64 which has no folder yet in ReScript <= 9.1.4
120
+ if (
121
+ process . platform == "darwin" &&
122
+ process . arch == "arm64" &&
123
+ ! fs . existsSync ( bscBinaryPath )
124
+ ) {
125
+ bscBinaryPath = path . join (
126
+ rescriptDirPath ,
127
+ process . platform ,
128
+ c . bscExeName
129
+ ) ;
130
+ }
131
+
132
+ return bscBinaryPath ;
117
133
}
118
134
return null ;
119
135
} ;
You can’t perform that action at this time.
0 commit comments