Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Dont show warning on a line that has error #600
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Dec 6, 2017
1 parent ef8e402 commit edfd29d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
Binary file modified Go-latest.vsix
Binary file not shown.
2 changes: 1 addition & 1 deletion src/goMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function activate(ctx: vscode.ExtensionContext): void {
"data": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
// sendTelemetryEvent('beta-testing', { version: '0.6.68', date: '11/21/2017' });
sendTelemetryEvent('beta-testing', { version: '0.6.70', date: '12/06/2017' });

let useLangServer = vscode.workspace.getConfiguration('go')['useLanguageServer'];
let langServerFlags: string[] = vscode.workspace.getConfiguration('go')['languageServerFlags'] || [];
Expand Down
23 changes: 21 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,11 +611,30 @@ export function handleDiagnosticErrors(document: vscode.TextDocument, errors: IC
});

diagnosticMap.forEach((diagMap, file) => {
const fileUri = vscode.Uri.parse(file);
if (diagnosticSeverity === undefined || diagnosticSeverity === vscode.DiagnosticSeverity.Error) {
errorDiagnosticCollection.set(vscode.Uri.parse(file), diagMap[vscode.DiagnosticSeverity.Error]);
const newErrors = diagMap[vscode.DiagnosticSeverity.Error];
let existingWarnings = warningDiagnosticCollection.get(fileUri);
errorDiagnosticCollection.set(fileUri, newErrors);

// If there are warnings on current file, remove the ones co-inciding with the new errors
if (newErrors && existingWarnings) {
const errorLines = newErrors.map(x => x.range.start.line);
existingWarnings = existingWarnings.filter(x => errorLines.indexOf(x.range.start.line) === -1);
warningDiagnosticCollection.set(fileUri, existingWarnings);
}
}
if (diagnosticSeverity === undefined || diagnosticSeverity === vscode.DiagnosticSeverity.Warning) {
warningDiagnosticCollection.set(vscode.Uri.parse(file), diagMap[vscode.DiagnosticSeverity.Warning]);
const existingErrors = errorDiagnosticCollection.get(fileUri);
let newWarnings = diagMap[vscode.DiagnosticSeverity.Warning];

// If there are errors on current file, ignore the new warnings co-inciding with them
if (existingErrors && newWarnings) {
const errorLines = existingErrors.map(x => x.range.start.line);
newWarnings = newWarnings.filter(x => errorLines.indexOf(x.range.start.line) === -1);
}

warningDiagnosticCollection.set(fileUri, newWarnings);
}
});
};
Expand Down

0 comments on commit edfd29d

Please sign in to comment.