Skip to content

Commit

Permalink
feat: enable picky mode (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlday authored Sep 14, 2024
1 parent 6bc2141 commit 44db544
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"cwd":"${workspaceFolder}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "npm: webpack"
Expand All @@ -24,6 +25,7 @@
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"cwd":"${workspaceFolder}",
"preLaunchTask": "npm: test-compile",
"postDebugTask": "npm: main-dist"
}
Expand Down
23 changes: 19 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@
"languageToolLinter.smartFormat.onType": {
"type": "boolean",
"default": false,
"description": "Run smart format as you type for quotes (\u201c\u201d\u2018\u2019), em-dashes and en-dashes, and ellipses (\u2026). Ensure 'Editor: Format On Type' is enabled."
"description": "Run smart format as you type for quotes (“”‘’), em-dashes and en-dashes, and ellipses (). Ensure 'Editor: Format On Type' is enabled."
},
"languageToolLinter.smartFormat.onSave": {
"type": "boolean",
"default": false,
"description": "Run smart format when you save for quotes (\u201c\u201d\u2018\u2019), em-dashes and en-dashes, and ellipses (\u2026)."
"description": "Run smart format when you save for quotes (“”‘’), em-dashes and en-dashes, and ellipses ()."
},
"languageToolLinter.diagnosticSeverity": {
"type": "string",
Expand Down Expand Up @@ -310,7 +310,7 @@
"Portuguese",
"Portuguese (Angola preAO)",
"Portuguese (Brazil)",
"Portuguese (Mo\u00e7ambique preAO)",
"Portuguese (Moçambique preAO)",
"Portuguese (Portugal)",
"Romanian",
"Russian",
Expand Down Expand Up @@ -407,7 +407,7 @@
"Portuguese",
"Portuguese (Angola preAO)",
"Portuguese (Brazil)",
"Portuguese (Mo\u00e7ambique preAO)",
"Portuguese (Moçambique preAO)",
"Portuguese (Portugal)",
"Romanian",
"Russian",
Expand Down Expand Up @@ -436,6 +436,21 @@
"default": "",
"description": "IDs of categories to be disabled, comma-separated, no spaces. These IDs are passed directly to the LanguageTool service and will not be returned with diagnostics."
},
"languageToolLinter.languageTool.level": {
"type": "string",
"default": "",
"description": "If set to picky, additional rules will be activated, i.e. rules that you might only find useful when checking formal text.",
"enum": [
"",
"default",
"picky"
],
"enumDescriptions": [
"",
"Standard Mode",
"Picky Mode"
]
},
"languageToolLinter.languageTool.ignoredWordsGlobal": {
"type": "array",
"items": {
Expand Down
2 changes: 2 additions & 0 deletions src/ConfigurationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ export class ConfigurationManager implements Disposable {
if (value) {
parameters.set(ltKey, value);
Constants.EXTENSION_OUTPUT_CHANNEL.appendLine(ltKey + ": " + value);
} else {
Constants.EXTENSION_OUTPUT_CHANNEL.appendLine(ltKey + ": --");
}
});
// Only add user name and API key to options if set and we are using the
Expand Down
1 change: 1 addition & 0 deletions src/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const SERVICE_PARAMETERS: string[] = [
"preferredVariants",
"disabledCategories",
"disabledRules",
"level"
];
export const SERVICE_RULE_BASE_URI =
"https://community.languagetool.org/rule/show/";
Expand Down
3 changes: 2 additions & 1 deletion test-fixtures/workspace/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"languageToolLinter.plainText.languageIds": [
"plaintext",
"asciidoc"
]
],
"languageToolLinter.languageTool.level": "picky"
}
5 changes: 4 additions & 1 deletion test/suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ suite("Extension Test Suite", () => {
value.startsWith("languagetoolLinter.")
);
});
const MISSING_COMMANDS = EXPECTED_COMMANDS.filter(
item => FOUND_COMMANDS.indexOf(item) < 0
);
assert.equal(
FOUND_COMMANDS.length,
EXPECTED_COMMANDS.length,
"Either not all commands are registered or new commands have not been added to this test.",
`The following commands were not found: ${MISSING_COMMANDS}`,
);
});
});
Expand Down

0 comments on commit 44db544

Please sign in to comment.