cspell-dictionary 6.26.2 → 6.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ export interface SpellingDictionaryCollection extends SpellingDictionary {
4
4
  readonly dictionaries: SpellingDictionary[];
5
5
  getErrors(): Error[];
6
6
  }
7
- export declare function createCollection(dictionaries: SpellingDictionary[], name: string): SpellingDictionaryCollection;
7
+ export declare function createCollection(dictionaries: SpellingDictionary[], name: string, source?: string): SpellingDictionaryCollection;
8
8
  declare function isWordInAnyDictionary(dicts: SpellingDictionary[], word: string, options: SearchOptions): SpellingDictionary | undefined;
9
9
  declare function isWordForbiddenInAnyDictionary(dicts: SpellingDictionary[], word: string, ignoreCase: boolean | undefined): SpellingDictionary | undefined;
10
10
  export declare function isSpellingDictionaryCollection(dict: SpellingDictionary): dict is SpellingDictionaryCollection;
@@ -34,7 +34,7 @@ function identityString(w) {
34
34
  return w;
35
35
  }
36
36
  class SpellingDictionaryCollectionImpl {
37
- constructor(dictionaries, name) {
37
+ constructor(dictionaries, name, source) {
38
38
  this.dictionaries = dictionaries;
39
39
  this.name = name;
40
40
  this.options = { weightMap: undefined };
@@ -46,7 +46,7 @@ class SpellingDictionaryCollectionImpl {
46
46
  return !!isNoSuggestWordInAnyDictionary(this.dictionaries, word, options || {});
47
47
  };
48
48
  this.dictionaries = this.dictionaries.sort((a, b) => b.size - a.size);
49
- this.source = dictionaries.map((d) => d.name).join(', ');
49
+ this.source = source || dictionaries.map((d) => d.name).join(', ');
50
50
  this.isDictionaryCaseSensitive = this.dictionaries.reduce((a, b) => a || b.isDictionaryCaseSensitive, false);
51
51
  this.containsNoSuggestWords = this.dictionaries.reduce((a, b) => a || b.containsNoSuggestWords, false);
52
52
  }
@@ -106,8 +106,8 @@ class SpellingDictionaryCollectionImpl {
106
106
  return isWordForbiddenInAnyDictionary(this.dictionaries, word, ignoreCase);
107
107
  }
108
108
  }
109
- function createCollection(dictionaries, name) {
110
- return new SpellingDictionaryCollectionImpl(dictionaries, name);
109
+ function createCollection(dictionaries, name, source) {
110
+ return new SpellingDictionaryCollectionImpl(dictionaries, name, source);
111
111
  }
112
112
  exports.createCollection = createCollection;
113
113
  function isWordInAnyDictionary(dicts, word, options) {
@@ -18,7 +18,7 @@ function createInlineSpellingDictionary(inlineDict, source) {
18
18
  ignoreWords && (0, IgnoreWordsDictionary_1.createIgnoreWordsDictionary)(ignoreWords, name + '-ignore-words', source),
19
19
  suggestWords && (0, SuggestDictionary_1.createSuggestDictionary)(suggestWords, name + '-suggest', source),
20
20
  ].filter(util_1.isDefined);
21
- return (0, SpellingDictionaryCollection_1.createCollection)(dictSources, name);
21
+ return (0, SpellingDictionaryCollection_1.createCollection)(dictSources, name, source);
22
22
  });
23
23
  }
24
24
  exports.createInlineSpellingDictionary = createInlineSpellingDictionary;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell-dictionary",
3
- "version": "6.26.2",
3
+ "version": "6.27.0",
4
4
  "description": "A spelling dictionary library useful for checking words and getting suggestions.",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -43,11 +43,11 @@
43
43
  "ts-jest": "^29.0.5"
44
44
  },
45
45
  "dependencies": {
46
- "@cspell/cspell-pipe": "6.26.2",
47
- "@cspell/cspell-types": "6.26.2",
48
- "cspell-trie-lib": "6.26.2",
46
+ "@cspell/cspell-pipe": "6.27.0",
47
+ "@cspell/cspell-types": "6.27.0",
48
+ "cspell-trie-lib": "6.27.0",
49
49
  "fast-equals": "^4.0.3",
50
50
  "gensequence": "^4.0.3"
51
51
  },
52
- "gitHead": "9c983b5f96c3d7b089e49178ab0b437b5eada256"
52
+ "gitHead": "b0e31c7ba91ba467d5fd9c66f238bb5d899f4833"
53
53
  }