Skip to content

Commit

Permalink
fix: Add config field enabledFileTypes (#5584)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed May 9, 2024
1 parent d4a86bb commit 1c728e9
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 41 deletions.
54 changes: 42 additions & 12 deletions cspell.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1191,13 +1191,15 @@
"type": "array"
},
"enableFiletypes": {
"description": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by `cSpell.enabledLanguageIds`.\n\nTo disable a language, prefix with `!` as in `!json`,\n\nExample: ``` jsonc // enable checking for jsonc !json // disable checking for json kotlin // enable checking for kotlin ```",
"deprecated": true,
"deprecationMessage": "- Use {@link Settings.enabledFileTypes } instead.",
"description": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by {@link Settings.enabledLanguageIds } . To disable a language, prefix with `!` as in `!json`,\n\n\n**Example: individual file types**\n\n``` jsonc // enable checking for jsonc !json // disable checking for json kotlin // enable checking for kotlin ```\n\n**Example: enable all file types**\n\n```\n* // enable checking for all file types !json // except for json ```",
"items": {
"$ref": "#/definitions/LanguageIdSingle"
},
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by `cSpell.enabledLanguageIds`.\n\nTo disable a language, prefix with `!` as in `!json`,\n\nExample:\n```\njsonc // enable checking for jsonc\n!json // disable checking for json\nkotlin // enable checking for kotlin\n```",
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by {@link Settings.enabledLanguageIds } .\nTo disable a language, prefix with `!` as in `!json`,\n\n\n**Example: individual file types**\n\n```\njsonc // enable checking for jsonc\n!json // disable checking for json\nkotlin // enable checking for kotlin\n```\n\n**Example: enable all file types**\n\n```\n* // enable checking for all file types\n!json // except for json\n```",
"scope": "resource",
"title": "File Types to Check",
"title": "Enable File Types",
"type": "array",
"uniqueItems": true
},
Expand All @@ -1207,13 +1209,26 @@
"markdownDescription": "Is the spell checker enabled.",
"type": "boolean"
},
"enabledFileTypes": {
"additionalProperties": {
"type": "boolean"
},
"description": "Enable / Disable checking file types (languageIds).\n\nThis setting replaces: {@link Settings.enabledLanguageIds } and {@link Settings.enableFiletypes } .\n\nA Value of:\n- `true` - enable checking for the file type\n- `false` - disable checking for the file type\n\nA file type of `*` is a wildcard that enables all file types.\n\n**Example: enable all file types**\n\n| File Type | Enabled | Comment | | --------- | ------- | ------- | | `*` | `true` | Enable all file types. | | `json` | `false` | Disable checking for json files. |",
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThis setting replaces: {@link Settings.enabledLanguageIds } and {@link Settings.enableFiletypes } .\n\nA Value of:\n- `true` - enable checking for the file type\n- `false` - disable checking for the file type\n\nA file type of `*` is a wildcard that enables all file types.\n\n**Example: enable all file types**\n\n| File Type | Enabled | Comment |\n| --------- | ------- | ------- |\n| `*` | `true` | Enable all file types. |\n| `json` | `false` | Disable checking for json files. |",
"title": "Enabled File Types to Check",
"type": "object"
},
"enabledLanguageIds": {
"description": "languageIds for the files to spell check.",
"deprecated": true,
"deprecationMessage": "- Use {@link Settings.enabledFileTypes } instead.",
"description": "Specify a list of file types to spell check. It is better to use {@link Settings.enabledFileTypes } to Enable / Disable checking files types.",
"items": {
"$ref": "#/definitions/LanguageIdSingle"
},
"markdownDescription": "languageIds for the files to spell check.",
"type": "array"
"markdownDescription": "Specify a list of file types to spell check. It is better to use {@link Settings.enabledFileTypes } to Enable / Disable checking files types.",
"title": "Enabled Language Ids",
"type": "array",
"uniqueItems": true
},
"filename": {
"anyOf": [
Expand Down Expand Up @@ -1680,13 +1695,15 @@
"type": "array"
},
"enableFiletypes": {
"description": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by `cSpell.enabledLanguageIds`.\n\nTo disable a language, prefix with `!` as in `!json`,\n\nExample: ``` jsonc // enable checking for jsonc !json // disable checking for json kotlin // enable checking for kotlin ```",
"deprecated": true,
"deprecationMessage": "- Use {@link Settings.enabledFileTypes } instead.",
"description": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by {@link Settings.enabledLanguageIds } . To disable a language, prefix with `!` as in `!json`,\n\n\n**Example: individual file types**\n\n``` jsonc // enable checking for jsonc !json // disable checking for json kotlin // enable checking for kotlin ```\n\n**Example: enable all file types**\n\n```\n* // enable checking for all file types !json // except for json ```",
"items": {
"$ref": "#/definitions/LanguageIdSingle"
},
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by `cSpell.enabledLanguageIds`.\n\nTo disable a language, prefix with `!` as in `!json`,\n\nExample:\n```\njsonc // enable checking for jsonc\n!json // disable checking for json\nkotlin // enable checking for kotlin\n```",
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by {@link Settings.enabledLanguageIds } .\nTo disable a language, prefix with `!` as in `!json`,\n\n\n**Example: individual file types**\n\n```\njsonc // enable checking for jsonc\n!json // disable checking for json\nkotlin // enable checking for kotlin\n```\n\n**Example: enable all file types**\n\n```\n* // enable checking for all file types\n!json // except for json\n```",
"scope": "resource",
"title": "File Types to Check",
"title": "Enable File Types",
"type": "array",
"uniqueItems": true
},
Expand All @@ -1702,13 +1719,26 @@
"markdownDescription": "Is the spell checker enabled.",
"type": "boolean"
},
"enabledFileTypes": {
"additionalProperties": {
"type": "boolean"
},
"description": "Enable / Disable checking file types (languageIds).\n\nThis setting replaces: {@link Settings.enabledLanguageIds } and {@link Settings.enableFiletypes } .\n\nA Value of:\n- `true` - enable checking for the file type\n- `false` - disable checking for the file type\n\nA file type of `*` is a wildcard that enables all file types.\n\n**Example: enable all file types**\n\n| File Type | Enabled | Comment | | --------- | ------- | ------- | | `*` | `true` | Enable all file types. | | `json` | `false` | Disable checking for json files. |",
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThis setting replaces: {@link Settings.enabledLanguageIds } and {@link Settings.enableFiletypes } .\n\nA Value of:\n- `true` - enable checking for the file type\n- `false` - disable checking for the file type\n\nA file type of `*` is a wildcard that enables all file types.\n\n**Example: enable all file types**\n\n| File Type | Enabled | Comment |\n| --------- | ------- | ------- |\n| `*` | `true` | Enable all file types. |\n| `json` | `false` | Disable checking for json files. |",
"title": "Enabled File Types to Check",
"type": "object"
},
"enabledLanguageIds": {
"description": "languageIds for the files to spell check.",
"deprecated": true,
"deprecationMessage": "- Use {@link Settings.enabledFileTypes } instead.",
"description": "Specify a list of file types to spell check. It is better to use {@link Settings.enabledFileTypes } to Enable / Disable checking files types.",
"items": {
"$ref": "#/definitions/LanguageIdSingle"
},
"markdownDescription": "languageIds for the files to spell check.",
"type": "array"
"markdownDescription": "Specify a list of file types to spell check. It is better to use {@link Settings.enabledFileTypes } to Enable / Disable checking files types.",
"title": "Enabled Language Ids",
"type": "array",
"uniqueItems": true
},
"failFast": {
"default": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ function _merge(
suggestWords: mergeWordsCached(_left.suggestWords, _right.suggestWords),
enabledLanguageIds: replaceIfNotEmpty(_left.enabledLanguageIds, _right.enabledLanguageIds),
enableFiletypes: mergeList(_left.enableFiletypes, _right.enableFiletypes),
enabledFileTypes: mergeObjects(_left.enabledFileTypes, _right.enabledFileTypes),
ignoreRegExpList: mergeListUnique(_left.ignoreRegExpList, _right.ignoreRegExpList),
patterns: mergeListUnique(_left.patterns, _right.patterns),
dictionaryDefinitions: mergeListUnique(_left.dictionaryDefinitions, _right.dictionaryDefinitions),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports[`Validate the cspell API > Verify API exports 1`] = `
"enableFiletypes": "enableFiletypes",
"enableGlobDot": "enableGlobDot",
"enabled": "enabled",
"enabledFileTypes": "enabledFileTypes",
"enabledLanguageIds": "enabledLanguageIds",
"failFast": "failFast",
"features": "features",
Expand Down
54 changes: 42 additions & 12 deletions packages/cspell-types/cspell.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1191,13 +1191,15 @@
"type": "array"
},
"enableFiletypes": {
"description": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by `cSpell.enabledLanguageIds`.\n\nTo disable a language, prefix with `!` as in `!json`,\n\nExample: ``` jsonc // enable checking for jsonc !json // disable checking for json kotlin // enable checking for kotlin ```",
"deprecated": true,
"deprecationMessage": "- Use {@link Settings.enabledFileTypes } instead.",
"description": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by {@link Settings.enabledLanguageIds } . To disable a language, prefix with `!` as in `!json`,\n\n\n**Example: individual file types**\n\n``` jsonc // enable checking for jsonc !json // disable checking for json kotlin // enable checking for kotlin ```\n\n**Example: enable all file types**\n\n```\n* // enable checking for all file types !json // except for json ```",
"items": {
"$ref": "#/definitions/LanguageIdSingle"
},
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by `cSpell.enabledLanguageIds`.\n\nTo disable a language, prefix with `!` as in `!json`,\n\nExample:\n```\njsonc // enable checking for jsonc\n!json // disable checking for json\nkotlin // enable checking for kotlin\n```",
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by {@link Settings.enabledLanguageIds } .\nTo disable a language, prefix with `!` as in `!json`,\n\n\n**Example: individual file types**\n\n```\njsonc // enable checking for jsonc\n!json // disable checking for json\nkotlin // enable checking for kotlin\n```\n\n**Example: enable all file types**\n\n```\n* // enable checking for all file types\n!json // except for json\n```",
"scope": "resource",
"title": "File Types to Check",
"title": "Enable File Types",
"type": "array",
"uniqueItems": true
},
Expand All @@ -1207,13 +1209,26 @@
"markdownDescription": "Is the spell checker enabled.",
"type": "boolean"
},
"enabledFileTypes": {
"additionalProperties": {
"type": "boolean"
},
"description": "Enable / Disable checking file types (languageIds).\n\nThis setting replaces: {@link Settings.enabledLanguageIds } and {@link Settings.enableFiletypes } .\n\nA Value of:\n- `true` - enable checking for the file type\n- `false` - disable checking for the file type\n\nA file type of `*` is a wildcard that enables all file types.\n\n**Example: enable all file types**\n\n| File Type | Enabled | Comment | | --------- | ------- | ------- | | `*` | `true` | Enable all file types. | | `json` | `false` | Disable checking for json files. |",
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThis setting replaces: {@link Settings.enabledLanguageIds } and {@link Settings.enableFiletypes } .\n\nA Value of:\n- `true` - enable checking for the file type\n- `false` - disable checking for the file type\n\nA file type of `*` is a wildcard that enables all file types.\n\n**Example: enable all file types**\n\n| File Type | Enabled | Comment |\n| --------- | ------- | ------- |\n| `*` | `true` | Enable all file types. |\n| `json` | `false` | Disable checking for json files. |",
"title": "Enabled File Types to Check",
"type": "object"
},
"enabledLanguageIds": {
"description": "languageIds for the files to spell check.",
"deprecated": true,
"deprecationMessage": "- Use {@link Settings.enabledFileTypes } instead.",
"description": "Specify a list of file types to spell check. It is better to use {@link Settings.enabledFileTypes } to Enable / Disable checking files types.",
"items": {
"$ref": "#/definitions/LanguageIdSingle"
},
"markdownDescription": "languageIds for the files to spell check.",
"type": "array"
"markdownDescription": "Specify a list of file types to spell check. It is better to use {@link Settings.enabledFileTypes } to Enable / Disable checking files types.",
"title": "Enabled Language Ids",
"type": "array",
"uniqueItems": true
},
"filename": {
"anyOf": [
Expand Down Expand Up @@ -1680,13 +1695,15 @@
"type": "array"
},
"enableFiletypes": {
"description": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by `cSpell.enabledLanguageIds`.\n\nTo disable a language, prefix with `!` as in `!json`,\n\nExample: ``` jsonc // enable checking for jsonc !json // disable checking for json kotlin // enable checking for kotlin ```",
"deprecated": true,
"deprecationMessage": "- Use {@link Settings.enabledFileTypes } instead.",
"description": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by {@link Settings.enabledLanguageIds } . To disable a language, prefix with `!` as in `!json`,\n\n\n**Example: individual file types**\n\n``` jsonc // enable checking for jsonc !json // disable checking for json kotlin // enable checking for kotlin ```\n\n**Example: enable all file types**\n\n```\n* // enable checking for all file types !json // except for json ```",
"items": {
"$ref": "#/definitions/LanguageIdSingle"
},
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by `cSpell.enabledLanguageIds`.\n\nTo disable a language, prefix with `!` as in `!json`,\n\nExample:\n```\njsonc // enable checking for jsonc\n!json // disable checking for json\nkotlin // enable checking for kotlin\n```",
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThese are in additional to the file types specified by {@link Settings.enabledLanguageIds } .\nTo disable a language, prefix with `!` as in `!json`,\n\n\n**Example: individual file types**\n\n```\njsonc // enable checking for jsonc\n!json // disable checking for json\nkotlin // enable checking for kotlin\n```\n\n**Example: enable all file types**\n\n```\n* // enable checking for all file types\n!json // except for json\n```",
"scope": "resource",
"title": "File Types to Check",
"title": "Enable File Types",
"type": "array",
"uniqueItems": true
},
Expand All @@ -1702,13 +1719,26 @@
"markdownDescription": "Is the spell checker enabled.",
"type": "boolean"
},
"enabledFileTypes": {
"additionalProperties": {
"type": "boolean"
},
"description": "Enable / Disable checking file types (languageIds).\n\nThis setting replaces: {@link Settings.enabledLanguageIds } and {@link Settings.enableFiletypes } .\n\nA Value of:\n- `true` - enable checking for the file type\n- `false` - disable checking for the file type\n\nA file type of `*` is a wildcard that enables all file types.\n\n**Example: enable all file types**\n\n| File Type | Enabled | Comment | | --------- | ------- | ------- | | `*` | `true` | Enable all file types. | | `json` | `false` | Disable checking for json files. |",
"markdownDescription": "Enable / Disable checking file types (languageIds).\n\nThis setting replaces: {@link Settings.enabledLanguageIds } and {@link Settings.enableFiletypes } .\n\nA Value of:\n- `true` - enable checking for the file type\n- `false` - disable checking for the file type\n\nA file type of `*` is a wildcard that enables all file types.\n\n**Example: enable all file types**\n\n| File Type | Enabled | Comment |\n| --------- | ------- | ------- |\n| `*` | `true` | Enable all file types. |\n| `json` | `false` | Disable checking for json files. |",
"title": "Enabled File Types to Check",
"type": "object"
},
"enabledLanguageIds": {
"description": "languageIds for the files to spell check.",
"deprecated": true,
"deprecationMessage": "- Use {@link Settings.enabledFileTypes } instead.",
"description": "Specify a list of file types to spell check. It is better to use {@link Settings.enabledFileTypes } to Enable / Disable checking files types.",
"items": {
"$ref": "#/definitions/LanguageIdSingle"
},
"markdownDescription": "languageIds for the files to spell check.",
"type": "array"
"markdownDescription": "Specify a list of file types to spell check. It is better to use {@link Settings.enabledFileTypes } to Enable / Disable checking files types.",
"title": "Enabled Language Ids",
"type": "array",
"uniqueItems": true
},
"failFast": {
"default": false,
Expand Down

0 comments on commit 1c728e9

Please sign in to comment.