Features
feat: Add an option to set the kind of dictionary file (#9178)
feat: Add an option to set the kind of dictionary file (#9178)
This pull request introduces support for the new kind property in dictionary definitions, enabling explicit specification of dictionary types such as words, flag-words, and ignore-words.
forbidden-spelling.txt
# Add forbidden words below.
# Words starting with `!` are exceptions.
# cspell:disable
english:English # Do not allow `english` and suggest `English`
!English # needed to allow `English`
!ENGLISH # needed to allow `ENGLISH`
forbidden_word # All variants of `forbidden_word` are not allowed.
# Mixed case words:
cSpell # only `cSpell` is flagged. `cspell` will not be.
It updates the JSON schema, dictionary loading logic, and adds new APIs and tests to handle these kinds, including support for loading forbidden (flag) words from trie files.
Schema and API Enhancements:
- Added a
kindproperty to dictionary definitions in thecspell.schema.jsonschema, allowing configuration of dictionary type aswords,flag-words, orignore-words[1] [2] [3] [4] [5]. - Updated the internal dictionary settings and loader logic to recognize and handle the new
kindproperty, ensuring correct dictionary instantiation based on its value [1] [2] [3] [4].
Flag Words Dictionary Support:
- Introduced
createFlagWordsDictionaryFromTrieFileto allow creating forbidden words dictionaries directly from trie files, and exposed this function in the public API [1] [2] [3] [4] [5]. - Added comprehensive tests for the new
kindbehaviors and for loading flag words from trie files, ensuring correct forbidden word detection and suggestion handling [1] [2].
Sample and Fixture Updates:
- Added a new sample file
flag-words.txtto demonstrate and test the flag words functionality.
These changes collectively provide more flexible and explicit dictionary configuration, improve forbidden word handling, and ensure robust support for new and existing dictionary formats.
Fixes
Documentation
feat: Add an option to set the kind of dictionary file (#9178)
feat: Add an option to set the kind of dictionary file (#9178)
This pull request introduces support for the new kind property in dictionary definitions, enabling explicit specification of dictionary types such as words, flag-words, and ignore-words.
{
"version": "0.2",
"language": "en-US",
"caseSensitive": false,
"dictionaryDefinitions": [
{
"name": "forbidden-spelling",
"path": "./forbidden-spelling.txt",
"kind": "flag-words"
}
],
"dictionaries": ["forbidden-spelling"]
}forbidden-spelling.txt
# Add forbidden words below.
# Words starting with `!` are exceptions.
# cspell:disable
english:English # Do not allow `english` and suggest `English`
!English # needed to allow `English`
!ENGLISH # needed to allow `ENGLISH`
forbidden_word # All variants of `forbidden_word` are not allowed.
# Mixed case words:
cSpell # only `cSpell` is flagged. `cspell` will not be.
It updates the JSON schema, dictionary loading logic, and adds new APIs and tests to handle these kinds, including support for loading forbidden (flag) words from trie files.
Schema and API Enhancements:
- Added a
kindproperty to dictionary definitions in thecspell.schema.jsonschema, allowing configuration of dictionary type aswords,flag-words, orignore-words[1] [2] [3] [4] [5]. - Updated the internal dictionary settings and loader logic to recognize and handle the new
kindproperty, ensuring correct dictionary instantiation based on its value [1] [2] [3] [4].
Flag Words Dictionary Support:
- Introduced
createFlagWordsDictionaryFromTrieFileto allow creating forbidden words dictionaries directly from trie files, and exposed this function in the public API [1] [2] [3] [4] [5]. - Added comprehensive tests for the new
kindbehaviors and for loading flag words from trie files, ensuring correct forbidden word detection and suggestion handling [1] [2].
Sample and Fixture Updates:
- Added a new sample file
flag-words.txtto demonstrate and test the flag words functionality.
These changes collectively provide more flexible and explicit dictionary configuration, improve forbidden word handling, and ensure robust support for new and existing dictionary formats.
{ "version": "0.2", "language": "en-US", "caseSensitive": false, "dictionaryDefinitions": [ { "name": "forbidden-spelling", "path": "./forbidden-spelling.txt", "kind": "flag-words" } ], "dictionaries": ["forbidden-spelling"] }