From ae18b199dd6f4f51072419a7adb6b46dad66e0b9 Mon Sep 17 00:00:00 2001 From: Lian Hoy Lee Date: Thu, 27 Apr 2017 14:00:36 +1200 Subject: [PATCH 1/2] Allow suppression of hidden messages to be configurable with a default to supress (#1429) --- package.json | 5 +++++ src/features/diagnosticsProvider.ts | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8874e61aa..ca4e0bf66 100644 --- a/package.json +++ b/package.json @@ -364,6 +364,11 @@ "default": false, "description": "Suppress the notification window to perform a 'dotnet restore' when dependencies can't be resolved." }, + "csharp.suppressHiddenMessages": { + "type": "boolean", + "default": true, + "description": "Suppress hidden messages from being shown." + }, "omnisharp.path": { "type": [ "string", diff --git a/src/features/diagnosticsProvider.ts b/src/features/diagnosticsProvider.ts index ad108b00f..822115633 100644 --- a/src/features/diagnosticsProvider.ts +++ b/src/features/diagnosticsProvider.ts @@ -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); @@ -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('suppressHiddenMessages', true)) { + return quickFix.LogLevel.toLowerCase() !== 'hidden'; + } else { + return true; + } } // --- data converter From c1d7d121ed8fb4a9f4bea4b2b75005af6840bb4b Mon Sep 17 00:00:00 2001 From: Lian Hoy Lee Date: Fri, 28 Apr 2017 08:24:24 +1200 Subject: [PATCH 2/2] fix setting name and description for clarity (#1429) --- package.json | 4 ++-- src/features/diagnosticsProvider.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index ca4e0bf66..3eefbf186 100644 --- a/package.json +++ b/package.json @@ -364,10 +364,10 @@ "default": false, "description": "Suppress the notification window to perform a 'dotnet restore' when dependencies can't be resolved." }, - "csharp.suppressHiddenMessages": { + "csharp.suppressHiddenDiagnostics": { "type": "boolean", "default": true, - "description": "Suppress hidden messages from being shown." + "description": "Suppress 'hidden' diagnostics (such as 'unnecessary using directives') from appearing in the editor or the Problems pane." }, "omnisharp.path": { "type": [ diff --git a/src/features/diagnosticsProvider.ts b/src/features/diagnosticsProvider.ts index 822115633..1cc3ae9cd 100644 --- a/src/features/diagnosticsProvider.ts +++ b/src/features/diagnosticsProvider.ts @@ -274,7 +274,7 @@ class DiagnosticsProvider extends AbstractSupport { private static _shouldInclude(quickFix: protocol.QuickFix): boolean { const config = vscode.workspace.getConfiguration('csharp'); - if (config.get('suppressHiddenMessages', true)) { + if (config.get('suppressHiddenDiagnostics', true)) { return quickFix.LogLevel.toLowerCase() !== 'hidden'; } else { return true;