Skip to content

Commit 092863d

Browse files
committed
Run incremental typechecking on file open
1 parent f94574d commit 092863d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

server/src/server.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,20 @@ async function onMessage(msg: p.Message) {
14361436
params.textDocument.uri as utils.FileURI,
14371437
params.textDocument.text,
14381438
);
1439-
await sendUpdatedDiagnostics();
1439+
1440+
if (config.extensionConfiguration.incrementalTypechecking?.enable) {
1441+
// We run incremental typechecking to get the most accurate results
1442+
// the current file may have deviated from the last compilation.
1443+
updateOpenedFile(
1444+
params.textDocument.uri as utils.FileURI,
1445+
params.textDocument.text,
1446+
);
1447+
} else {
1448+
// Check the .compiler.log file for diagnostics
1449+
// This could be stale data of course.
1450+
await sendUpdatedDiagnostics();
1451+
}
1452+
14401453
await updateDiagnosticSyntax(
14411454
params.textDocument.uri as utils.FileURI,
14421455
params.textDocument.text,

0 commit comments

Comments
 (0)