diff --git a/CHANGELOG.md b/CHANGELOG.md index 87a8db194..c0228c0f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,18 @@ ## master +#### :bug: Bug Fix + +- Fix a regression with incremental typechecking in monorepos with rewatch, where the workspace directory was not properly set. + +#### :bug: Bug Fix + +- When log files are deleted (due to a clean), the editor tooling doesn't crash anymore + +#### :rocket: New Feature + +- Support for the `namespace-entry` feature of rewatch, to allow entrypoint modules for namespaced packages. + ## 1.54.0 #### :nail_care: Polish diff --git a/analysis/src/FindFiles.ml b/analysis/src/FindFiles.ml index fc3556e0a..7efdeab64 100644 --- a/analysis/src/FindFiles.ml +++ b/analysis/src/FindFiles.ml @@ -95,6 +95,7 @@ let nameSpaceToName n = let getNamespace config = let ns = config |> Json.get "namespace" in + let namespaceEntry = config |> Json.get "namespace-entry" in let fromString = ns |> bind Json.string in let isNamespaced = ns |> bind Json.bool |> Option.value ~default:(fromString |> Option.is_some) @@ -102,7 +103,10 @@ let getNamespace config = let either x y = if x = None then y else x in if isNamespaced then let fromName = config |> Json.get "name" |> bind Json.string in - either fromString fromName |> Option.map nameSpaceToName + let name = either fromString fromName |> Option.map nameSpaceToName in + match (namespaceEntry, name) with + | Some _, Some name -> Some ("@" ^ name) + | _ -> name else None module StringSet = Set.Make (String) diff --git a/server/src/incrementalCompilation.ts b/server/src/incrementalCompilation.ts index 3684f9d92..0fad494a6 100644 --- a/server/src/incrementalCompilation.ts +++ b/server/src/incrementalCompilation.ts @@ -376,7 +376,7 @@ function triggerIncrementalCompilationOfFile( return; } const workspaceRootPath = projectRootPath - ? utils.findProjectRootOfFile(projectRootPath) + ? utils.findProjectRootOfFile(projectRootPath, true) : null; const bscBinaryLocation = project.bscBinaryLocation; diff --git a/server/src/server.ts b/server/src/server.ts index 9a925a695..31f413b0e 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -227,13 +227,17 @@ let compilerLogsWatcher = chokidar } } } else { - sendUpdatedDiagnostics(); - sendCompilationFinishedMessage(); - if (config.extensionConfiguration.inlayHints?.enable === true) { - sendInlayHintsRefresh(); - } - if (config.extensionConfiguration.codeLens === true) { - sendCodeLensRefresh(); + try { + sendUpdatedDiagnostics(); + sendCompilationFinishedMessage(); + if (config.extensionConfiguration.inlayHints?.enable === true) { + sendInlayHintsRefresh(); + } + if (config.extensionConfiguration.codeLens === true) { + sendCodeLensRefresh(); + } + } catch { + console.log("Error while sending updated diagnostics"); } } }); diff --git a/server/src/utils.ts b/server/src/utils.ts index d8df66cd8..46c1afbec 100644 --- a/server/src/utils.ts +++ b/server/src/utils.ts @@ -47,13 +47,14 @@ let findProjectRootOfFileInDir = ( // TODO: races here? // TODO: this doesn't handle file:/// scheme export let findProjectRootOfFile = ( - source: p.DocumentUri + source: p.DocumentUri, + skipParent?: boolean ): null | p.DocumentUri => { // First look in project files let foundRootFromProjectFiles: string | null = null; for (const rootPath of projectsFiles.keys()) { - if (source.startsWith(rootPath)) { + if (source.startsWith(rootPath) && (!skipParent || source !== rootPath)) { // Prefer the longest path (most nested) if ( foundRootFromProjectFiles == null ||