Skip to content

Commit 0de66fb

Browse files
committed
some renaming
1 parent d012c04 commit 0de66fb

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/lsptoolshost/roslynLanguageServer.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class RoslynLanguageServer {
116116
this.registerTelemetryChanged();
117117

118118
this._diagnosticsReportedByBuild = vscode.languages.createDiagnosticCollection('csharp-build');
119-
this.addDiagnostics();
119+
this.registerDocumentOpenForDiagnostics();
120120

121121
// Register Razor dynamic file info handling
122122
this.registerDynamicFileInfo();
@@ -705,7 +705,8 @@ export class RoslynLanguageServer {
705705
);
706706
}
707707

708-
private addDiagnostics() {
708+
private registerDocumentOpenForDiagnostics() {
709+
// When a file is opened process any build diagnostics that may be shown
709710
this._languageClient.addDisposable(
710711
vscode.workspace.onDidOpenTextDocument(async (event) => this._onFileOpened(event))
711712
);
@@ -744,12 +745,12 @@ export class RoslynLanguageServer {
744745

745746
private async _onFileOpened(document: vscode.TextDocument) {
746747
const uri = document.uri;
747-
const buildIds = await this.getBuildOnlyDiagnosticIds(CancellationToken.None);
748-
const currentFileBuildDiagnostics = this._allBuildDiagnostics.find(([u]) => this.compareUri(u, uri));
748+
const currentFileBuildDiagnostics = this._allBuildDiagnostics?.find(([u]) => this.compareUri(u, uri));
749749

750750
// The document is now open in the editor and live diagnostics are being shown. Filter diagnostics
751751
// reported by the build to show build-only problems.
752752
if (currentFileBuildDiagnostics) {
753+
const buildIds = await this.getBuildOnlyDiagnosticIds(CancellationToken.None);
753754
const buildDiagnostics = this._getBuildOnlyDiagnostics(currentFileBuildDiagnostics[1], buildIds);
754755
this._diagnosticsReportedByBuild.set(uri, buildDiagnostics);
755756
}

src/lsptoolshost/services/buildResultReporterService.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@ export class BuildResultDiagnostics implements IBuildResultDiagnostics {
1717
constructor(private _languageServerPromise: Promise<RoslynLanguageServer>) {}
1818

1919
public async buildStarted(): Promise<void> {
20-
console.log('build started');
2120
const langServer = await this._languageServerPromise;
2221
langServer.clearDiagnostics();
2322
}
2423

2524
public async reportBuildResult(buildDiagnostics: Array<[Uri, Diagnostic[]]>): Promise<void> {
26-
console.log('received ' + buildDiagnostics.length + ' diagnostics');
27-
2825
const langServer = await this._languageServerPromise;
2926
langServer.setBuildDiagnostics(buildDiagnostics);
3027
}

0 commit comments

Comments
 (0)