File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,14 @@ export const runCodeAnalysisWithReanalyze = (
211
211
let projectRootPath : string | null = findProjectRootOfFileInDir (
212
212
currentDocument . uri . fsPath
213
213
) ;
214
- let binaryPath = getBinaryPath ( "rescript-tools.exe" , projectRootPath ) ;
214
+
215
+ // This little weird lookup is because in the legacy setup reanalyze needs to be
216
+ // run from the analysis binary, whereas in the new setup it's run from the tools
217
+ // binary.
218
+ let binaryPath =
219
+ getBinaryPath ( "rescript-tools.exe" , projectRootPath ) ??
220
+ getBinaryPath ( "rescript-editor-analysis.exe" ) ;
221
+
215
222
if ( binaryPath === null ) {
216
223
window . showErrorMessage ( "Binary executable not found." ) ;
217
224
return ;
Original file line number Diff line number Diff line change @@ -29,17 +29,17 @@ export const getLegacyBinaryProdPath = (b: binaryName) =>
29
29
30
30
export const getBinaryPath = (
31
31
binaryName : "rescript-editor-analysis.exe" | "rescript-tools.exe" ,
32
- projectRootPath : string
32
+ projectRootPath : string | null = null
33
33
) : string | null => {
34
34
const binaryFromCompilerPackage = path . join (
35
- projectRootPath ,
35
+ projectRootPath ?? "" ,
36
36
"node_modules" ,
37
37
"rescript" ,
38
38
platformDir ,
39
39
binaryName
40
40
) ;
41
41
42
- if ( fs . existsSync ( binaryFromCompilerPackage ) ) {
42
+ if ( projectRootPath != null && fs . existsSync ( binaryFromCompilerPackage ) ) {
43
43
return binaryFromCompilerPackage ;
44
44
} else if ( fs . existsSync ( getLegacyBinaryDevPath ( binaryName ) ) ) {
45
45
return getLegacyBinaryDevPath ( binaryName ) ;
You can’t perform that action at this time.
0 commit comments