cspell-lib 5.15.2 → 5.15.3
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.
- package/dist/Settings/CSpellSettingsServer.d.ts +5 -0
- package/dist/Settings/CSpellSettingsServer.js +9 -0
- package/dist/SpellingDictionary/SpellingDictionary.d.ts +2 -1
- package/dist/SpellingDictionary/SpellingDictionaryFromTrie.d.ts +4 -2
- package/dist/SpellingDictionary/SpellingDictionaryFromTrie.js +3 -1
- package/dist/index.d.ts +1 -1
- package/package.json +9 -9
|
@@ -29,6 +29,10 @@ export declare function readRawSettings(filename: string, relativeTo?: string):
|
|
|
29
29
|
* @deprecated true
|
|
30
30
|
*/
|
|
31
31
|
export declare function readSettingsFiles(filenames: string[]): CSpellSettings;
|
|
32
|
+
declare function mergeObjects(left: undefined, right: undefined): undefined;
|
|
33
|
+
declare function mergeObjects<T>(left: T, right: undefined): T;
|
|
34
|
+
declare function mergeObjects<T>(left: T, right: T): T;
|
|
35
|
+
declare function mergeObjects<T>(left: undefined, right: T): T;
|
|
32
36
|
export declare function mergeSettings(left: CSpellSettings, ...settings: CSpellSettings[]): CSpellSettings;
|
|
33
37
|
export declare function mergeInDocSettings(left: CSpellSettings, right: CSpellSettings): CSpellSettings;
|
|
34
38
|
export declare function calcOverrideSettings(settings: CSpellSettings, filename: string): CSpellSettings;
|
|
@@ -57,6 +61,7 @@ declare function validateRawConfigVersion(config: CSpellUserSettings | {
|
|
|
57
61
|
}, fileRef: ImportFileRef): void;
|
|
58
62
|
declare function validateRawConfigExports(config: CSpellUserSettings, fileRef: ImportFileRef): void;
|
|
59
63
|
export declare const __testing__: {
|
|
64
|
+
mergeObjects: typeof mergeObjects;
|
|
60
65
|
normalizeCacheSettings: typeof normalizeCacheSettings;
|
|
61
66
|
normalizeSettings: typeof normalizeSettings;
|
|
62
67
|
validateRawConfigExports: typeof validateRawConfigExports;
|
|
@@ -314,6 +314,13 @@ function mergeList(left, right) {
|
|
|
314
314
|
return left;
|
|
315
315
|
return left.concat(right);
|
|
316
316
|
}
|
|
317
|
+
function mergeObjects(left, right) {
|
|
318
|
+
if (left === undefined)
|
|
319
|
+
return right;
|
|
320
|
+
if (right === undefined)
|
|
321
|
+
return left;
|
|
322
|
+
return { ...left, ...right };
|
|
323
|
+
}
|
|
317
324
|
function tagLanguageSettings(tag, settings = []) {
|
|
318
325
|
return settings.map((s) => ({
|
|
319
326
|
id: tag + '.' + (s.id || s.locale || s.languageId),
|
|
@@ -380,6 +387,7 @@ function merge(left, right) {
|
|
|
380
387
|
files: mergeListUnique(left.files, right.files),
|
|
381
388
|
ignorePaths: versionBasedMergeList(left.ignorePaths, right.ignorePaths, version),
|
|
382
389
|
overrides: versionBasedMergeList(left.overrides, right.overrides, version),
|
|
390
|
+
features: mergeObjects(left.features, right.features),
|
|
383
391
|
source: mergeSources(left, right),
|
|
384
392
|
globRoot: undefined,
|
|
385
393
|
import: undefined,
|
|
@@ -732,6 +740,7 @@ function validateRawConfig(config, fileRef) {
|
|
|
732
740
|
validations.forEach((fn) => fn(config, fileRef));
|
|
733
741
|
}
|
|
734
742
|
exports.__testing__ = {
|
|
743
|
+
mergeObjects,
|
|
735
744
|
normalizeCacheSettings,
|
|
736
745
|
normalizeSettings,
|
|
737
746
|
validateRawConfigExports,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReplaceMap } from '@cspell/cspell-types';
|
|
1
|
+
import type { ReplaceMap, SuggestionCostsDefs } from '@cspell/cspell-types';
|
|
2
2
|
import { CompoundWordsMethod, SuggestionCollector, SuggestionResult } from 'cspell-trie-lib';
|
|
3
3
|
export { CompoundWordsMethod, SuggestionCollector, SuggestionResult } from 'cspell-trie-lib';
|
|
4
4
|
export interface SearchOptions {
|
|
@@ -50,6 +50,7 @@ export interface SpellingDictionaryOptions {
|
|
|
50
50
|
useCompounds?: boolean;
|
|
51
51
|
caseSensitive?: boolean;
|
|
52
52
|
noSuggest?: boolean;
|
|
53
|
+
suggestionDefs?: SuggestionCostsDefs | undefined;
|
|
53
54
|
}
|
|
54
55
|
export interface SpellingDictionary {
|
|
55
56
|
readonly name: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { SuggestionCollector, SuggestionResult } from 'cspell-trie-lib';
|
|
2
|
+
import { CompoundWordsMethod, Trie } from 'cspell-trie-lib';
|
|
3
|
+
import { FindResult, HasOptions, SpellingDictionary, SpellingDictionaryOptions, SuggestOptions } from './SpellingDictionary';
|
|
3
4
|
export declare class SpellingDictionaryFromTrie implements SpellingDictionary {
|
|
4
5
|
readonly trie: Trie;
|
|
5
6
|
readonly name: string;
|
|
@@ -13,6 +14,7 @@ export declare class SpellingDictionaryFromTrie implements SpellingDictionary {
|
|
|
13
14
|
readonly type = "SpellingDictionaryFromTrie";
|
|
14
15
|
readonly isDictionaryCaseSensitive: boolean;
|
|
15
16
|
readonly containsNoSuggestWords: boolean;
|
|
17
|
+
private weightMap;
|
|
16
18
|
constructor(trie: Trie, name: string, options: SpellingDictionaryOptions, source?: string, size?: number);
|
|
17
19
|
get size(): number;
|
|
18
20
|
has(word: string, hasOptions?: HasOptions): boolean;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createSpellingDictionaryTrie = exports.SpellingDictionaryFromTrie = void 0;
|
|
4
4
|
const cspell_trie_lib_1 = require("cspell-trie-lib");
|
|
5
|
-
const repMap_1 = require("../util/repMap");
|
|
6
5
|
const Settings_1 = require("../Settings");
|
|
7
6
|
const Memorizer_1 = require("../util/Memorizer");
|
|
7
|
+
const repMap_1 = require("../util/repMap");
|
|
8
8
|
const SpellingDictionaryMethods_1 = require("./SpellingDictionaryMethods");
|
|
9
9
|
class SpellingDictionaryFromTrie {
|
|
10
10
|
constructor(trie, name, options, source = 'from trie', size) {
|
|
@@ -22,6 +22,7 @@ class SpellingDictionaryFromTrie {
|
|
|
22
22
|
this.isDictionaryCaseSensitive = (_a = options.caseSensitive) !== null && _a !== void 0 ? _a : !trie.isLegacy;
|
|
23
23
|
this.containsNoSuggestWords = options.noSuggest || false;
|
|
24
24
|
this._size = size || 0;
|
|
25
|
+
this.weightMap = options.suggestionDefs ? (0, cspell_trie_lib_1.createWeightedMap)(options.suggestionDefs) : undefined;
|
|
25
26
|
}
|
|
26
27
|
get size() {
|
|
27
28
|
if (!this._size) {
|
|
@@ -106,6 +107,7 @@ class SpellingDictionaryFromTrie {
|
|
|
106
107
|
includeTies,
|
|
107
108
|
ignoreCase,
|
|
108
109
|
timeout,
|
|
110
|
+
weightMap: this.weightMap,
|
|
109
111
|
});
|
|
110
112
|
this.genSuggestions(collector, suggestOptions);
|
|
111
113
|
return collector.suggestions.map((r) => ({ ...r, word: r.word }));
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export * from './Settings';
|
|
|
9
9
|
export { defaultFileName as defaultSettingsFilename } from './Settings';
|
|
10
10
|
export { combineTextAndLanguageSettings, combineTextAndLanguageSettings as constructSettingsForText, } from './Settings/TextDocumentSettings';
|
|
11
11
|
export { determineFinalDocumentSettings, DetermineFinalDocumentSettingsResult, Document, fileToDocument, isBinaryFile, spellCheckDocument, spellCheckFile, SpellCheckFileOptions, SpellCheckFileResult, } from './spellCheckFile';
|
|
12
|
-
export { CompoundWordsMethod, createSpellingDictionary, getDictionary, isSpellingDictionaryLoadError, refreshDictionaryCache, SpellingDictionary, SpellingDictionaryLoadError, SuggestionCollector, SuggestionResult, SpellingDictionaryCollection, } from './SpellingDictionary';
|
|
12
|
+
export { CompoundWordsMethod, createSpellingDictionary, getDictionary, isSpellingDictionaryLoadError, refreshDictionaryCache, SpellingDictionary, SpellingDictionaryLoadError, SuggestionCollector, SuggestionResult, SpellingDictionaryCollection, SuggestOptions, } from './SpellingDictionary';
|
|
13
13
|
export * from './trace';
|
|
14
14
|
export { getLogger, Logger, setLogger } from './util/logger';
|
|
15
15
|
export { resolveFile } from './util/resolveFile';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell-lib",
|
|
3
|
-
"version": "5.15.
|
|
3
|
+
"version": "5.15.3",
|
|
4
4
|
"description": "A library of useful functions used across various cspell tools.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/streetsidesoftware/cspell#readme",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@cspell/cspell-bundled-dicts": "^5.15.
|
|
51
|
-
"@cspell/cspell-types": "^5.15.
|
|
50
|
+
"@cspell/cspell-bundled-dicts": "^5.15.3",
|
|
51
|
+
"@cspell/cspell-types": "^5.15.3",
|
|
52
52
|
"clear-module": "^4.1.2",
|
|
53
53
|
"comment-json": "^4.1.1",
|
|
54
54
|
"configstore": "^5.0.1",
|
|
55
55
|
"cosmiconfig": "^7.0.1",
|
|
56
|
-
"cspell-glob": "^5.15.
|
|
57
|
-
"cspell-io": "^5.15.
|
|
58
|
-
"cspell-trie-lib": "^5.15.
|
|
56
|
+
"cspell-glob": "^5.15.3",
|
|
57
|
+
"cspell-io": "^5.15.3",
|
|
58
|
+
"cspell-trie-lib": "^5.15.3",
|
|
59
59
|
"find-up": "^5.0.0",
|
|
60
60
|
"fs-extra": "^10.0.0",
|
|
61
61
|
"gensequence": "^3.1.1",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"@types/configstore": "^5.0.1",
|
|
80
80
|
"@types/fs-extra": "^9.0.13",
|
|
81
81
|
"@types/jest": "^27.4.0",
|
|
82
|
-
"@types/node": "^17.0.
|
|
82
|
+
"@types/node": "^17.0.10",
|
|
83
83
|
"cspell-dict-nl-nl": "^1.1.2",
|
|
84
84
|
"jest": "^27.4.7",
|
|
85
85
|
"lorem-ipsum": "^2.0.4",
|
|
86
86
|
"rimraf": "^3.0.2",
|
|
87
|
-
"ts-jest": "^27.1.
|
|
87
|
+
"ts-jest": "^27.1.3"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "8a7c55b7d0b340d3c4e964ba91390a405f2cda2d"
|
|
90
90
|
}
|