Skip to content

Commit 1044341

Browse files
committed
Harden telemetryOnOpenFile against disabled projects
As for syntax-only servers, we can't meaningfully report open-file telemetry for projects with disabled language services. Hopefully, a deeper fix will follow, but this solves the immediate problem that VS disables the LS for all projects when it sees a failure in applyChangedToOpenFiles (because it assumes the server state is corrupt).
1 parent d4055a3 commit 1044341

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/server/editorServices.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2777,7 +2777,12 @@ namespace ts.server {
27772777
return;
27782778
}
27792779

2780-
const info: OpenFileInfo = { checkJs: !!scriptInfo.getDefaultProject().getSourceFile(scriptInfo.path)!.checkJsDirective };
2780+
const project = scriptInfo.getDefaultProject();
2781+
if (!project.languageServiceEnabled) {
2782+
return;
2783+
}
2784+
2785+
const info: OpenFileInfo = { checkJs: !!project.getSourceFile(scriptInfo.path)!.checkJsDirective };
27812786
this.eventHandler({ eventName: OpenFileInfoTelemetryEvent, data: { info } });
27822787
}
27832788

0 commit comments

Comments
 (0)