@@ -13,7 +13,7 @@ export enum AnalysisSetting {
1313
1414export class BuildDiagnosticsService {
1515 /** All the build results sent by the DevKit extension. */
16- private _allBuildDiagnostics : Array < [ vscode . Uri , vscode . Diagnostic [ ] ] > = [ ] ;
16+ private _allBuildDiagnostics : { [ uri : string ] : vscode . Diagnostic [ ] } = { } ;
1717
1818 /** The diagnostic results from build displayed by VS Code. When live diagnostics are available for a file, these are errors that only build knows about.
1919 * When live diagnostics aren't loaded for a file, then these are all of the diagnostics reported by the build.*/
@@ -27,19 +27,14 @@ export class BuildDiagnosticsService {
2727 this . _diagnosticsReportedByBuild . clear ( ) ;
2828 }
2929
30- public async setBuildDiagnostics (
31- buildDiagnostics : Array < [ vscode . Uri , vscode . Diagnostic [ ] ] > ,
32- buildOnlyIds : string [ ]
33- ) {
30+ public async setBuildDiagnostics ( buildDiagnostics : { [ uri : string ] : vscode . Diagnostic [ ] } , buildOnlyIds : string [ ] ) {
3431 this . _allBuildDiagnostics = buildDiagnostics ;
3532 const displayedBuildDiagnostics = new Array < [ vscode . Uri , vscode . Diagnostic [ ] ] > ( ) ;
3633 const allDocuments = vscode . workspace . textDocuments ;
3734
38- this . _allBuildDiagnostics . forEach ( ( fileDiagnostics ) => {
39- const uri = fileDiagnostics [ 0 ] ;
40- const diagnosticList = fileDiagnostics [ 1 ] ;
41-
35+ for ( const [ uriPath , diagnosticList ] of Object . entries ( this . _allBuildDiagnostics ) ) {
4236 // Check if the document is open
37+ const uri = vscode . Uri . file ( uriPath ) ;
4338 const document = allDocuments . find ( ( d ) => this . compareUri ( d . uri , uri ) ) ;
4439 const isDocumentOpen = document !== undefined ? ! document . isClosed : false ;
4540
@@ -48,7 +43,7 @@ export class BuildDiagnosticsService {
4843 uri ,
4944 BuildDiagnosticsService . filterDiagnosticsFromBuild ( diagnosticList , buildOnlyIds , isDocumentOpen ) ,
5045 ] ) ;
51- } ) ;
46+ }
5247
5348 this . _diagnosticsReportedByBuild . set ( displayedBuildDiagnostics ) ;
5449 }
@@ -59,13 +54,13 @@ export class BuildDiagnosticsService {
5954
6055 public async _onFileOpened ( document : vscode . TextDocument , buildOnlyIds : string [ ] ) {
6156 const uri = document . uri ;
62- const currentFileBuildDiagnostics = this . _allBuildDiagnostics ?. find ( ( [ u ] ) => this . compareUri ( u , uri ) ) ;
57+ const currentFileBuildDiagnostics = this . _allBuildDiagnostics [ uri . fsPath ] ;
6358
6459 // The document is now open in the editor and live diagnostics are being shown. Filter diagnostics
6560 // reported by the build to show build-only problems.
6661 if ( currentFileBuildDiagnostics ) {
6762 const buildDiagnostics = BuildDiagnosticsService . filterDiagnosticsFromBuild (
68- currentFileBuildDiagnostics [ 1 ] ,
63+ currentFileBuildDiagnostics ,
6964 buildOnlyIds ,
7065 true
7166 ) ;
0 commit comments