Skip to content

Commit

Permalink
feat: Control which settings are passed to cspell (#2868)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S authored Oct 14, 2023
1 parent 400b11f commit 68bca74
Show file tree
Hide file tree
Showing 12 changed files with 481 additions and 64 deletions.
98 changes: 68 additions & 30 deletions docs/_includes/generated-docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Default
| [`cSpell.language`](#cspelllanguage) | resource | Current active spelling language. |
| [`cSpell.languageSettings`](#cspelllanguagesettings) | resource | Additional settings for individual programming languages and locales. |
| [`cSpell.noSuggestDictionaries`](#cspellnosuggestdictionaries) | resource | Optional list of dictionaries that will not be used for suggestions. Words in these dictionaries… |
| [`cSpell.suggestWords`](#cspellsuggestwords) | | A list of suggested replacements for words. Suggested words provide a way to make preferred… |
| [`cSpell.userWords`](#cspelluserwords) | resource | Words to add to global dictionary -- should only be in the user config file. |
| [`cSpell.words`](#cspellwords) | resource | List of words to be considered correct. |

Expand Down Expand Up @@ -277,6 +278,35 @@ Default

---

### `cSpell.suggestWords`

Name
: `cSpell.suggestWords`

Type
: string[]

Scope
:

Description
: A list of suggested replacements for words.
Suggested words provide a way to make preferred suggestions on word replacements.
To hint at a preferred change, but not to require it.

Format of `suggestWords`
- Single suggestion (possible auto fix)
- `word: suggestion`
- `word->suggestion`
- Multiple suggestions (not auto fixable)
- `word: first, second, third`
- `word->first, second, third`

Default
: _- none -_

---

### `cSpell.userWords`

Name
Expand Down Expand Up @@ -652,6 +682,7 @@ Default
| [`cSpell.globRoot`](#cspellglobroot) | resource | The root to use for glob patterns found in this configuration. Default: The current workspace… |
| [`cSpell.ignorePaths`](#cspellignorepaths) | resource | Glob patterns of files to be ignored |
| [`cSpell.import`](#cspellimport) | resource | Allows this configuration to inherit configuration for one or more other files. |
| [`cSpell.mergeCSpellSettings`](#cspellmergecspellsettings) | resource | Specify which fields from `.vscode/settings.json` are passed to the spell checker. This only… |
| [`cSpell.noConfigSearch`](#cspellnoconfigsearch) | resource | Prevents searching for local configuration when checking individual documents. |
| [`cSpell.spellCheckOnlyWorkspaceFiles`](#cspellspellcheckonlyworkspacefiles) | window | Spell Check Only Workspace Files |
| [`cSpell.useGitignore`](#cspellusegitignore) | resource | Tells the spell checker to load `.gitignore` files and skip files that match the globs in the… |
Expand Down Expand Up @@ -833,6 +864,43 @@ Default

---

### `cSpell.mergeCSpellSettings`

Name
: `cSpell.mergeCSpellSettings`

Type
:

Scope
: resource

Description
: Specify which fields from `.vscode/settings.json` are passed to the spell checker.
This only applies when there is a CSpell configuration file in the workspace.

The purpose of this setting to help provide a consistent result compared to the
CSpell spell checker command line tool.

Values:
- `true` - all settings will be merged
- `false` - only use `.vscode/settings.json` if a CSpell configuration is not found.
- `{ words: true, userWords: false }` - specify which fields to pass through to the spell checker.

Note:

If specific fields are specified, they provide the ability to block settings even if a CSpell configuration
is not found. The following example could be used to block "cSpell.userWords" from a workspace.

```jsonc
"cSpell.mergeCSpellSettings": { "userWords": false },
```

Default
: _`false`_

---

### `cSpell.noConfigSearch`

Name
Expand Down Expand Up @@ -1110,7 +1178,6 @@ Default
| [`cSpell.includeRegExpList`](#cspellincluderegexplist) | resource | List of regular expression patterns or defined pattern names to match for spell checking. |
| [`cSpell.overrides`](#cspelloverrides) | resource | Overrides are used to apply settings for specific files in your project. |
| [`cSpell.patterns`](#cspellpatterns) | resource | Defines a list of patterns that can be used with the `#cSpell.ignoreRegExpList#` and `#cSpell.includeRegExpList#`|
| [`cSpell.suggestWords`](#cspellsuggestwords) | | A list of suggested replacements for words. Suggested words provide a way to make preferred… |

## Definitions

Expand Down Expand Up @@ -1238,35 +1305,6 @@ Default

---

### `cSpell.suggestWords`

Name
: `cSpell.suggestWords`

Type
: string[]

Scope
:

Description
: A list of suggested replacements for words.
Suggested words provide a way to make preferred suggestions on word replacements.
To hint at a preferred change, but not to require it.

Format of `suggestWords`
- Single suggestion (possible auto fix)
- `word: suggestion`
- `word->suggestion`
- Multiple suggestions (not auto fixable)
- `word: first, second, third`
- `word->first, second, third`

Default
: _- none -_

---

# Advanced

| Setting | Scope | Description |
Expand Down
138 changes: 131 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1188,13 +1188,6 @@
"markdownDescription": "Defines a list of patterns that can be used with the `#cSpell.ignoreRegExpList#` and\n`#cSpell.includeRegExpList#` options.\n\n**Example:**\n\n```jsonc\n\"cSpell.patterns\": [\n {\n \"name\": \"comment-single-line\",\n \"pattern\": \"/#.*​/g\"\n },\n {\n \"name\": \"comment-multi-line\",\n \"pattern\": \"/(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)/g\"\n }\n]\n```",
"scope": "resource",
"type": "array"
},
"cSpell.suggestWords": {
"items": {
"type": "string"
},
"markdownDescription": "A list of suggested replacements for words.\nSuggested words provide a way to make preferred suggestions on word replacements.\nTo hint at a preferred change, but not to require it.\n\nFormat of `suggestWords`\n- Single suggestion (possible auto fix)\n - `word: suggestion`\n - `word->suggestion`\n- Multiple suggestions (not auto fixable)\n - `word: first, second, third`\n - `word->first, second, third`",
"type": "array"
}
},
"title": "CSpell",
Expand Down Expand Up @@ -1304,6 +1297,130 @@
"scope": "resource",
"type": "array"
},
"cSpell.mergeCSpellSettings": {
"anyOf": [
{
"type": "boolean"
},
{
"additionalProperties": false,
"properties": {
"allowCompoundWords": {
"type": "boolean"
},
"caseSensitive": {
"type": "boolean"
},
"dictionaries": {
"type": "boolean"
},
"dictionaryDefinitions": {
"type": "boolean"
},
"enableFiletypes": {
"type": "boolean"
},
"enableGlobDot": {
"type": "boolean"
},
"enabled": {
"type": "boolean"
},
"enabledLanguageIds": {
"type": "boolean"
},
"features": {
"type": "boolean"
},
"files": {
"type": "boolean"
},
"flagWords": {
"type": "boolean"
},
"gitignoreRoot": {
"type": "boolean"
},
"globRoot": {
"type": "boolean"
},
"ignorePaths": {
"type": "boolean"
},
"ignoreRegExpList": {
"type": "boolean"
},
"ignoreWords": {
"type": "boolean"
},
"import": {
"type": "boolean"
},
"includeRegExpList": {
"type": "boolean"
},
"language": {
"type": "boolean"
},
"languageId": {
"type": "boolean"
},
"languageSettings": {
"type": "boolean"
},
"loadDefaultConfiguration": {
"type": "boolean"
},
"minWordLength": {
"type": "boolean"
},
"noConfigSearch": {
"type": "boolean"
},
"noSuggestDictionaries": {
"type": "boolean"
},
"numSuggestions": {
"type": "boolean"
},
"overrides": {
"type": "boolean"
},
"patterns": {
"type": "boolean"
},
"pnpFiles": {
"type": "boolean"
},
"reporters": {
"type": "boolean"
},
"suggestWords": {
"type": "boolean"
},
"useGitignore": {
"type": "boolean"
},
"usePnP": {
"type": "boolean"
},
"userWords": {
"type": "boolean"
},
"validateDirectives": {
"type": "boolean"
},
"words": {
"type": "boolean"
}
},
"type": "object"
}
],
"default": false,
"markdownDescription": "Specify which fields from `.vscode/settings.json` are passed to the spell checker.\nThis only applies when there is a CSpell configuration file in the workspace.\n\nThe purpose of this setting to help provide a consistent result compared to the\nCSpell spell checker command line tool.\n\nValues:\n- `true` - all settings will be merged\n- `false` - only use `.vscode/settings.json` if a CSpell configuration is not found.\n- `{ words: true, userWords: false }` - specify which fields to pass through to the spell checker.\n\nNote:\n\nIf specific fields are specified, they provide the ability to block settings even if a CSpell configuration\nis not found. The following example could be used to block \"cSpell.userWords\" from a workspace.\n\n```jsonc\n\"cSpell.mergeCSpellSettings\": { \"userWords\": false },\n```",
"scope": "resource"
},
"cSpell.noConfigSearch": {
"markdownDescription": "Prevents searching for local configuration when checking individual documents.",
"scope": "resource",
Expand Down Expand Up @@ -1823,6 +1940,13 @@
"scope": "resource",
"type": "array"
},
"cSpell.suggestWords": {
"items": {
"type": "string"
},
"markdownDescription": "A list of suggested replacements for words.\nSuggested words provide a way to make preferred suggestions on word replacements.\nTo hint at a preferred change, but not to require it.\n\nFormat of `suggestWords`\n- Single suggestion (possible auto fix)\n - `word: suggestion`\n - `word->suggestion`\n- Multiple suggestions (not auto fixable)\n - `word: first, second, third`\n - `word->first, second, third`",
"type": "array"
},
"cSpell.userWords": {
"items": {
"type": "string"
Expand Down
Loading

0 comments on commit 68bca74

Please sign in to comment.