diff --git a/Src/CSharpier.VSCode/CHANGELOG.md b/Src/CSharpier.VSCode/CHANGELOG.md index d3bafd91f..c2ea90c56 100644 --- a/Src/CSharpier.VSCode/CHANGELOG.md +++ b/Src/CSharpier.VSCode/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.9.1 +- Add option for disabling diagnostics. + ## 1.9.0 - Support format selection - Support for inline highlighting of formatting issues + code actions to format them diff --git a/Src/CSharpier.VSCode/package.json b/Src/CSharpier.VSCode/package.json index 9c6257208..d95b7f167 100644 --- a/Src/CSharpier.VSCode/package.json +++ b/Src/CSharpier.VSCode/package.json @@ -2,7 +2,7 @@ "name": "csharpier-vscode", "displayName": "CSharpier - Code formatter", "description": "Code formatter using csharpier", - "version": "1.9.0", + "version": "1.9.1", "publisher": "csharpier", "author": "CSharpier", "homepage": "https://marketplace.visualstudio.com/items?itemName=csharpier.csharpier-vscode", @@ -48,6 +48,11 @@ "default": false, "description": "Enable debug logs." }, + "csharpier.enableDiagnostics": { + "type": "boolean", + "default": true, + "description": "Enable diagnostics that highlight code that is not formatted with CSharpier." + }, "csharpier.dev.customPath": { "type": "string", "default": "", diff --git a/Src/CSharpier.VSCode/src/DiagnosticsService.ts b/Src/CSharpier.VSCode/src/DiagnosticsService.ts index ed99832b2..577e8c53b 100644 --- a/Src/CSharpier.VSCode/src/DiagnosticsService.ts +++ b/Src/CSharpier.VSCode/src/DiagnosticsService.ts @@ -3,6 +3,7 @@ import { Difference, generateDifferences, showInvisibles } from "prettier-linter import { FixAllCodeActionsCommand } from "./FixAllCodeActionCommand"; import { Logger } from "./Logger"; import { FormatDocumentProvider } from "./FormatDocumentProvider"; +import { workspace } from "vscode"; const DIAGNOSTICS_ID = "csharpier"; const DIAGNOSTICS_SOURCE_ID = "diagnostic"; @@ -54,7 +55,8 @@ export class DiagnosticsService implements vscode.CodeActionProvider, vscode.Dis public async runDiagnostics(document: vscode.TextDocument): Promise { const shouldRunDiagnostics = this.documentSelector.some(selector => selector.language === document.languageId) && - !!vscode.workspace.getWorkspaceFolder(document.uri); + !!vscode.workspace.getWorkspaceFolder(document.uri) && + (workspace.getConfiguration("csharpier").get("enableDiagnostics") ?? true); if (shouldRunDiagnostics) { try { const diff = await this.getDiff(document);