-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for
noSuggest
dictionaries. (#1554)
* dev: add `noSuggestDictionaries` and `noSuggest` dictionary options. * dev: add some samples * test: Code coverage for Cache * dev: [trie-lib] add option to control adding normalized versions of words. * dev: correctly merge `noSuggestDictionaries` * dev: Integrate `isNoSuggestWord` and `isForbidden` into `SpellingDictionary` * dev: `@pattern` is not allowed on a non-string property * fix: Make sure the case setting is passed through to no suggest tests.
- Loading branch information
Showing
38 changed files
with
825 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
.vscode/ | ||
[sS]amples/ | ||
[tT]emp/ | ||
**/dist/ | ||
**/dist/** | ||
**/node_modules/** | ||
**/package-lock.json | ||
CHANGELOG.md | ||
coverage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/cspell-lib/samples/configurations/.cspell/custom-dictionary.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Custom Dictionary Words |
2 changes: 2 additions & 0 deletions
2
packages/cspell-lib/samples/configurations/.cspell/ignore-words-2.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# List of words to be ignored. | ||
nosugg2 |
2 changes: 2 additions & 0 deletions
2
packages/cspell-lib/samples/configurations/.cspell/ignore-words.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# List of words to be ignored. | ||
nosugg1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Sample CSpell Configurations | ||
|
||
- [cspell-dictionaries](./cspell-dictionaries.json) - example of loading custom dictionaries. | ||
|
||
nosugg1 | ||
|
||
nosugg2 |
33 changes: 33 additions & 0 deletions
33
packages/cspell-lib/samples/configurations/cspell-dictionaries.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", | ||
"version": "0.2", | ||
"dictionaries": [ | ||
"typescript", | ||
"custom-dictionary", | ||
"ignore-words" | ||
], | ||
"noSuggestDictionaries": [ | ||
"ignore-words-2" | ||
], | ||
"import": [ | ||
"@cspell/dict-python/cspell-ext.json" | ||
], | ||
"dictionaryDefinitions": [ | ||
{ | ||
"name": "custom-dictionary", | ||
"path": "./.cspell/custom-dictionary.txt", | ||
"addWords": true | ||
}, | ||
{ | ||
"name": "ignore-words", | ||
"path": "./.cspell/ignore-words.txt", | ||
"addWords": true, | ||
"noSuggest": true | ||
}, | ||
{ | ||
"name": "ignore-words-2", | ||
"path": "./.cspell/ignore-words-2.txt", | ||
"addWords": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"flagWords": [], | ||
"import": [ | ||
"./cspell-dictionaries.json" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
id: Yaml Example Config | ||
import: | ||
- ./../cspell-imports.json | ||
- ./../cspell-imports.json # Note this one does not exist on purpose. | ||
- ./../cspell-includes.json | ||
- ../.cspell.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { IssueCode } from './cspell.cache'; | ||
|
||
describe('Cache', () => { | ||
test('IssueCode', () => { | ||
const codes = [IssueCode.UnknownWord, IssueCode.ForbiddenWord, IssueCode.KnownIssue]; | ||
const sum = codes.reduce((a, b) => a + b, 0); | ||
expect(sum).toBe(IssueCode.ALL); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {} from './index'; | ||
|
||
describe('index', () => { | ||
test('index', () => { | ||
expect(true).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type { CSpellCache } from './cspell.cache'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.