Skip to content

Commit 30b57e0

Browse files
committed
Fixed inconsistency between diagnostic tracking and publishing.
1 parent 36121d6 commit 30b57e0

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

server/src/incrementalCompilation.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -653,17 +653,17 @@ async function compileContents(
653653

654654
const fileUri = utils.pathToURI(entry.file.sourceFilePath);
655655

656+
// Get compiler diagnostics from main build (if any) and combine with incremental diagnostics
657+
const compilerDiagnosticsForFile =
658+
getCurrentCompilerDiagnosticsForFile(fileUri);
659+
const allDiagnostics = [...res, ...compilerDiagnosticsForFile];
660+
656661
// Update filesWithDiagnostics to track this file
657662
// entry.project.rootPath is guaranteed to match a key in projectsFiles
658663
// (see triggerIncrementalCompilationOfFile where the entry is created)
659664
const projectFile = projectsFiles.get(entry.project.rootPath);
660665

661666
if (projectFile != null) {
662-
// Get compiler diagnostics from main build (if any)
663-
const compilerDiagnosticsForFile =
664-
getCurrentCompilerDiagnosticsForFile(fileUri);
665-
const allDiagnostics = [...res, ...compilerDiagnosticsForFile];
666-
667667
if (allDiagnostics.length > 0) {
668668
projectFile.filesWithDiagnostics.add(fileUri);
669669
} else {
@@ -677,7 +677,7 @@ async function compileContents(
677677
method: "textDocument/publishDiagnostics",
678678
params: {
679679
uri: fileUri,
680-
diagnostics: res,
680+
diagnostics: allDiagnostics,
681681
},
682682
};
683683
send(notification);

server/src/lookup.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ export const findFilePathFromProjectRoot = (
6060
}
6161

6262
const parentDir = normalizePath(parentDirStr);
63-
if (parentDir == null) {
64-
return null;
65-
}
6663

6764
return findFilePathFromProjectRoot(parentDir, filePartialPath);
6865
};
@@ -153,9 +150,6 @@ export const getFilenameFromRootBsconfig = (
153150
): NormalizedPath | null => {
154151
// Start searching from the parent directory of projDir to find the workspace root
155152
const parentDir = normalizePath(path.dirname(projDir));
156-
if (parentDir == null) {
157-
return null;
158-
}
159153

160154
let rootConfigPath = findFilePathFromProjectRoot(
161155
parentDir,

0 commit comments

Comments
 (0)