Skip to content

Commit 4233547

Browse files
committed
feat: add enable option
1 parent be7552d commit 4233547

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"typescript.tsc.autoDetect": "off",
44
"typescript.preferences.quoteStyle": "single",
55
"editor.codeActionsOnSave": {
6-
"source.fixAll.eslint": true
6+
"source.fixAll.eslint": "explicit"
77
},
88
"terminal.integrated.defaultProfile.windows": "Command Prompt",
99
"eslint.validate": [

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ these feature maybe remove in the future
4848
|:----|:-----------|:-------:|
4949
|`zhlint.options`|see [zhlint options](https://zhlint-project.github.io/zhlint/#options), `logger` is exclude |`{}`|
5050
|`zhlint.debug`|print extra message when run zhlint|`false`|
51+
|`zhlint.enable`|Controls whether zhlint is enabled or not|`true`|
5152
|`zhlint.experimental.diff` |enable rule diff viewer in explorer |`false`|
5253
|`zhlint.experimental.config`|enable use `.zhlintrc` and `.zhlintignore` to config in workspace |`false`|
5354
|`zhlint.experimental.ignore`|enable use `.experimental-zhlintignore` to ignore files or directories while linting by specifying one or more glob patterns|`false`|

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
"default": "off",
4141
"description": "Traces the communication between VS Code and the language server."
4242
},
43+
"zhlint.enable": {
44+
"type": "boolean",
45+
"default": true,
46+
"title": "Enable zhlint",
47+
"description": "Controls whether zhlint is enabled or not."
48+
},
4349
"zhlint.experimental.diff": {
4450
"type": "boolean",
4551
"title": "show rule diff in explorer",

server/src/server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const defaultSettings: ZhlintSettings = {
104104
}
105105
},
106106
debug: false,
107+
enable: true,
107108
experimental: {
108109
diff: false,
109110
config: false,
@@ -114,6 +115,7 @@ const defaultSettings: ZhlintSettings = {
114115
interface ZhlintSettings {
115116
options: Options;
116117
debug: boolean;
118+
enable: boolean;
117119
experimental: {
118120
diff: boolean
119121
config: boolean
@@ -213,6 +215,7 @@ async function lintMD(textDocument: TextDocument, range?: Range) {
213215
const uri = textDocument.uri;
214216

215217
const settings = await getDocumentSettings(textDocument);
218+
if (!settings.enable) return;
216219
if (settings.experimental.ignore && fileFilter.ignores(uri)) return;
217220

218221
const res = getZhlintConfig(textDocument, settings);

0 commit comments

Comments
 (0)