diff --git a/CHANGELOG.md b/CHANGELOG.md index d09516c37..4b998cdcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ ## master +#### :bug: Bug fix + +- Fix: bug where incremental analysis does not work when the project folder contains a dot. https://github.com/rescript-lang/rescript-vscode/pull/1080 + ## 1.62.0 #### :nail_care: Polish diff --git a/server/src/server.ts b/server/src/server.ts index 1c74132e7..d7800c048 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -268,7 +268,7 @@ let openedFile = (fileUri: string, fileContent: string) => { filesDiagnostics: {}, namespaceName: namespaceName.kind === "success" ? namespaceName.result : null, - rescriptVersion: utils.findReScriptVersion(projectRootPath), + rescriptVersion: utils.findReScriptVersionForProjectRoot(projectRootPath), bsbWatcherByEditor: null, bscBinaryLocation: utils.findBscExeBinary(projectRootPath), editorAnalysisLocation: utils.findEditorAnalysisBinary(projectRootPath), diff --git a/server/src/utils.ts b/server/src/utils.ts index 5de85abfc..a6dd745ef 100644 --- a/server/src/utils.ts +++ b/server/src/utils.ts @@ -165,6 +165,24 @@ export let findReScriptVersion = ( } }; +export function findReScriptVersionForProjectRoot(projectRootPath:string) : string | undefined { + let rescriptBinary = lookup.findFilePathFromProjectRoot( + projectRootPath, + path.join(c.nodeModulesBinDir, c.rescriptBinName) + ); + + if (rescriptBinary == null) { + return undefined; + } + + try { + let version = childProcess.execSync(`${rescriptBinary} -v`); + return version.toString().trim(); + } catch (e) { + return undefined; + } +} + // This is the path for the _builtin_ legacy analysis, that works for versions 11 and below. let builtinBinaryPath: string | null = null; if (fs.existsSync(c.builtinAnalysisDevPath)) {