Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow suppression of hidden messages to be configurable with a default to supress #1435

Merged
merged 2 commits into from
Apr 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@
"default": false,
"description": "Suppress the notification window to perform a 'dotnet restore' when dependencies can't be resolved."
},
"csharp.suppressHiddenDiagnostics": {
"type": "boolean",
"default": true,
"description": "Suppress 'hidden' diagnostics (such as 'unnecessary using directives') from appearing in the editor or the Problems pane."
},
"omnisharp.path": {
"type": [
"string",
Expand Down
9 changes: 7 additions & 2 deletions src/features/diagnosticsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class DiagnosticsProvider extends AbstractSupport {

let quickFixes = value.QuickFixes.filter(DiagnosticsProvider._shouldInclude);

// Easy case: If there are no diagnostics in the file, we can clear it quickly.
// Easy case: If there are no diagnostics in the file, we can clear it quickly.
if (quickFixes.length === 0) {
if (this._diagnostics.has(document.uri)) {
this._diagnostics.delete(document.uri);
Expand Down Expand Up @@ -273,7 +273,12 @@ class DiagnosticsProvider extends AbstractSupport {
}

private static _shouldInclude(quickFix: protocol.QuickFix): boolean {
return quickFix.LogLevel.toLowerCase() !== 'hidden';
const config = vscode.workspace.getConfiguration('csharp');
if (config.get('suppressHiddenDiagnostics', true)) {
return quickFix.LogLevel.toLowerCase() !== 'hidden';
} else {
return true;
}
}

// --- data converter
Expand Down