cspell-lib 5.18.5 → 5.19.2
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 +8 -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 +11 -9
- package/dist/Settings/CSpellSettingsServer.js +7 -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/Settings/patterns.d.ts +1 -1
- package/dist/Settings/patterns.js +5 -1
- 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 +50 -0
- package/dist/textValidation/docValidator.js +199 -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} +20 -12
- package/dist/{textValidator.js → textValidation/textValidator.js} +60 -61
- package/dist/textValidation/validator.d.ts +32 -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.d.ts +2 -2
- package/dist/util/TextRange.js +13 -19
- 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/timer.d.ts +15 -0
- package/dist/util/timer.js +29 -0
- 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/LanguageIds.d.ts
CHANGED
|
@@ -29,5 +29,5 @@ export declare function isGeneratedFile(basename: string): boolean;
|
|
|
29
29
|
export declare function isGenerated(languageId: LanguageId | LanguageId[] | Iterable<LanguageId>): boolean;
|
|
30
30
|
export declare function buildLanguageExtensionMapSet(defs: LanguageDefinitions): ExtensionToLanguageIdMapSet;
|
|
31
31
|
export declare function getLanguagesForExt(ext: string): string[];
|
|
32
|
-
export declare function
|
|
32
|
+
export declare function getLanguagesForBasename(basename: string): string[];
|
|
33
33
|
//# sourceMappingURL=LanguageIds.d.ts.map
|
package/dist/LanguageIds.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* ```
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
10
|
+
exports.getLanguagesForBasename = exports.getLanguagesForExt = exports.buildLanguageExtensionMapSet = exports.isGenerated = exports.isGeneratedFile = exports.isGeneratedExt = exports.isBinary = exports.isBinaryFile = exports.isBinaryExt = exports.languageIds = exports.generatedFiles = exports.binaryLanguages = exports.languageExtensionDefinitions = void 0;
|
|
11
11
|
exports.languageExtensionDefinitions = [
|
|
12
12
|
{ id: 'ada', extensions: ['.adb', '.ads'] },
|
|
13
13
|
{ id: 'apiblueprint', extensions: ['.apib', '.apiblueprint'] },
|
|
@@ -167,6 +167,9 @@ exports.languageExtensionDefinitions = [
|
|
|
167
167
|
{ id: 'latex', extensions: ['.tex'] },
|
|
168
168
|
{ id: 'map', extensions: ['.map'] },
|
|
169
169
|
{ id: 'pdf', extensions: ['.pdf'] },
|
|
170
|
+
{ id: 'rsa', extensions: ['.pub'], filenames: ['id_rsa', 'id_rsa.pub'] },
|
|
171
|
+
{ id: 'pem', extensions: ['.private-key.pem', '.pem'] },
|
|
172
|
+
{ id: 'pem-private-key', extensions: ['.private-key.pem'] },
|
|
170
173
|
//
|
|
171
174
|
// Special file types used to prevent spell checking.
|
|
172
175
|
//
|
|
@@ -197,7 +200,7 @@ exports.languageExtensionDefinitions = [
|
|
|
197
200
|
},
|
|
198
201
|
];
|
|
199
202
|
exports.binaryLanguages = new Set(['binary', 'image', 'video', 'fonts']);
|
|
200
|
-
exports.generatedFiles = new Set([...exports.binaryLanguages, 'map', 'lock', 'pdf', 'cache_files']);
|
|
203
|
+
exports.generatedFiles = new Set([...exports.binaryLanguages, 'map', 'lock', 'pdf', 'cache_files', 'rsa', 'pem']);
|
|
201
204
|
exports.languageIds = exports.languageExtensionDefinitions.map(({ id }) => id);
|
|
202
205
|
const mapExtensionToSetOfLanguageIds = buildLanguageExtensionMapSet(exports.languageExtensionDefinitions);
|
|
203
206
|
const mapExtensionToLanguageIds = buildExtensionToLanguageIdMap(mapExtensionToSetOfLanguageIds);
|
|
@@ -206,7 +209,7 @@ function isBinaryExt(ext) {
|
|
|
206
209
|
}
|
|
207
210
|
exports.isBinaryExt = isBinaryExt;
|
|
208
211
|
function isBinaryFile(basename) {
|
|
209
|
-
return isBinary(
|
|
212
|
+
return isBinary(getLanguagesForBasename(basename));
|
|
210
213
|
}
|
|
211
214
|
exports.isBinaryFile = isBinaryFile;
|
|
212
215
|
function isBinary(languageId) {
|
|
@@ -218,7 +221,7 @@ function isGeneratedExt(ext) {
|
|
|
218
221
|
}
|
|
219
222
|
exports.isGeneratedExt = isGeneratedExt;
|
|
220
223
|
function isGeneratedFile(basename) {
|
|
221
|
-
return isGenerated(
|
|
224
|
+
return isGenerated(getLanguagesForBasename(basename));
|
|
222
225
|
}
|
|
223
226
|
exports.isGeneratedFile = isGeneratedFile;
|
|
224
227
|
function isGenerated(languageId) {
|
|
@@ -263,14 +266,16 @@ function getLanguagesForExt(ext) {
|
|
|
263
266
|
return mapExtensionToLanguageIds.get(ext) || mapExtensionToLanguageIds.get('.' + ext) || [];
|
|
264
267
|
}
|
|
265
268
|
exports.getLanguagesForExt = getLanguagesForExt;
|
|
266
|
-
function
|
|
269
|
+
function getLanguagesForBasename(basename) {
|
|
267
270
|
const found = mapExtensionToLanguageIds.get(basename);
|
|
268
271
|
if (found)
|
|
269
272
|
return found;
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
273
|
+
for (let pos = basename.indexOf('.'); pos >= 0; pos = basename.indexOf('.', pos + 1)) {
|
|
274
|
+
const ids = mapExtensionToLanguageIds.get(basename.slice(pos));
|
|
275
|
+
if (ids)
|
|
276
|
+
return ids;
|
|
277
|
+
}
|
|
278
|
+
return [];
|
|
274
279
|
}
|
|
275
|
-
exports.
|
|
280
|
+
exports.getLanguagesForBasename = getLanguagesForBasename;
|
|
276
281
|
//# sourceMappingURL=LanguageIds.js.map
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { CSpellSettingsWithSourceTrace, DictionaryDefinitionAugmented, DictionaryDefinitionCustom, DictionaryDefinitionPreferred } from '@cspell/cspell-types';
|
|
2
2
|
import { WeightMap } from 'cspell-trie-lib';
|
|
3
|
+
import { OptionalOrUndefined } from '../util/types';
|
|
3
4
|
export declare const SymbolCSpellSettingsInternal: unique symbol;
|
|
4
5
|
export interface CSpellSettingsInternal extends Omit<CSpellSettingsWithSourceTrace, 'dictionaryDefinitions'> {
|
|
5
6
|
[SymbolCSpellSettingsInternal]: true;
|
|
6
7
|
dictionaryDefinitions?: DictionaryDefinitionInternal[];
|
|
7
8
|
}
|
|
9
|
+
export interface CSpellSettingsInternalFinalized extends CSpellSettingsInternal {
|
|
10
|
+
finalized: true;
|
|
11
|
+
ignoreRegExpList: RegExp[];
|
|
12
|
+
includeRegExpList: RegExp[];
|
|
13
|
+
}
|
|
8
14
|
declare type DictionaryDefinitionCustomUniqueFields = Omit<DictionaryDefinitionCustom, keyof DictionaryDefinitionPreferred>;
|
|
9
15
|
export interface DictionaryDefinitionInternal extends Readonly<DictionaryDefinitionPreferred>, Readonly<Partial<DictionaryDefinitionCustomUniqueFields>>, Readonly<DictionaryDefinitionAugmented> {
|
|
10
16
|
/**
|
|
@@ -17,7 +23,7 @@ export interface DictionaryDefinitionInternal extends Readonly<DictionaryDefinit
|
|
|
17
23
|
export interface DictionaryDefinitionInternalWithSource extends DictionaryDefinitionInternal {
|
|
18
24
|
readonly __source: string;
|
|
19
25
|
}
|
|
20
|
-
export declare function createCSpellSettingsInternal(parts?: Partial<CSpellSettingsInternal
|
|
21
|
-
export declare function isCSpellSettingsInternal(cs: CSpellSettingsInternal | CSpellSettingsWithSourceTrace): cs is CSpellSettingsInternal;
|
|
26
|
+
export declare function createCSpellSettingsInternal(parts?: OptionalOrUndefined<Partial<CSpellSettingsInternal>>): CSpellSettingsInternal;
|
|
27
|
+
export declare function isCSpellSettingsInternal(cs: CSpellSettingsInternal | CSpellSettingsWithSourceTrace | OptionalOrUndefined<CSpellSettingsInternal | CSpellSettingsWithSourceTrace>): cs is CSpellSettingsInternal;
|
|
22
28
|
export {};
|
|
23
29
|
//# sourceMappingURL=CSpellSettingsInternalDef.d.ts.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isCSpellSettingsInternal = exports.createCSpellSettingsInternal = exports.SymbolCSpellSettingsInternal = void 0;
|
|
4
|
+
const util_1 = require("../util/util");
|
|
4
5
|
exports.SymbolCSpellSettingsInternal = Symbol('CSpellSettingsInternal');
|
|
5
6
|
function createCSpellSettingsInternal(parts = {}) {
|
|
6
|
-
return {
|
|
7
|
+
return (0, util_1.clean)({
|
|
7
8
|
...parts,
|
|
8
9
|
[exports.SymbolCSpellSettingsInternal]: true,
|
|
9
|
-
};
|
|
10
|
+
});
|
|
10
11
|
}
|
|
11
12
|
exports.createCSpellSettingsInternal = createCSpellSettingsInternal;
|
|
12
13
|
function isCSpellSettingsInternal(cs) {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as Uri from './Uri';
|
|
2
|
+
export declare type DocumentUri = Uri.Uri;
|
|
3
|
+
export interface Position {
|
|
4
|
+
line: number;
|
|
5
|
+
character: number;
|
|
6
|
+
}
|
|
7
|
+
export interface TextDocumentLine {
|
|
8
|
+
readonly text: string;
|
|
9
|
+
readonly offset: number;
|
|
10
|
+
readonly position: Position;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A simple text document. Not to be implemented. The document keeps the content
|
|
14
|
+
* as string.
|
|
15
|
+
*/
|
|
16
|
+
export interface TextDocument {
|
|
17
|
+
/**
|
|
18
|
+
* The associated URI for this document. Most documents have the __file__-scheme, indicating that they
|
|
19
|
+
* represent files on disk. However, some documents may have other schemes indicating that they are not
|
|
20
|
+
* available on disk.
|
|
21
|
+
*/
|
|
22
|
+
readonly uri: DocumentUri;
|
|
23
|
+
/**
|
|
24
|
+
* The identifier of the language associated with this document.
|
|
25
|
+
*/
|
|
26
|
+
readonly languageId: string | string[];
|
|
27
|
+
/**
|
|
28
|
+
* The version number of this document (it will increase after each
|
|
29
|
+
* change, including undo/redo).
|
|
30
|
+
*/
|
|
31
|
+
readonly version: number;
|
|
32
|
+
/**
|
|
33
|
+
* the raw Document Text
|
|
34
|
+
*/
|
|
35
|
+
readonly text: string;
|
|
36
|
+
/**
|
|
37
|
+
* The natural language locale.
|
|
38
|
+
*/
|
|
39
|
+
readonly locale?: string | undefined;
|
|
40
|
+
positionAt(offset: number): Position;
|
|
41
|
+
offsetAt(position: Position): number;
|
|
42
|
+
lineAt(offset: number): TextDocumentLine;
|
|
43
|
+
}
|
|
44
|
+
export interface CreateTextDocumentParams {
|
|
45
|
+
uri: DocumentUri | string;
|
|
46
|
+
content: string;
|
|
47
|
+
languageId?: string | string[] | undefined;
|
|
48
|
+
locale?: string | undefined;
|
|
49
|
+
version?: number | undefined;
|
|
50
|
+
}
|
|
51
|
+
export declare function createTextDocument({ uri, content, languageId, locale, version, }: CreateTextDocumentParams): TextDocument;
|
|
52
|
+
//# sourceMappingURL=TextDocument.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.createTextDocument = void 0;
|
|
27
|
+
const LanguageIds_1 = require("../LanguageIds");
|
|
28
|
+
const Uri = __importStar(require("./Uri"));
|
|
29
|
+
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
30
|
+
class TextDocumentImpl {
|
|
31
|
+
constructor(uri, text, languageId, locale, version) {
|
|
32
|
+
this.uri = uri;
|
|
33
|
+
this.text = text;
|
|
34
|
+
this.languageId = languageId;
|
|
35
|
+
this.locale = locale;
|
|
36
|
+
this.version = version;
|
|
37
|
+
const primaryLanguageId = typeof languageId === 'string' ? languageId : languageId[0] || 'plaintext';
|
|
38
|
+
this.vsTextDoc = vscode_languageserver_textdocument_1.TextDocument.create(uri.toString(), primaryLanguageId, version, text);
|
|
39
|
+
}
|
|
40
|
+
positionAt(offset) {
|
|
41
|
+
return this.vsTextDoc.positionAt(offset);
|
|
42
|
+
}
|
|
43
|
+
offsetAt(position) {
|
|
44
|
+
return this.vsTextDoc.offsetAt(position);
|
|
45
|
+
}
|
|
46
|
+
lineAt(offset) {
|
|
47
|
+
const position = this.vsTextDoc.positionAt(offset);
|
|
48
|
+
position.character = 0;
|
|
49
|
+
const lineOffset = this.vsTextDoc.offsetAt(position);
|
|
50
|
+
const range = {
|
|
51
|
+
start: position,
|
|
52
|
+
end: { line: position.line + 1, character: 0 },
|
|
53
|
+
};
|
|
54
|
+
let _text;
|
|
55
|
+
const getText = () => this.vsTextDoc.getText(range);
|
|
56
|
+
return {
|
|
57
|
+
get text() {
|
|
58
|
+
return _text !== null && _text !== void 0 ? _text : (_text = getText());
|
|
59
|
+
},
|
|
60
|
+
offset: lineOffset,
|
|
61
|
+
position,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function createTextDocument({ uri, content, languageId, locale, version, }) {
|
|
66
|
+
version = version !== null && version !== void 0 ? version : 1;
|
|
67
|
+
uri = Uri.toUri(uri);
|
|
68
|
+
languageId = languageId !== null && languageId !== void 0 ? languageId : (0, LanguageIds_1.getLanguagesForBasename)(Uri.basename(uri));
|
|
69
|
+
languageId = languageId.length === 0 ? 'text' : languageId;
|
|
70
|
+
return new TextDocumentImpl(uri, content, languageId, locale, version);
|
|
71
|
+
}
|
|
72
|
+
exports.createTextDocument = createTextDocument;
|
|
73
|
+
//# sourceMappingURL=TextDocument.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Utils, URI as Uri } from 'vscode-uri';
|
|
2
|
+
export { URI as Uri } from 'vscode-uri';
|
|
3
|
+
export declare const basename: typeof Utils.basename, dirname: typeof Utils.dirname, extname: typeof Utils.extname, joinPath: typeof Utils.joinPath, resolvePath: typeof Utils.resolvePath;
|
|
4
|
+
export declare function toUri(uriOrFile: string | Uri): Uri;
|
|
5
|
+
//# sourceMappingURL=Uri.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toUri = exports.resolvePath = exports.joinPath = exports.extname = exports.dirname = exports.basename = exports.Uri = void 0;
|
|
4
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
5
|
+
var vscode_uri_2 = require("vscode-uri");
|
|
6
|
+
Object.defineProperty(exports, "Uri", { enumerable: true, get: function () { return vscode_uri_2.URI; } });
|
|
7
|
+
exports.basename = vscode_uri_1.Utils.basename, exports.dirname = vscode_uri_1.Utils.dirname, exports.extname = vscode_uri_1.Utils.extname, exports.joinPath = vscode_uri_1.Utils.joinPath, exports.resolvePath = vscode_uri_1.Utils.resolvePath;
|
|
8
|
+
const isFile = /^(?:[a-zA-Z]:|[/\\])/;
|
|
9
|
+
const isPossibleUri = /\w:\/\//;
|
|
10
|
+
function toUri(uriOrFile) {
|
|
11
|
+
if (uriOrFile instanceof vscode_uri_1.URI)
|
|
12
|
+
return uriOrFile;
|
|
13
|
+
return isFile.test(uriOrFile) && !isPossibleUri.test(uriOrFile) ? vscode_uri_1.URI.file(uriOrFile) : vscode_uri_1.URI.parse(uriOrFile);
|
|
14
|
+
}
|
|
15
|
+
exports.toUri = toUri;
|
|
16
|
+
//# sourceMappingURL=Uri.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CSpellSettingsWithSourceTrace, Glob, ImportFileRef } from '@cspell/cspell-types';
|
|
2
|
-
import { CSpellSettingsInternal } from '../Models/CSpellSettingsInternalDef';
|
|
2
|
+
import { CSpellSettingsInternal, CSpellSettingsInternalFinalized } from '../Models/CSpellSettingsInternalDef';
|
|
3
|
+
import { OptionalOrUndefined } from '../util/types';
|
|
3
4
|
declare type CSpellSettingsWST = CSpellSettingsWithSourceTrace;
|
|
5
|
+
declare type CSpellSettingsWSTO = OptionalOrUndefined<CSpellSettingsWithSourceTrace>;
|
|
4
6
|
declare type CSpellSettingsI = CSpellSettingsInternal;
|
|
5
7
|
export declare const configSettingsFileVersion0_1 = "0.1";
|
|
6
8
|
export declare const configSettingsFileVersion0_2 = "0.2";
|
|
@@ -10,18 +12,18 @@ declare function mergeObjects(left: undefined, right: undefined): undefined;
|
|
|
10
12
|
declare function mergeObjects<T>(left: T, right: undefined): T;
|
|
11
13
|
declare function mergeObjects<T>(left: T, right: T): T;
|
|
12
14
|
declare function mergeObjects<T>(left: undefined, right: T): T;
|
|
13
|
-
export declare function mergeSettings(left:
|
|
14
|
-
export declare function mergeInDocSettings(left:
|
|
15
|
-
export declare function calcOverrideSettings(settings:
|
|
15
|
+
export declare function mergeSettings(left: CSpellSettingsWSTO | CSpellSettingsI, ...settings: (CSpellSettingsWSTO | CSpellSettingsI)[]): CSpellSettingsI;
|
|
16
|
+
export declare function mergeInDocSettings(left: CSpellSettingsWSTO, right: CSpellSettingsWSTO): CSpellSettingsWST;
|
|
17
|
+
export declare function calcOverrideSettings(settings: CSpellSettingsWSTO, filename: string): CSpellSettingsI;
|
|
16
18
|
/**
|
|
17
19
|
*
|
|
18
20
|
* @param settings - settings to finalize
|
|
19
21
|
* @returns settings where all globs and file paths have been resolved.
|
|
20
22
|
*/
|
|
21
|
-
export declare function finalizeSettings(settings:
|
|
23
|
+
export declare function finalizeSettings(settings: CSpellSettingsWSTO | CSpellSettingsI): CSpellSettingsInternalFinalized;
|
|
22
24
|
export declare function toInternalSettings(settings: undefined): undefined;
|
|
23
|
-
export declare function toInternalSettings(settings: CSpellSettingsI |
|
|
24
|
-
export declare function toInternalSettings(settings?: CSpellSettingsI |
|
|
25
|
+
export declare function toInternalSettings(settings: CSpellSettingsI | CSpellSettingsWSTO): CSpellSettingsI;
|
|
26
|
+
export declare function toInternalSettings(settings?: CSpellSettingsI | CSpellSettingsWSTO): CSpellSettingsI | undefined;
|
|
25
27
|
/**
|
|
26
28
|
* @param filename - filename
|
|
27
29
|
* @param globs - globs
|
|
@@ -34,7 +36,7 @@ export declare function checkFilenameMatchesGlob(filename: string, globs: Glob |
|
|
|
34
36
|
* Return a list of Setting Sources used to create this Setting.
|
|
35
37
|
* @param settings the settings to search
|
|
36
38
|
*/
|
|
37
|
-
export declare function getSources(settings:
|
|
39
|
+
export declare function getSources(settings: CSpellSettingsWSTO): CSpellSettingsWSTO[];
|
|
38
40
|
export interface ImportFileRefWithError extends ImportFileRef {
|
|
39
41
|
error: Error;
|
|
40
42
|
}
|
|
@@ -42,7 +44,7 @@ export interface ConfigurationDependencies {
|
|
|
42
44
|
configFiles: string[];
|
|
43
45
|
dictionaryFiles: string[];
|
|
44
46
|
}
|
|
45
|
-
export declare function extractDependencies(settings:
|
|
47
|
+
export declare function extractDependencies(settings: CSpellSettingsWSTO | CSpellSettingsI): ConfigurationDependencies;
|
|
46
48
|
export declare const __testing__: {
|
|
47
49
|
mergeObjects: typeof mergeObjects;
|
|
48
50
|
};
|
|
@@ -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];
|
|
@@ -186,7 +190,7 @@ function mergeInDocSettings(left, right) {
|
|
|
186
190
|
...mergeSettings(left, right),
|
|
187
191
|
includeRegExpList: mergeListUnique(left.includeRegExpList, right.includeRegExpList),
|
|
188
192
|
};
|
|
189
|
-
return merged;
|
|
193
|
+
return util.clean(merged);
|
|
190
194
|
}
|
|
191
195
|
exports.mergeInDocSettings = mergeInDocSettings;
|
|
192
196
|
function takeRightOtherwiseLeft(left, right) {
|
|
@@ -217,6 +221,7 @@ function _finalizeSettings(settings) {
|
|
|
217
221
|
// apply patterns to any RegExpLists.
|
|
218
222
|
const finalized = {
|
|
219
223
|
...settings,
|
|
224
|
+
finalized: true,
|
|
220
225
|
ignoreRegExpList: (0, patterns_1.resolvePatterns)(settings.ignoreRegExpList, settings.patterns),
|
|
221
226
|
includeRegExpList: (0, patterns_1.resolvePatterns)(settings.includeRegExpList, settings.patterns),
|
|
222
227
|
};
|
|
@@ -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];
|
|
@@ -139,7 +143,12 @@ const getSettings = (function () {
|
|
|
139
143
|
if (!settings) {
|
|
140
144
|
const jsonSettings = (0, configLoader_1.readSettings)(defaultConfigFile);
|
|
141
145
|
settings = (0, index_1.mergeSettings)(exports._defaultSettings, jsonSettings);
|
|
142
|
-
|
|
146
|
+
if (jsonSettings.name !== undefined) {
|
|
147
|
+
settings.name = jsonSettings.name;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
delete settings.name;
|
|
151
|
+
}
|
|
143
152
|
}
|
|
144
153
|
return settings;
|
|
145
154
|
};
|
|
@@ -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];
|
|
@@ -24,6 +28,7 @@ const path = __importStar(require("path"));
|
|
|
24
28
|
const resolveFile_1 = require("../util/resolveFile");
|
|
25
29
|
const DictionaryReferenceCollection_1 = require("./DictionaryReferenceCollection");
|
|
26
30
|
const cspell_trie_lib_1 = require("cspell-trie-lib");
|
|
31
|
+
const util_1 = require("../util/util");
|
|
27
32
|
/**
|
|
28
33
|
* Combines the list of desired dictionaries with the list of dictionary
|
|
29
34
|
* definitions. Order does not matter, but the number of leading `!` does.
|
|
@@ -114,17 +119,10 @@ class _DictionaryDefinitionInternalWithSource {
|
|
|
114
119
|
scope,
|
|
115
120
|
useCompounds,
|
|
116
121
|
};
|
|
122
|
+
Object.assign(this, (0, util_1.clean)(ddi));
|
|
117
123
|
this.name = ddi.name;
|
|
118
124
|
this.file = ddi.file;
|
|
119
125
|
this.path = ddi.path;
|
|
120
|
-
this.addWords = ddi.addWords;
|
|
121
|
-
this.description = ddi.description;
|
|
122
|
-
this.dictionaryInformation = ddi.dictionaryInformation;
|
|
123
|
-
this.type = ddi.type;
|
|
124
|
-
this.repMap = ddi.repMap;
|
|
125
|
-
this.noSuggest = ddi.noSuggest;
|
|
126
|
-
this.scope = ddi.scope;
|
|
127
|
-
this.useCompounds = ddi.useCompounds;
|
|
128
126
|
this._weightMap = this.dictionaryInformation
|
|
129
127
|
? (0, cspell_trie_lib_1.mapDictionaryInformationToWeightMap)(this.dictionaryInformation)
|
|
130
128
|
: undefined;
|
|
@@ -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];
|
|
@@ -22,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
22
26
|
exports.internal = exports.getIgnoreRegExpFromDocument = exports.getIgnoreWordsFromDocument = exports.getInDocumentSettings = void 0;
|
|
23
27
|
const gensequence_1 = require("gensequence");
|
|
24
28
|
const Text = __importStar(require("../util/text"));
|
|
29
|
+
const util_1 = require("../util/util");
|
|
25
30
|
const CSpellSettingsServer_1 = require("./CSpellSettingsServer");
|
|
26
31
|
// cspell:ignore gimuy
|
|
27
32
|
const regExMatchRegEx = /\/.*\/[gimuy]*/;
|
|
@@ -77,7 +82,7 @@ function parseLocale(match) {
|
|
|
77
82
|
}
|
|
78
83
|
function parseIgnoreWords(match) {
|
|
79
84
|
const wordsSetting = parseWords(match);
|
|
80
|
-
return { id: 'in-doc-ignore', ignoreWords: wordsSetting.words };
|
|
85
|
+
return (0, util_1.clean)({ id: 'in-doc-ignore', ignoreWords: wordsSetting.words });
|
|
81
86
|
}
|
|
82
87
|
function parseRegEx(match) {
|
|
83
88
|
const patterns = [match.replace(/^[^\s]+\s+/, '')].map((a) => {
|
|
@@ -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];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CSpellSettings, CSpellUserSettings } from '@cspell/cspell-types';
|
|
2
|
-
|
|
2
|
+
import { CSpellSettingsInternal } from '../Models/CSpellSettingsInternalDef';
|
|
3
|
+
export declare function combineTextAndLanguageSettings(settings: CSpellUserSettings, text: string, languageId: string | string[]): CSpellSettingsInternal;
|
|
3
4
|
export declare function extractSettingsFromText(text: string): CSpellSettings;
|
|
4
5
|
//# sourceMappingURL=TextDocumentSettings.d.ts.map
|
|
@@ -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];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { CSpellSettingsWithSourceTrace, CSpellUserSettings, ImportFileRef, PnPSettings } from '@cspell/cspell-types';
|
|
1
|
+
import type { CSpellSettingsWithSourceTrace, CSpellUserSettings, ImportFileRef, PnPSettings as PnPSettingsStrict } from '@cspell/cspell-types';
|
|
2
2
|
import { URI } from 'vscode-uri';
|
|
3
3
|
import { CSpellSettingsInternal } from '../Models/CSpellSettingsInternalDef';
|
|
4
|
+
import { OptionalOrUndefined } from '../util/types';
|
|
4
5
|
import { LoaderResult } from './pnpLoader';
|
|
5
6
|
declare type CSpellSettingsWST = CSpellSettingsWithSourceTrace;
|
|
6
7
|
declare type CSpellSettingsI = CSpellSettingsInternal;
|
|
8
|
+
declare type PnPSettings = OptionalOrUndefined<PnPSettingsStrict>;
|
|
7
9
|
export declare const sectionCSpell = "cSpell";
|
|
8
10
|
export declare const defaultFileName = "cspell.json";
|
|
9
11
|
export declare const defaultConfigFilenames: readonly string[];
|
|
@@ -18,6 +20,7 @@ export declare function readSettings(filename: string, defaultValues: CSpellSett
|
|
|
18
20
|
export declare function readSettings(filename: string, relativeTo: string): CSpellSettingsI;
|
|
19
21
|
export declare function readSettings(filename: string, relativeTo: string, defaultValues: CSpellSettingsWST): CSpellSettingsI;
|
|
20
22
|
export declare function searchForConfig(searchFrom: string | undefined, pnpSettings?: PnPSettings): Promise<CSpellSettingsI | undefined>;
|
|
23
|
+
export declare function searchForConfigSync(searchFrom: string | undefined, pnpSettings?: PnPSettings): CSpellSettingsI | undefined;
|
|
21
24
|
/**
|
|
22
25
|
* Load a CSpell configuration files.
|
|
23
26
|
* @param file - path or package reference to load.
|
|
@@ -25,6 +28,13 @@ export declare function searchForConfig(searchFrom: string | undefined, pnpSetti
|
|
|
25
28
|
* @returns normalized CSpellSettings
|
|
26
29
|
*/
|
|
27
30
|
export declare function loadConfig(file: string, pnpSettings?: PnPSettings): Promise<CSpellSettingsI>;
|
|
31
|
+
/**
|
|
32
|
+
* Load a CSpell configuration files.
|
|
33
|
+
* @param filename - path or package reference to load.
|
|
34
|
+
* @param pnpSettings - PnP settings
|
|
35
|
+
* @returns normalized CSpellSettings
|
|
36
|
+
*/
|
|
37
|
+
export declare function loadConfigSync(filename: string, pnpSettings?: PnPSettings): CSpellSettingsI;
|
|
28
38
|
export declare function loadPnP(pnpSettings: PnPSettings, searchFrom: URI): Promise<LoaderResult>;
|
|
29
39
|
export declare function loadPnPSync(pnpSettings: PnPSettings, searchFrom: URI): LoaderResult;
|
|
30
40
|
export declare function readRawSettings(filename: string, relativeTo?: string): CSpellSettingsWST;
|