File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed
Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 1414
1515#### :bug : Bug fix
1616
17+ - Fix Code Analyzer binary lookup for ReScript v12+ projects.
1718- Take namespace into account for incremental cleanup. https://github.com/rescript-lang/rescript-vscode/pull/1164
1819- Potential race condition in incremental compilation. https://github.com/rescript-lang/rescript-vscode/pull/1167
1920- Fix extension crash triggered by incremental compilation. https://github.com/rescript-lang/rescript-vscode/pull/1169
Original file line number Diff line number Diff line change 11import * as cp from "child_process" ;
2+ import * as fs from "fs" ;
23import * as path from "path" ;
34import {
45 window ,
@@ -216,12 +217,27 @@ export const runCodeAnalysisWithReanalyze = (
216217 currentDocument . uri . fsPath ,
217218 ) ;
218219
219- // This little weird lookup is because in the legacy setup reanalyze needs to be
220- // run from the analysis binary, whereas in the new setup it's run from the tools
221- // binary.
222- let binaryPath =
223- getBinaryPath ( "rescript-tools.exe" , projectRootPath ) ??
224- getBinaryPath ( "rescript-editor-analysis.exe" ) ;
220+ // Try v12+ path first: @rescript/{platform}-{arch}/bin/rescript-tools.exe
221+ // Then fall back to legacy paths via getBinaryPath
222+ let binaryPath : string | null = null ;
223+ if ( projectRootPath != null ) {
224+ const v12Path = path . join (
225+ projectRootPath ,
226+ "node_modules" ,
227+ "@rescript" ,
228+ `${ process . platform } -${ process . arch } ` ,
229+ "bin" ,
230+ "rescript-tools.exe" ,
231+ ) ;
232+ if ( fs . existsSync ( v12Path ) ) {
233+ binaryPath = v12Path ;
234+ }
235+ }
236+ if ( binaryPath == null ) {
237+ binaryPath =
238+ getBinaryPath ( "rescript-tools.exe" , projectRootPath ) ??
239+ getBinaryPath ( "rescript-editor-analysis.exe" , projectRootPath ) ;
240+ }
225241
226242 if ( binaryPath === null ) {
227243 window . showErrorMessage ( "Binary executable not found." ) ;
You can’t perform that action at this time.
0 commit comments