cspell-lib 5.18.5 → 5.19.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.
- package/dist/LanguageIds.d.ts +1 -1
- package/dist/LanguageIds.js +15 -10
- package/dist/Models/CSpellSettingsInternalDef.d.ts +3 -2
- package/dist/Models/CSpellSettingsInternalDef.js +3 -2
- package/dist/Models/TextDocument.d.ts +52 -0
- package/dist/Models/TextDocument.js +73 -0
- package/dist/Models/Uri.d.ts +5 -0
- package/dist/Models/Uri.js +16 -0
- package/dist/Settings/CSpellSettingsServer.d.ts +10 -8
- package/dist/Settings/CSpellSettingsServer.js +6 -2
- package/dist/Settings/DefaultSettings.js +11 -2
- package/dist/Settings/DictionarySettings.js +7 -9
- package/dist/Settings/ImportError.d.ts +1 -1
- package/dist/Settings/InDocSettings.js +7 -2
- package/dist/Settings/LanguageSettings.js +5 -1
- package/dist/Settings/TextDocumentSettings.d.ts +2 -1
- package/dist/Settings/TextDocumentSettings.js +5 -1
- package/dist/Settings/configLoader.d.ts +11 -1
- package/dist/Settings/configLoader.js +54 -13
- package/dist/Settings/link.js +8 -3
- package/dist/SpellingDictionary/Dictionaries.d.ts +2 -0
- package/dist/SpellingDictionary/Dictionaries.js +17 -5
- package/dist/SpellingDictionary/DictionaryLoader.d.ts +21 -2
- package/dist/SpellingDictionary/DictionaryLoader.js +179 -16
- package/dist/SpellingDictionary/SpellingDictionaryCollection.d.ts +0 -1
- package/dist/SpellingDictionary/SpellingDictionaryCollection.js +4 -10
- package/dist/SpellingDictionary/SpellingDictionaryFromTrie.d.ts +1 -1
- package/dist/SpellingDictionary/SpellingDictionaryFromTrie.js +4 -3
- package/dist/SpellingDictionary/SpellingDictionaryMethods.js +3 -2
- package/dist/SpellingDictionary/index.js +5 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +15 -7
- package/dist/spellCheckFile.js +14 -51
- package/dist/suggestions.js +8 -4
- package/dist/textValidation/determineTextDocumentSettings.d.ts +17 -0
- package/dist/textValidation/determineTextDocumentSettings.js +63 -0
- package/dist/textValidation/docValidator.d.ts +45 -0
- package/dist/textValidation/docValidator.js +181 -0
- package/dist/textValidation/index.d.ts +7 -0
- package/dist/textValidation/index.js +12 -0
- package/dist/{textValidator.d.ts → textValidation/textValidator.d.ts} +18 -10
- package/dist/{textValidator.js → textValidation/textValidator.js} +59 -60
- package/dist/textValidation/validator.d.ts +31 -0
- package/dist/textValidation/validator.js +131 -0
- package/dist/trace.js +8 -4
- package/dist/util/Memorizer.d.ts +11 -0
- package/dist/util/Memorizer.js +15 -1
- package/dist/util/TextRange.js +5 -1
- package/dist/util/errors.d.ts +8 -0
- package/dist/util/errors.js +15 -1
- package/dist/util/fileReader.d.ts +1 -0
- package/dist/util/fileReader.js +6 -1
- package/dist/util/memorizerWeak.d.ts +6 -0
- package/dist/util/memorizerWeak.js +44 -0
- package/dist/util/resolveFile.js +5 -1
- package/dist/util/text.d.ts +9 -10
- package/dist/util/text.js +10 -4
- package/dist/util/types.d.ts +12 -0
- package/dist/util/util.d.ts +9 -1
- package/dist/util/util.js +17 -1
- package/dist/validator.d.ts +2 -31
- package/dist/validator.js +5 -124
- package/dist/wordListHelper.js +7 -5
- package/package.json +16 -14
- package/dist/SpellingDictionary/DictionaryLoaderTypes.d.ts +0 -1
- package/dist/SpellingDictionary/DictionaryLoaderTypes.js +0 -2
package/dist/util/text.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { TextDocumentOffset, TextOffset } from '@cspell/cspell-types';
|
|
2
|
-
import { Sequence } from 'gensequence';
|
|
3
2
|
export declare function splitCamelCaseWordWithOffset(wo: TextOffset): Array<TextOffset>;
|
|
4
3
|
/**
|
|
5
4
|
* Split camelCase words into an array of strings.
|
|
@@ -8,26 +7,26 @@ export declare function splitCamelCaseWord(word: string): string[];
|
|
|
8
7
|
/**
|
|
9
8
|
* This function lets you iterate over regular expression matches.
|
|
10
9
|
*/
|
|
11
|
-
export declare function match(reg: RegExp, text: string):
|
|
12
|
-
export declare function matchStringToTextOffset(reg: RegExp, text: string):
|
|
13
|
-
export declare function matchToTextOffset(reg: RegExp, text: TextOffset):
|
|
14
|
-
export declare function extractLinesOfText(text: string):
|
|
10
|
+
export declare function match(reg: RegExp, text: string): Iterable<RegExpExecArray>;
|
|
11
|
+
export declare function matchStringToTextOffset(reg: RegExp, text: string): Iterable<TextOffset>;
|
|
12
|
+
export declare function matchToTextOffset(reg: RegExp, text: TextOffset): Iterable<TextOffset>;
|
|
13
|
+
export declare function extractLinesOfText(text: string): Iterable<TextOffset>;
|
|
15
14
|
/**
|
|
16
15
|
* Extract out whole words from a string of text.
|
|
17
16
|
*/
|
|
18
|
-
export declare function extractWordsFromText(text: string):
|
|
17
|
+
export declare function extractWordsFromText(text: string): Iterable<TextOffset>;
|
|
19
18
|
/**
|
|
20
19
|
* Extract out whole words from a string of text.
|
|
21
20
|
*/
|
|
22
|
-
export declare function extractWordsFromTextOffset(text: TextOffset):
|
|
21
|
+
export declare function extractWordsFromTextOffset(text: TextOffset): Iterable<TextOffset>;
|
|
23
22
|
export declare function cleanText(text: string): string;
|
|
24
23
|
export declare function cleanTextOffset(text: TextOffset): TextOffset;
|
|
25
24
|
/**
|
|
26
25
|
* Extract out whole words and words containing numbers from a string of text.
|
|
27
26
|
*/
|
|
28
|
-
export declare function extractPossibleWordsFromTextOffset(text: TextOffset):
|
|
29
|
-
export declare function extractWordsFromCode(text: string):
|
|
30
|
-
export declare function extractWordsFromCodeTextOffset(textOffset: TextOffset):
|
|
27
|
+
export declare function extractPossibleWordsFromTextOffset(text: TextOffset): Iterable<TextOffset>;
|
|
28
|
+
export declare function extractWordsFromCode(text: string): Iterable<TextOffset>;
|
|
29
|
+
export declare function extractWordsFromCodeTextOffset(textOffset: TextOffset): Iterable<TextOffset>;
|
|
31
30
|
export declare function isUpperCase(word: string): boolean;
|
|
32
31
|
export declare function isLowerCase(word: string): boolean;
|
|
33
32
|
export declare function isFirstCharacterUpper(word: string): boolean;
|
package/dist/util/text.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.__testing__ = exports.removeAccents = exports.calculateTextDocumentOffsets = exports.stringToRegExp = exports.extractText = exports.textOffset = exports.matchCase = exports.camelToSnake = exports.snakeToCamel = exports.lcFirst = exports.ucFirst = exports.isFirstCharacterLower = exports.isFirstCharacterUpper = exports.isLowerCase = exports.isUpperCase = exports.extractWordsFromCodeTextOffset = exports.extractWordsFromCode = exports.extractPossibleWordsFromTextOffset = exports.cleanTextOffset = exports.cleanText = exports.extractWordsFromTextOffset = exports.extractWordsFromText = exports.extractLinesOfText = exports.matchToTextOffset = exports.matchStringToTextOffset = exports.match = exports.splitCamelCaseWord = exports.splitCamelCaseWordWithOffset = void 0;
|
|
4
|
+
const cspell_pipe_1 = require("@cspell/cspell-pipe");
|
|
4
5
|
const gensequence_1 = require("gensequence");
|
|
5
6
|
const search_1 = require("./search");
|
|
6
7
|
const textRegex_1 = require("./textRegex");
|
|
@@ -17,7 +18,7 @@ exports.splitCamelCaseWordWithOffset = splitCamelCaseWordWithOffset;
|
|
|
17
18
|
* Split camelCase words into an array of strings.
|
|
18
19
|
*/
|
|
19
20
|
function splitCamelCaseWord(word) {
|
|
20
|
-
const wPrime = word.replace(textRegex_1.regExUpperSOrIng, (s) => s[0] + s.
|
|
21
|
+
const wPrime = word.replace(textRegex_1.regExUpperSOrIng, (s) => s[0] + s.slice(1).toLowerCase());
|
|
21
22
|
const separator = '_<^*_*^>_';
|
|
22
23
|
const pass1 = wPrime.replace(textRegex_1.regExSplitWords, '$1' + separator + '$2');
|
|
23
24
|
const pass2 = pass1.replace(textRegex_1.regExSplitWords2, '$1' + separator + '$2');
|
|
@@ -38,7 +39,8 @@ exports.matchStringToTextOffset = matchStringToTextOffset;
|
|
|
38
39
|
function matchToTextOffset(reg, text) {
|
|
39
40
|
const textOffset = text;
|
|
40
41
|
const fnOffsetMap = offsetMap(textOffset.offset);
|
|
41
|
-
|
|
42
|
+
textOffset.text.matchAll(reg);
|
|
43
|
+
return (0, cspell_pipe_1.pipeSync)(match(reg, textOffset.text), (0, cspell_pipe_1.opMap)((m) => fnOffsetMap({ text: m[0], offset: m.index || 0 })));
|
|
42
44
|
}
|
|
43
45
|
exports.matchToTextOffset = matchToTextOffset;
|
|
44
46
|
function extractLinesOfText(text) {
|
|
@@ -85,7 +87,7 @@ function extractWordsFromCode(text) {
|
|
|
85
87
|
}
|
|
86
88
|
exports.extractWordsFromCode = extractWordsFromCode;
|
|
87
89
|
function extractWordsFromCodeTextOffset(textOffset) {
|
|
88
|
-
return extractWordsFromTextOffset(textOffset).
|
|
90
|
+
return (0, cspell_pipe_1.pipeSync)(extractWordsFromTextOffset(textOffset), (0, cspell_pipe_1.opConcatMap)(splitCamelCaseWordWithOffset));
|
|
89
91
|
}
|
|
90
92
|
exports.extractWordsFromCodeTextOffset = extractWordsFromCodeTextOffset;
|
|
91
93
|
function isUpperCase(word) {
|
|
@@ -173,7 +175,11 @@ function stringToRegExp(pattern, defaultFlags = 'gimu', forceFlags = 'g') {
|
|
|
173
175
|
}
|
|
174
176
|
exports.stringToRegExp = stringToRegExp;
|
|
175
177
|
function calculateTextDocumentOffsets(uri, doc, wordOffsets) {
|
|
176
|
-
const lines = [
|
|
178
|
+
const lines = [
|
|
179
|
+
-1,
|
|
180
|
+
...(0, cspell_pipe_1.pipeSync)(match(/\n/g, doc), (0, cspell_pipe_1.opMap)((a) => a.index)),
|
|
181
|
+
doc.length,
|
|
182
|
+
];
|
|
177
183
|
let lastRow = -1;
|
|
178
184
|
let lastOffset = doc.length + 1;
|
|
179
185
|
let lastLineRow = -1;
|
package/dist/util/types.d.ts
CHANGED
|
@@ -47,4 +47,16 @@ export declare type OnlyOptional<T> = {
|
|
|
47
47
|
[P in keyof T as P extends OptionalKeys<T> ? P : never]: T[P];
|
|
48
48
|
};
|
|
49
49
|
export declare type MakeOptional<T> = OnlyRequired<T> & Partial<OnlyOptional<T>>;
|
|
50
|
+
/**
|
|
51
|
+
* Like Required, but keeps the Optional.
|
|
52
|
+
*/
|
|
53
|
+
export declare type RemoveUndefined<T> = {
|
|
54
|
+
[P in keyof T]: Exclude<T[P], undefined>;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Allow undefined in optional fields
|
|
58
|
+
*/
|
|
59
|
+
export declare type OptionalOrUndefined<T> = {
|
|
60
|
+
[P in keyof T]: P extends OptionalKeys<T> ? T[P] | undefined : T[P];
|
|
61
|
+
};
|
|
50
62
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/util/util.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RemoveUndefined } from './types';
|
|
1
2
|
export declare const uniqueFn: typeof uniqueFilterFnGenerator;
|
|
2
3
|
export declare function uniqueFilterFnGenerator<T>(): (v: T) => boolean;
|
|
3
4
|
export declare function uniqueFilterFnGenerator<T, U>(extractFn: (v: T) => U): (v: T) => boolean;
|
|
@@ -6,7 +7,7 @@ export declare function unique<T>(src: T[]): T[];
|
|
|
6
7
|
* Delete all `undefined` fields from an object.
|
|
7
8
|
* @param src - object to be cleaned
|
|
8
9
|
*/
|
|
9
|
-
export declare function clean<T>(src: T): T
|
|
10
|
+
export declare function clean<T>(src: T): RemoveUndefined<T>;
|
|
10
11
|
/**
|
|
11
12
|
* Creates a scan function that can be used in a map function.
|
|
12
13
|
*/
|
|
@@ -16,4 +17,11 @@ export declare function isDefined<T>(v: T | undefined): v is T;
|
|
|
16
17
|
export declare function flattenIterable<T>(values: Iterable<Iterable<T>> | T[][]): Iterable<T>;
|
|
17
18
|
export declare function flatten<T>(values: Iterable<Iterable<T>> | T[][]): T[];
|
|
18
19
|
export declare function asyncIterableToArray<T>(iter: Iterable<T> | AsyncIterable<T>): Promise<Awaited<T>[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Shallow is Equal test.
|
|
22
|
+
* @param a - array of values
|
|
23
|
+
* @param b - array of values
|
|
24
|
+
* @returns true if the values of `a` are exactly equal to the values of `b`
|
|
25
|
+
*/
|
|
26
|
+
export declare function isArrayEqual<K>(a: K[], b: K[]): boolean;
|
|
19
27
|
//# sourceMappingURL=util.d.ts.map
|
package/dist/util/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.asyncIterableToArray = exports.flatten = exports.flattenIterable = exports.isDefined = exports.scanMap = exports.clean = exports.unique = exports.uniqueFilterFnGenerator = exports.uniqueFn = void 0;
|
|
3
|
+
exports.isArrayEqual = exports.asyncIterableToArray = exports.flatten = exports.flattenIterable = exports.isDefined = exports.scanMap = exports.clean = exports.unique = exports.uniqueFilterFnGenerator = exports.uniqueFn = void 0;
|
|
4
4
|
// alias for uniqueFilterFnGenerator
|
|
5
5
|
exports.uniqueFn = uniqueFilterFnGenerator;
|
|
6
6
|
function uniqueFilterFnGenerator(extractFn) {
|
|
@@ -68,4 +68,20 @@ async function asyncIterableToArray(iter) {
|
|
|
68
68
|
return acc;
|
|
69
69
|
}
|
|
70
70
|
exports.asyncIterableToArray = asyncIterableToArray;
|
|
71
|
+
/**
|
|
72
|
+
* Shallow is Equal test.
|
|
73
|
+
* @param a - array of values
|
|
74
|
+
* @param b - array of values
|
|
75
|
+
* @returns true if the values of `a` are exactly equal to the values of `b`
|
|
76
|
+
*/
|
|
77
|
+
function isArrayEqual(a, b) {
|
|
78
|
+
if (a === b)
|
|
79
|
+
return true;
|
|
80
|
+
let isMatch = a.length === b.length;
|
|
81
|
+
for (let i = 0; i < a.length && isMatch; ++i) {
|
|
82
|
+
isMatch = a[i] === b[i];
|
|
83
|
+
}
|
|
84
|
+
return isMatch;
|
|
85
|
+
}
|
|
86
|
+
exports.isArrayEqual = isArrayEqual;
|
|
71
87
|
//# sourceMappingURL=util.js.map
|
package/dist/validator.d.ts
CHANGED
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const diagSource = "cSpell Checker";
|
|
4
|
-
export { IncludeExcludeOptions } from './textValidator';
|
|
5
|
-
export interface ValidationIssue extends TV.ValidationResult {
|
|
6
|
-
suggestions?: string[];
|
|
7
|
-
}
|
|
8
|
-
export interface ValidateTextOptions {
|
|
9
|
-
/** Generate suggestions where there are spelling issues. */
|
|
10
|
-
generateSuggestions?: boolean;
|
|
11
|
-
/** The number of suggestions to generate. The higher the number the longer it takes. */
|
|
12
|
-
numSuggestions?: number;
|
|
13
|
-
}
|
|
14
|
-
export declare function validateText(text: string, settings: CSpellUserSettings, options?: ValidateTextOptions): Promise<ValidationIssue[]>;
|
|
15
|
-
export declare function settingsToValidateOptions(settings: CSpellUserSettings): TV.ValidationOptions;
|
|
16
|
-
export interface CheckTextInfo {
|
|
17
|
-
text: string;
|
|
18
|
-
items: TextInfoItem[];
|
|
19
|
-
}
|
|
20
|
-
export interface TextInfoItem {
|
|
21
|
-
text: string;
|
|
22
|
-
startPos: number;
|
|
23
|
-
endPos: number;
|
|
24
|
-
flagIE: IncludeExcludeFlag;
|
|
25
|
-
isError?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export declare enum IncludeExcludeFlag {
|
|
28
|
-
INCLUDE = "I",
|
|
29
|
-
EXCLUDE = "E"
|
|
30
|
-
}
|
|
31
|
-
export declare function checkText(text: string, settings: CSpellUserSettings): Promise<CheckTextInfo>;
|
|
1
|
+
export { checkText, IncludeExcludeFlag, validateText } from './textValidation';
|
|
2
|
+
export type { CheckTextInfo, IncludeExcludeOptions, TextInfoItem, ValidateTextOptions, ValidationIssue, } from './textValidation';
|
|
32
3
|
//# sourceMappingURL=validator.d.ts.map
|
package/dist/validator.js
CHANGED
|
@@ -1,127 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
exports
|
|
27
|
-
async function validateText(text, settings, options = {}) {
|
|
28
|
-
const finalSettings = Settings.finalizeSettings(settings);
|
|
29
|
-
const dict = await (0, SpellingDictionary_1.getDictionaryInternal)(finalSettings);
|
|
30
|
-
const issues = [...TV.validateText(text, dict, settingsToValidateOptions(finalSettings))];
|
|
31
|
-
if (!options.generateSuggestions) {
|
|
32
|
-
return issues;
|
|
33
|
-
}
|
|
34
|
-
const withSugs = issues.map((t) => {
|
|
35
|
-
var _a;
|
|
36
|
-
const suggestions = dict
|
|
37
|
-
.suggest(t.text, {
|
|
38
|
-
numSuggestions: options.numSuggestions,
|
|
39
|
-
compoundMethod: SpellingDictionary_1.CompoundWordsMethod.NONE,
|
|
40
|
-
includeTies: false,
|
|
41
|
-
ignoreCase: !((_a = settings.caseSensitive) !== null && _a !== void 0 ? _a : false),
|
|
42
|
-
timeout: settings.suggestionsTimeout,
|
|
43
|
-
numChanges: settings.suggestionNumChanges,
|
|
44
|
-
})
|
|
45
|
-
.map((r) => r.word);
|
|
46
|
-
return { ...t, suggestions };
|
|
47
|
-
});
|
|
48
|
-
return withSugs;
|
|
49
|
-
}
|
|
50
|
-
exports.validateText = validateText;
|
|
51
|
-
function settingsToValidateOptions(settings) {
|
|
52
|
-
var _a;
|
|
53
|
-
const opt = {
|
|
54
|
-
...settings,
|
|
55
|
-
ignoreCase: !((_a = settings.caseSensitive) !== null && _a !== void 0 ? _a : false),
|
|
56
|
-
};
|
|
57
|
-
return opt;
|
|
58
|
-
}
|
|
59
|
-
exports.settingsToValidateOptions = settingsToValidateOptions;
|
|
60
|
-
var IncludeExcludeFlag;
|
|
61
|
-
(function (IncludeExcludeFlag) {
|
|
62
|
-
IncludeExcludeFlag["INCLUDE"] = "I";
|
|
63
|
-
IncludeExcludeFlag["EXCLUDE"] = "E";
|
|
64
|
-
})(IncludeExcludeFlag = exports.IncludeExcludeFlag || (exports.IncludeExcludeFlag = {}));
|
|
65
|
-
async function checkText(text, settings) {
|
|
66
|
-
const validationResult = validateText(text, settings);
|
|
67
|
-
const finalSettings = Settings.finalizeSettings(settings);
|
|
68
|
-
const includeRanges = TV.calcTextInclusionRanges(text, finalSettings);
|
|
69
|
-
const result = [];
|
|
70
|
-
let lastPos = 0;
|
|
71
|
-
for (const { startPos, endPos } of includeRanges) {
|
|
72
|
-
result.push({
|
|
73
|
-
text: text.slice(lastPos, startPos),
|
|
74
|
-
startPos: lastPos,
|
|
75
|
-
endPos: startPos,
|
|
76
|
-
flagIE: IncludeExcludeFlag.EXCLUDE,
|
|
77
|
-
});
|
|
78
|
-
result.push({
|
|
79
|
-
text: text.slice(startPos, endPos),
|
|
80
|
-
startPos,
|
|
81
|
-
endPos,
|
|
82
|
-
flagIE: IncludeExcludeFlag.INCLUDE,
|
|
83
|
-
});
|
|
84
|
-
lastPos = endPos;
|
|
85
|
-
}
|
|
86
|
-
result.push({
|
|
87
|
-
text: text.slice(lastPos),
|
|
88
|
-
startPos: lastPos,
|
|
89
|
-
endPos: text.length,
|
|
90
|
-
flagIE: IncludeExcludeFlag.EXCLUDE,
|
|
91
|
-
});
|
|
92
|
-
const issues = await validationResult;
|
|
93
|
-
function* merge() {
|
|
94
|
-
let i = 0;
|
|
95
|
-
for (const r of result) {
|
|
96
|
-
if (i >= issues.length || issues[i].offset >= r.endPos) {
|
|
97
|
-
yield r;
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
const span = { ...r };
|
|
101
|
-
while (i < issues.length && issues[i].offset < span.endPos) {
|
|
102
|
-
const issue = issues[i];
|
|
103
|
-
const endPos = issue.offset;
|
|
104
|
-
const text = span.text.slice(0, endPos - span.startPos);
|
|
105
|
-
const endPosError = issue.offset + issue.text.length;
|
|
106
|
-
yield { ...span, text, endPos };
|
|
107
|
-
yield {
|
|
108
|
-
...span,
|
|
109
|
-
isError: true,
|
|
110
|
-
startPos: issue.offset,
|
|
111
|
-
endPos: endPosError,
|
|
112
|
-
text: issue.text,
|
|
113
|
-
};
|
|
114
|
-
span.text = span.text.slice(endPosError - span.startPos);
|
|
115
|
-
span.startPos = endPosError;
|
|
116
|
-
i += 1;
|
|
117
|
-
}
|
|
118
|
-
yield span;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return {
|
|
122
|
-
text,
|
|
123
|
-
items: [...merge()].filter((i) => i.startPos < i.endPos),
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
exports.checkText = checkText;
|
|
3
|
+
exports.validateText = exports.IncludeExcludeFlag = exports.checkText = void 0;
|
|
4
|
+
var textValidation_1 = require("./textValidation");
|
|
5
|
+
Object.defineProperty(exports, "checkText", { enumerable: true, get: function () { return textValidation_1.checkText; } });
|
|
6
|
+
Object.defineProperty(exports, "IncludeExcludeFlag", { enumerable: true, get: function () { return textValidation_1.IncludeExcludeFlag; } });
|
|
7
|
+
Object.defineProperty(exports, "validateText", { enumerable: true, get: function () { return textValidation_1.validateText; } });
|
|
127
8
|
//# sourceMappingURL=validator.js.map
|
package/dist/wordListHelper.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -21,10 +25,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
26
|
exports.splitLineIntoWords = exports.splitLineIntoCodeWords = exports.splitCodeWords = exports.splitLine = exports.loadWordsNoError = void 0;
|
|
23
27
|
// cSpell:enableCompoundWords
|
|
24
|
-
const Text = __importStar(require("./util/text"));
|
|
25
28
|
const fileReader_1 = require("./util/fileReader");
|
|
26
29
|
const iterableIteratorLib_1 = require("./util/iterableIteratorLib");
|
|
27
30
|
const logger_1 = require("./util/logger");
|
|
31
|
+
const Text = __importStar(require("./util/text"));
|
|
28
32
|
const regExpWordsWithSpaces = /^\s*\p{L}+(?:\s+\p{L}+){0,3}$/u;
|
|
29
33
|
/**
|
|
30
34
|
* Reads words from a file. It will not throw and error.
|
|
@@ -35,9 +39,7 @@ function loadWordsNoError(filename) {
|
|
|
35
39
|
}
|
|
36
40
|
exports.loadWordsNoError = loadWordsNoError;
|
|
37
41
|
function splitLine(line) {
|
|
38
|
-
return Text.extractWordsFromText(line)
|
|
39
|
-
.map(({ text }) => text)
|
|
40
|
-
.toArray();
|
|
42
|
+
return [...Text.extractWordsFromText(line)].map(({ text }) => text);
|
|
41
43
|
}
|
|
42
44
|
exports.splitLine = splitLine;
|
|
43
45
|
function splitCodeWords(words) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell-lib",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.19.0",
|
|
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",
|
|
@@ -48,22 +48,24 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/streetsidesoftware/cspell#readme",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@cspell/cspell-bundled-dicts": "^5.
|
|
52
|
-
"@cspell/cspell-
|
|
51
|
+
"@cspell/cspell-bundled-dicts": "^5.19.0",
|
|
52
|
+
"@cspell/cspell-pipe": "^5.19.0",
|
|
53
|
+
"@cspell/cspell-types": "^5.19.0",
|
|
53
54
|
"clear-module": "^4.1.2",
|
|
54
55
|
"comment-json": "^4.2.2",
|
|
55
56
|
"configstore": "^5.0.1",
|
|
56
57
|
"cosmiconfig": "^7.0.1",
|
|
57
|
-
"cspell-glob": "^5.
|
|
58
|
-
"cspell-io": "^5.
|
|
59
|
-
"cspell-trie-lib": "^5.
|
|
58
|
+
"cspell-glob": "^5.19.0",
|
|
59
|
+
"cspell-io": "^5.19.0",
|
|
60
|
+
"cspell-trie-lib": "^5.19.0",
|
|
60
61
|
"fast-equals": "^3.0.0",
|
|
61
62
|
"find-up": "^5.0.0",
|
|
62
|
-
"fs-extra": "^10.0.
|
|
63
|
+
"fs-extra": "^10.0.1",
|
|
63
64
|
"gensequence": "^3.1.1",
|
|
64
65
|
"import-fresh": "^3.3.0",
|
|
65
66
|
"resolve-from": "^5.0.0",
|
|
66
67
|
"resolve-global": "^1.0.0",
|
|
68
|
+
"vscode-languageserver-textdocument": "^1.0.4",
|
|
67
69
|
"vscode-uri": "^3.0.3"
|
|
68
70
|
},
|
|
69
71
|
"engines": {
|
|
@@ -73,22 +75,22 @@
|
|
|
73
75
|
"@cspell/dict-cpp": "^1.1.40",
|
|
74
76
|
"@cspell/dict-csharp": "^1.0.11",
|
|
75
77
|
"@cspell/dict-css": "^1.0.13",
|
|
76
|
-
"@cspell/dict-fa-ir": "^
|
|
78
|
+
"@cspell/dict-fa-ir": "^2.0.0",
|
|
77
79
|
"@cspell/dict-fr-fr": "^2.0.1",
|
|
78
80
|
"@cspell/dict-html": "^1.1.9",
|
|
79
|
-
"@cspell/dict-nl-nl": "^2.2.
|
|
81
|
+
"@cspell/dict-nl-nl": "^2.2.3",
|
|
80
82
|
"@cspell/dict-python": "^2.0.6",
|
|
81
83
|
"@types/configstore": "^5.0.1",
|
|
82
84
|
"@types/fs-extra": "^9.0.13",
|
|
83
|
-
"@types/jest": "^27.4.
|
|
84
|
-
"@types/node": "^17.0.
|
|
85
|
+
"@types/jest": "^27.4.1",
|
|
86
|
+
"@types/node": "^17.0.21",
|
|
85
87
|
"cspell-dict-nl-nl": "^1.1.2",
|
|
86
88
|
"jest": "^27.5.1",
|
|
87
89
|
"lorem-ipsum": "^2.0.4",
|
|
88
90
|
"rimraf": "^3.0.2",
|
|
89
|
-
"rollup": "^2.
|
|
90
|
-
"rollup-plugin-dts": "^4.
|
|
91
|
+
"rollup": "^2.70.0",
|
|
92
|
+
"rollup-plugin-dts": "^4.2.0",
|
|
91
93
|
"ts-jest": "^27.1.3"
|
|
92
94
|
},
|
|
93
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "7873efe40a3287d3e025f705e1712c12d3cb392e"
|
|
94
96
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=DictionaryLoaderTypes.d.ts.map
|