Skip to content

Commit

Permalink
fix bug where diagnostics is spuriously calculated when editor loses …
Browse files Browse the repository at this point in the history
…focus
  • Loading branch information
pgfearo committed Aug 24, 2021
1 parent de7dbaf commit b699c2c
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/xsltSymbolProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,26 @@ export class XsltSymbolProvider implements vscode.DocumentSymbolProvider {
}
});

let diagnostics = XsltTokenDiagnostics.calculateDiagnostics(this.languageConfig, this.docType, document, allTokens, globalInstructionData, allImportedGlobals, symbols);
// TODO: don't exclude DocumentTypes.SCH once diagnostics implemented fully
if (this.collection && this.docType !== DocumentTypes.SCH) {
let importDiagnostics: vscode.Diagnostic[] = [];
importErrors.forEach((importError) => {
importDiagnostics.push(XsltTokenDiagnostics.createImportDiagnostic(importError));
});
let allDiagnostics = importDiagnostics.concat(diagnostics);
if (allDiagnostics.length > 0) {
this.collection.set(document.uri, allDiagnostics);
} else {
this.collection.clear();
};
if (vscode.window.activeTextEditor && document.fileName !== vscode.window.activeTextEditor.document.fileName) {

} else {
let diagnostics = XsltTokenDiagnostics.calculateDiagnostics(this.languageConfig, this.docType, document, allTokens, globalInstructionData, allImportedGlobals, symbols);
// TODO: don't exclude DocumentTypes.SCH once diagnostics implemented fully
if (this.collection && this.docType !== DocumentTypes.SCH) {
let importDiagnostics: vscode.Diagnostic[] = [];
importErrors.forEach((importError) => {
importDiagnostics.push(XsltTokenDiagnostics.createImportDiagnostic(importError));
});
let allDiagnostics = importDiagnostics.concat(diagnostics);
if (allDiagnostics.length > 0) {
this.collection.set(document.uri, allDiagnostics);
} else {
this.collection.clear();
};
}
XsltSymbolProvider.documentSymbols.set(document.uri, symbols);
}
XsltSymbolProvider.documentSymbols.set(document.uri, symbols);

resolve(symbols);
});

Expand Down

0 comments on commit b699c2c

Please sign in to comment.