Skip to content

Commit

Permalink
feat: Add the English common misspellings dictionary (#4166)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S authored Feb 14, 2023
1 parent fd75416 commit c60ff01
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 6 deletions.
10 changes: 8 additions & 2 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"**/node_modules/**",
"**/tsconfig.json",
"/.cspell",
"cspell.json",
"cspell*.{json,yaml}",
"integration-tests/config/config.json",
"integration-tests/config/repositories/**",
"integration-tests/repositories/**",
Expand All @@ -71,5 +71,11 @@
"words": [],
"features": {
"weighted-suggestions": true
}
},
"overrides": [
{
"filename": "**/CHANGELOG.md",
"words": ["webm"]
}
]
}
1 change: 1 addition & 0 deletions packages/cspell-bundled-dicts/cspell-default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const settings = {
'@cspell/dict-dotnet/cspell-ext.json',
'@cspell/dict-elixir/cspell-ext.json',
'@cspell/dict-en_us/cspell-ext.json',
'@cspell/dict-en-common-misspellings/cspell-ext.json',
'@cspell/dict-en-gb/cspell-ext.json',
'@cspell/dict-filetypes/cspell-ext.json',
'@cspell/dict-fonts/cspell-ext.json',
Expand Down
1 change: 1 addition & 0 deletions packages/cspell-bundled-dicts/cspell-default.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ const settings: AdvancedCSpellSettings = {
'@cspell/dict-dotnet/cspell-ext.json',
'@cspell/dict-elixir/cspell-ext.json',
'@cspell/dict-en_us/cspell-ext.json',
'@cspell/dict-en-common-misspellings/cspell-ext.json',
'@cspell/dict-en-gb/cspell-ext.json',
'@cspell/dict-filetypes/cspell-ext.json',
'@cspell/dict-fonts/cspell-ext.json',
Expand Down
1 change: 1 addition & 0 deletions packages/cspell-bundled-dicts/cspell.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ignoreWords": ["tsbuildinfo"],
"ignorePaths": ["CHANGELOG.md"],
"import": ["./cspell-default.json"]
}
1 change: 1 addition & 0 deletions packages/cspell-bundled-dicts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"@cspell/dict-docker": "^1.1.5",
"@cspell/dict-dotnet": "^4.0.1",
"@cspell/dict-elixir": "^4.0.1",
"@cspell/dict-en-common-misspellings": "^1.0.1",
"@cspell/dict-en-gb": "1.1.33",
"@cspell/dict-en_us": "^4.2.2",
"@cspell/dict-filetypes": "^3.0.0",
Expand Down
9 changes: 7 additions & 2 deletions packages/cspell-lib/src/Settings/DictionarySettings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as fsp from 'fs/promises';
import * as os from 'os';
import * as path from 'path';

import { isDictionaryDefinitionInlineInternal } from '../Models/CSpellSettingsInternalDef';
import { getDefaultBundledSettings } from './DefaultSettings';
import { createDictionaryReferenceCollection as createRefCol } from './DictionaryReferenceCollection';
import * as DictSettings from './DictionarySettings';
Expand Down Expand Up @@ -58,7 +59,10 @@ describe('Validate DictionarySettings', () => {
const defaultDicts = defaultSettings.dictionaryDefinitions!;
const dictIds = createRefCol(defaultDicts.map((def) => def.name));
const mapDefs = DictSettings.filterDictDefsToLoad(dictIds, defaultSettings.dictionaryDefinitions!);
const access = mapDefs.map((def) => def.path!).map((path) => fsp.access(path));
const access = mapDefs
.filter((def) => !isDictionaryDefinitionInlineInternal(def))
.map((def) => def.path!)
.map((path) => fsp.access(path));
expect(mapDefs.length).toBeGreaterThan(0);
return Promise.all(access);
});
Expand All @@ -68,7 +72,8 @@ describe('Validate DictionarySettings', () => {
expect(dictionaryDefinitions?.length).toBeGreaterThan(1);
dictionaryDefinitions?.forEach((def) => {
expect(DictSettings.isDictionaryDefinitionWithSource(def)).toBe(true);
expect(path.isAbsolute(def.path || '')).toBe(true);
const isInline = isDictionaryDefinitionInlineInternal(def);
expect(isInline || path.isAbsolute(def.path || '')).toBe(true);
});
});

Expand Down
1 change: 1 addition & 0 deletions packages/cspell/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"package-lock.json",
"coverage/**",
"dist/**",
"CHANGELOG.md",
"package.json",
".cspell.json",
"cspell.json",
Expand Down
29 changes: 27 additions & 2 deletions packages/cspell/src/__snapshots__/app.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ info Glob: node_modules from ./cspell.json
info Glob: package-lock.json from ./cspell.json
info Glob: coverage/** from ./cspell.json
info Glob: dist/** from ./cspell.json
info Glob: CHANGELOG.md from ./cspell.json
info Glob: package.json from ./cspell.json
info Glob: .cspell.json from ./cspell.json
info Glob: cspell.json from ./cspell.json
Expand All @@ -365,7 +366,7 @@ info
info Checking: ./src/app.test.ts, File type: auto, Language: default
info Checked: ./src/app.test.ts, File type: typescript, Language: en ... Issues: 0 0.00S
info Config file Used: ./cspell.json
info Dictionaries Used: companies, filetypes, public-licenses, softwareTerms, workspace, aws, cryptocurrencies, en_us, fullstack, node, npm, svelte, typescript
info Dictionaries Used: companies, filetypes, public-licenses, softwareTerms, workspace, aws, cryptocurrencies, en_us, en-common-misspellings, fullstack, node, npm, svelte, typescript
error 0.00ms
error CSpell: Files checked: 1, Issues found: 0 in 0 files"
`;
Expand Down Expand Up @@ -432,7 +433,7 @@ info
info Checking: ./fixtures/issue-2998/fix-words.txt, File type: fix, Language: default
info Checked: ./fixtures/issue-2998/fix-words.txt, File type: fix, Language: en ... Issues: 0 0.00S
info Config file Used: ./fixtures/issue-2998/cspell.json
info Dictionaries Used: companies, filetypes, public-licenses, softwareTerms, aws, cryptocurrencies, en_us, fixture
info Dictionaries Used: companies, filetypes, public-licenses, softwareTerms, aws, cryptocurrencies, en_us, en-common-misspellings, fixture
error 0.00ms
error CSpell: Files checked: 1, Issues found: 0 in 0 files"
`;
Expand Down Expand Up @@ -796,7 +797,10 @@ café - docker ../../node_modules/.pnpm...ocker/docker-words.txt.
café - dotnet ../../node_modules/.pnpm...ct-dotnet/dict/dotnet.txt
café - elixir ../../node_modules/.pnpm...ct-elixir/dict/elixir.txt
café * en_us* ../../node_modules/.pnpm.../dict-en_us/en_US.trie.gz
café - en-common-misspelli* en-common-misspellings-suggest
café * en-gb ../../node_modules/.pnpm.../dict-en-gb/en_GB.trie.gz
café - en-gb-common-misspe en-gb-common-misspellings-suggest
café - en-us-common-misspe en-us-common-misspellings-suggest
café - filetypes* ../../node_modules/.pnpm...iletypes/filetypes.txt.gz
café - fonts ../../node_modules/.pnpm...l/dict-fonts/fonts.txt.gz
café - fullstack ../../node_modules/.pnpm...lstack/dict/fullstack.txt
Expand Down Expand Up @@ -854,7 +858,10 @@ hello - docker ../../node_modules/.pnpm...cker/docker-words.txt.gz
hello - dotnet ../../node_modules/.pnpm...t-dotnet/dict/dotnet.txt
hello - elixir ../../node_modules/.pnpm...t-elixir/dict/elixir.txt
hello * en_us* ../../node_modules/.pnpm...dict-en_us/en_US.trie.gz
hello - en-common-misspelli* en-common-misspellings-suggest
hello * en-gb ../../node_modules/.pnpm...dict-en-gb/en_GB.trie.gz
hello - en-gb-common-misspe en-gb-common-misspellings-suggest
hello - en-us-common-misspe en-us-common-misspellings-suggest
hello - filetypes* ../../node_modules/.pnpm...letypes/filetypes.txt.gz
hello - fonts ../../node_modules/.pnpm.../dict-fonts/fonts.txt.gz
hello - fullstack ../../node_modules/.pnpm...stack/dict/fullstack.txt
Expand Down Expand Up @@ -912,7 +919,10 @@ hello - docker ../../node_modules/.pnpm...cker/docker-words.txt.gz
hello - dotnet ../../node_modules/.pnpm...t-dotnet/dict/dotnet.txt
hello - elixir ../../node_modules/.pnpm...t-elixir/dict/elixir.txt
hello * en_us ../../node_modules/.pnpm...dict-en_us/en_US.trie.gz
hello - en-common-misspelli en-common-misspellings-suggest
hello * en-gb* ../../node_modules/.pnpm...dict-en-gb/en_GB.trie.gz
hello - en-gb-common-misspe* en-gb-common-misspellings-suggest
hello - en-us-common-misspe en-us-common-misspellings-suggest
hello - filetypes* ../../node_modules/.pnpm...letypes/filetypes.txt.gz
hello - fonts ../../node_modules/.pnpm.../dict-fonts/fonts.txt.gz
hello - fullstack ../../node_modules/.pnpm...stack/dict/fullstack.txt
Expand Down Expand Up @@ -998,7 +1008,10 @@ hello - docker ../../node_modules/.pnpm...cker/docker-words.txt.gz
hello - dotnet ../../node_modules/.pnpm...t-dotnet/dict/dotnet.txt
hello - elixir ../../node_modules/.pnpm...t-elixir/dict/elixir.txt
hello * en_us* ../../node_modules/.pnpm...dict-en_us/en_US.trie.gz
hello - en-common-misspelli* en-common-misspellings-suggest
hello * en-gb ../../node_modules/.pnpm...dict-en-gb/en_GB.trie.gz
hello - en-gb-common-misspe en-gb-common-misspellings-suggest
hello - en-us-common-misspe en-us-common-misspellings-suggest
hello - filetypes* ../../node_modules/.pnpm...letypes/filetypes.txt.gz
hello - fonts ../../node_modules/.pnpm.../dict-fonts/fonts.txt.gz
hello - fullstack ../../node_modules/.pnpm...stack/dict/fullstack.txt
Expand Down Expand Up @@ -1058,7 +1071,10 @@ not-in-any-dictionary - docker ../../node_modul...ker-words.txt.gz
not-in-any-dictionary - dotnet ../../node_modul.../dict/dotnet.txt
not-in-any-dictionary - elixir ../../node_modul.../dict/elixir.txt
not-in-any-dictionary - en_us* ../../node_modul...us/en_US.trie.gz
not-in-any-dictionary - en-common-misspelli* en-common-misspellings-suggest
not-in-any-dictionary - en-gb ../../node_modul...gb/en_GB.trie.gz
not-in-any-dictionary - en-gb-common-misspe en-gb-common-misspellings-suggest
not-in-any-dictionary - en-us-common-misspe en-us-common-misspellings-suggest
not-in-any-dictionary - filetypes* ../../node_modul...filetypes.txt.gz
not-in-any-dictionary - fonts ../../node_modul...nts/fonts.txt.gz
not-in-any-dictionary - fullstack ../../node_modul...ct/fullstack.txt
Expand Down Expand Up @@ -1984,7 +2000,10 @@ café - docker ../../node_modules/.pnpm...ocker/docker-words.txt.
café - dotnet ../../node_modules/.pnpm...ct-dotnet/dict/dotnet.txt
café - elixir ../../node_modules/.pnpm...ct-elixir/dict/elixir.txt
café * en_us* ../../node_modules/.pnpm.../dict-en_us/en_US.trie.gz
café - en-common-misspelli* en-common-misspellings-suggest
café * en-gb ../../node_modules/.pnpm.../dict-en-gb/en_GB.trie.gz
café - en-gb-common-misspe en-gb-common-misspellings-suggest
café - en-us-common-misspe en-us-common-misspellings-suggest
café - filetypes* ../../node_modules/.pnpm...iletypes/filetypes.txt.gz
café - fonts ../../node_modules/.pnpm...l/dict-fonts/fonts.txt.gz
café - fullstack ../../node_modules/.pnpm...lstack/dict/fullstack.txt
Expand Down Expand Up @@ -2042,7 +2061,10 @@ hello - docker ../../node_modules/.pnpm...cker/docker-words.txt.gz
hello - dotnet ../../node_modules/.pnpm...t-dotnet/dict/dotnet.txt
hello - elixir ../../node_modules/.pnpm...t-elixir/dict/elixir.txt
hello * en_us ../../node_modules/.pnpm...dict-en_us/en_US.trie.gz
hello - en-common-misspelli en-common-misspellings-suggest
hello * en-gb* ../../node_modules/.pnpm...dict-en-gb/en_GB.trie.gz
hello - en-gb-common-misspe* en-gb-common-misspellings-suggest
hello - en-us-common-misspe en-us-common-misspellings-suggest
hello - filetypes* ../../node_modules/.pnpm...letypes/filetypes.txt.gz
hello - fonts ../../node_modules/.pnpm.../dict-fonts/fonts.txt.gz
hello - fullstack ../../node_modules/.pnpm...stack/dict/fullstack.txt
Expand Down Expand Up @@ -2100,7 +2122,10 @@ hello - docker ../../node_modules/.pnpm...cker/docker-words.txt.gz
hello - dotnet ../../node_modules/.pnpm...t-dotnet/dict/dotnet.txt
hello - elixir ../../node_modules/.pnpm...t-elixir/dict/elixir.txt
hello * en_us* ../../node_modules/.pnpm...dict-en_us/en_US.trie.gz
hello - en-common-misspelli* en-common-misspellings-suggest
hello * en-gb ../../node_modules/.pnpm...dict-en-gb/en_GB.trie.gz
hello - en-gb-common-misspe en-gb-common-misspellings-suggest
hello - en-us-common-misspe en-us-common-misspellings-suggest
hello - filetypes* ../../node_modules/.pnpm...letypes/filetypes.txt.gz
hello - fonts ../../node_modules/.pnpm.../dict-fonts/fonts.txt.gz
hello - fullstack ../../node_modules/.pnpm...stack/dict/fullstack.txt
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c60ff01

Please sign in to comment.