cspell-lib 6.18.1 → 6.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/Document/Document.d.ts +11 -0
- package/dist/Document/Document.js +3 -0
- package/dist/Document/index.d.ts +4 -0
- package/dist/Document/index.js +9 -0
- package/dist/Document/isBinaryDoc.d.ts +5 -0
- package/dist/Document/isBinaryDoc.js +21 -0
- package/dist/Document/normalizeLanguageIds.d.ts +2 -0
- package/dist/Document/normalizeLanguageIds.js +8 -0
- package/dist/Document/resolveDocument.d.ts +11 -0
- package/dist/Document/resolveDocument.js +52 -0
- package/dist/LanguageIds.d.ts +4 -0
- package/dist/LanguageIds.js +33 -4
- package/dist/Models/CSpellSettingsInternalDef.d.ts +3 -3
- package/dist/Models/TextDocument.js +3 -3
- package/dist/Models/Uri.d.ts +1 -1
- package/dist/Models/ValidationResult.d.ts +1 -1
- package/dist/Settings/CSpellSettingsServer.d.ts +2 -2
- package/dist/Settings/Controller/SettingsController.d.ts +1 -1
- package/dist/Settings/Controller/configLoader/configLoader.d.ts +9 -18
- package/dist/Settings/Controller/configLoader/configLoader.js +4 -19
- package/dist/Settings/Controller/configLoader/defaultSettings.d.ts +3 -0
- package/dist/Settings/Controller/configLoader/defaultSettings.js +11 -0
- package/dist/Settings/Controller/configLoader/extractImportErrors.d.ts +2 -2
- package/dist/Settings/Controller/configLoader/index.d.ts +2 -1
- package/dist/Settings/Controller/configLoader/index.js +4 -3
- package/dist/Settings/Controller/configLoader/normalizeRawSettings.d.ts +2 -2
- package/dist/Settings/Controller/configLoader/readSettings.d.ts +1 -1
- package/dist/Settings/Controller/configLoader/readSettingsFiles.d.ts +9 -0
- package/dist/Settings/Controller/configLoader/readSettingsFiles.js +17 -0
- package/dist/Settings/Controller/configLoader/toGlobDef.d.ts +1 -1
- package/dist/Settings/Controller/configLoader/types.d.ts +5 -0
- package/dist/Settings/Controller/configLoader/types.js +3 -0
- package/dist/Settings/Controller/pnpLoader.d.ts +0 -3
- package/dist/Settings/Controller/pnpLoader.js +3 -3
- package/dist/Settings/DefaultSettings.d.ts +1 -1
- package/dist/Settings/DefaultSettings.js +2 -2
- package/dist/Settings/DictionarySettings.d.ts +2 -2
- package/dist/Settings/DictionarySettings.js +2 -2
- package/dist/Settings/InDocSettings.d.ts +2 -2
- package/dist/Settings/TextDocumentSettings.d.ts +1 -1
- package/dist/Settings/index.d.ts +4 -4
- package/dist/Settings/index.js +7 -7
- package/dist/Settings/index.link.d.ts +1 -1
- package/dist/SpellingDictionary/Dictionaries.d.ts +2 -2
- package/dist/SpellingDictionary/DictionaryController/DictionaryLoader.d.ts +3 -3
- package/dist/SpellingDictionary/DictionaryController/DictionaryLoader.js +1 -1
- package/dist/SpellingDictionary/DictionaryController/index.d.ts +1 -1
- package/dist/SpellingDictionary/DictionaryLoader.d.ts +3 -3
- package/dist/SpellingDictionary/SpellingDictionaryError.d.ts +1 -1
- package/dist/SpellingDictionary/SuggestExperimental/SuggestionCollector.d.ts +1 -1
- package/dist/SpellingDictionary/SuggestExperimental/helpers.d.ts +1 -1
- package/dist/SpellingDictionary/SuggestExperimental/suggest.d.ts +2 -2
- package/dist/SpellingDictionary/index.d.ts +1 -1
- package/dist/SpellingDictionary/index.js +1 -1
- package/dist/exclusionHelper.js +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.js +13 -12
- package/dist/spellCheckFile.d.ts +2 -20
- package/dist/spellCheckFile.js +6 -66
- package/dist/static.d.ts +1 -1
- package/dist/suggestions.d.ts +1 -1
- package/dist/textValidation/checkText.d.ts +5 -4
- package/dist/textValidation/checkText.js +2 -2
- package/dist/textValidation/defaultConstants.d.ts +5 -0
- package/dist/textValidation/defaultConstants.js +8 -0
- package/dist/textValidation/determineTextDocumentSettings.d.ts +3 -3
- package/dist/textValidation/docValidator.d.ts +10 -10
- package/dist/textValidation/docValidator.js +2 -1
- package/dist/textValidation/index.d.ts +3 -3
- package/dist/textValidation/isWordValid.d.ts +2 -2
- package/dist/textValidation/lineValidatorFactory.d.ts +1 -1
- package/dist/textValidation/lineValidatorFactory.js +2 -2
- package/dist/textValidation/parsedText.d.ts +2 -2
- package/dist/textValidation/textValidator.d.ts +2 -6
- package/dist/textValidation/textValidator.js +3 -6
- package/dist/textValidation/validator.d.ts +2 -2
- package/dist/trace.d.ts +1 -1
- package/dist/util/FreqCounter.d.ts +1 -1
- package/dist/util/TextMap.d.ts +2 -2
- package/dist/util/iterableIteratorLib.d.ts +1 -1
- package/dist/util/resolveFile.js +1 -1
- package/dist/util/util.d.ts +1 -1
- package/dist/validator.d.ts +1 -1
- package/package.json +17 -20
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Document {
|
|
2
|
+
uri: UriString;
|
|
3
|
+
text?: string;
|
|
4
|
+
languageId?: string;
|
|
5
|
+
locale?: string;
|
|
6
|
+
}
|
|
7
|
+
export type UriString = string;
|
|
8
|
+
export interface DocumentWithText extends Document {
|
|
9
|
+
text: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Document.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fileToTextDocument = exports.fileToDocument = exports.isBinaryFile = void 0;
|
|
4
|
+
var isBinaryDoc_1 = require("./isBinaryDoc");
|
|
5
|
+
Object.defineProperty(exports, "isBinaryFile", { enumerable: true, get: function () { return isBinaryDoc_1.isBinaryFile; } });
|
|
6
|
+
var resolveDocument_1 = require("./resolveDocument");
|
|
7
|
+
Object.defineProperty(exports, "fileToDocument", { enumerable: true, get: function () { return resolveDocument_1.fileToDocument; } });
|
|
8
|
+
Object.defineProperty(exports, "fileToTextDocument", { enumerable: true, get: function () { return resolveDocument_1.fileToTextDocument; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { URI } from 'vscode-uri';
|
|
2
|
+
import type { Document } from './Document';
|
|
3
|
+
export declare function isBinaryDoc(document: Document): boolean;
|
|
4
|
+
export declare function isBinaryFile(filenameUri: URI, languageId?: string | string[]): boolean;
|
|
5
|
+
//# sourceMappingURL=isBinaryDoc.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBinaryFile = exports.isBinaryDoc = void 0;
|
|
4
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
5
|
+
const LanguageIds_1 = require("../LanguageIds");
|
|
6
|
+
const normalizeLanguageIds_1 = require("./normalizeLanguageIds");
|
|
7
|
+
function isBinaryDoc(document) {
|
|
8
|
+
return isBinaryFile(vscode_uri_1.URI.parse(document.uri), document.languageId);
|
|
9
|
+
}
|
|
10
|
+
exports.isBinaryDoc = isBinaryDoc;
|
|
11
|
+
function isBinaryFile(filenameUri, languageId) {
|
|
12
|
+
if (languageId) {
|
|
13
|
+
const ids = (0, normalizeLanguageIds_1.normalizeLanguageIds)(languageId);
|
|
14
|
+
if (ids.length)
|
|
15
|
+
return (0, LanguageIds_1.isGenerated)(ids);
|
|
16
|
+
}
|
|
17
|
+
const filename = vscode_uri_1.Utils.basename(filenameUri);
|
|
18
|
+
return (0, LanguageIds_1.isGeneratedFile)(filename);
|
|
19
|
+
}
|
|
20
|
+
exports.isBinaryFile = isBinaryFile;
|
|
21
|
+
//# sourceMappingURL=isBinaryDoc.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeLanguageIds = void 0;
|
|
4
|
+
function normalizeLanguageIds(languageId) {
|
|
5
|
+
return (Array.isArray(languageId) ? languageId.join(',') : languageId).split(',').map((s) => s.trim());
|
|
6
|
+
}
|
|
7
|
+
exports.normalizeLanguageIds = normalizeLanguageIds;
|
|
8
|
+
//# sourceMappingURL=normalizeLanguageIds.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { TextDocument } from '../Models/TextDocument';
|
|
3
|
+
import type { Document, DocumentWithText } from './Document';
|
|
4
|
+
export declare function fileToDocument(file: string): Document;
|
|
5
|
+
export declare function fileToDocument(file: string, text: string, languageId?: string, locale?: string): DocumentWithText;
|
|
6
|
+
export declare function fileToDocument(file: string, text?: string, languageId?: string, locale?: string): Document | DocumentWithText;
|
|
7
|
+
export declare function fileToTextDocument(file: string): Promise<TextDocument>;
|
|
8
|
+
export declare function documentToTextDocument(document: DocumentWithText): TextDocument;
|
|
9
|
+
export declare function resolveDocumentToTextDocument(doc: Document): Promise<TextDocument>;
|
|
10
|
+
export declare function resolveDocument(document: DocumentWithText | Document, encoding?: BufferEncoding): Promise<DocumentWithText>;
|
|
11
|
+
//# sourceMappingURL=resolveDocument.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveDocument = exports.resolveDocumentToTextDocument = exports.documentToTextDocument = exports.fileToTextDocument = exports.fileToDocument = void 0;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
6
|
+
const TextDocument_1 = require("../Models/TextDocument");
|
|
7
|
+
const util_1 = require("../util/util");
|
|
8
|
+
const defaultEncoding = 'utf8';
|
|
9
|
+
function fileToDocument(file, text, languageId, locale) {
|
|
10
|
+
return (0, util_1.clean)({
|
|
11
|
+
uri: vscode_uri_1.URI.file(file).toString(),
|
|
12
|
+
text,
|
|
13
|
+
languageId,
|
|
14
|
+
locale,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.fileToDocument = fileToDocument;
|
|
18
|
+
async function fileToTextDocument(file) {
|
|
19
|
+
return documentToTextDocument(await resolveDocument(fileToDocument(file)));
|
|
20
|
+
}
|
|
21
|
+
exports.fileToTextDocument = fileToTextDocument;
|
|
22
|
+
function documentToTextDocument(document) {
|
|
23
|
+
const { uri, text: content, languageId, locale } = document;
|
|
24
|
+
return (0, TextDocument_1.createTextDocument)({ uri, content, languageId, locale });
|
|
25
|
+
}
|
|
26
|
+
exports.documentToTextDocument = documentToTextDocument;
|
|
27
|
+
async function resolveDocumentToTextDocument(doc) {
|
|
28
|
+
return documentToTextDocument(await resolveDocument(doc));
|
|
29
|
+
}
|
|
30
|
+
exports.resolveDocumentToTextDocument = resolveDocumentToTextDocument;
|
|
31
|
+
async function readDocument(filename, encoding = defaultEncoding) {
|
|
32
|
+
const text = await (0, promises_1.readFile)(filename, encoding);
|
|
33
|
+
const uri = vscode_uri_1.URI.file(filename).toString();
|
|
34
|
+
return {
|
|
35
|
+
uri,
|
|
36
|
+
text,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function resolveDocument(document, encoding) {
|
|
40
|
+
if (isDocumentWithText(document))
|
|
41
|
+
return Promise.resolve(document);
|
|
42
|
+
const uri = vscode_uri_1.URI.parse(document.uri);
|
|
43
|
+
if (uri.scheme !== 'file') {
|
|
44
|
+
throw new Error(`Unsupported schema: "${uri.scheme}", open "${uri.toString()}"`);
|
|
45
|
+
}
|
|
46
|
+
return readDocument(uri.fsPath, encoding);
|
|
47
|
+
}
|
|
48
|
+
exports.resolveDocument = resolveDocument;
|
|
49
|
+
function isDocumentWithText(doc) {
|
|
50
|
+
return doc.text !== undefined;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=resolveDocument.js.map
|
package/dist/LanguageIds.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ export interface LanguageExtensionDefinition {
|
|
|
11
11
|
extensions: string[];
|
|
12
12
|
/** Filenames that do not have an extension or have a different type than their implied extension */
|
|
13
13
|
filenames?: string[];
|
|
14
|
+
/** Indicates that it is a Text or Binary file type. */
|
|
15
|
+
format?: 'Text' | 'Binary';
|
|
16
|
+
/** Optional Description */
|
|
17
|
+
description?: string;
|
|
14
18
|
}
|
|
15
19
|
export type LanguageDefinition = LanguageExtensionDefinition;
|
|
16
20
|
export type LanguageDefinitions = LanguageDefinition[];
|
package/dist/LanguageIds.js
CHANGED
|
@@ -37,7 +37,7 @@ exports.languageExtensionDefinitions = [
|
|
|
37
37
|
id: 'html',
|
|
38
38
|
extensions: ['.html', '.htm', '.shtml', '.xhtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm', '.volt', '.vue'],
|
|
39
39
|
},
|
|
40
|
-
{ id: 'ini', extensions: ['.ini'] },
|
|
40
|
+
{ id: 'ini', extensions: ['.ini', '.conf'] },
|
|
41
41
|
{ id: 'properties', extensions: ['.properties', '.gitconfig', '.cfg', '.conf'] },
|
|
42
42
|
{ id: 'jade', extensions: ['.jade', '.pug'] },
|
|
43
43
|
{ id: 'java', extensions: ['.java', '.jav'] },
|
|
@@ -70,7 +70,7 @@ exports.languageExtensionDefinitions = [
|
|
|
70
70
|
{ id: 'ruby', extensions: ['.rb', '.rbx', '.rjs', '.gemspec', '.rake', '.ru'] },
|
|
71
71
|
{ id: 'ruby', extensions: [], filenames: ['Gemfile'] },
|
|
72
72
|
{ id: 'rust', extensions: ['.rs'] },
|
|
73
|
-
{ id: 'scala', extensions: ['.scala', '.sc'] },
|
|
73
|
+
{ id: 'scala', extensions: ['.scala', '.sc', '.sbt'] },
|
|
74
74
|
{ id: 'scss', extensions: ['.scss'] },
|
|
75
75
|
{ id: 'shaderlab', extensions: ['.shader', '.cginc'] },
|
|
76
76
|
{
|
|
@@ -165,6 +165,7 @@ exports.languageExtensionDefinitions = [
|
|
|
165
165
|
'.xul',
|
|
166
166
|
],
|
|
167
167
|
},
|
|
168
|
+
{ id: 'wheel', extensions: ['.whl'], format: 'Binary' },
|
|
168
169
|
{ id: 'xsl', extensions: ['.xsl', '.xslt'] },
|
|
169
170
|
{ id: 'yaml', extensions: ['.eyaml', '.eyml', '.yaml', '.yml'] },
|
|
170
171
|
{ id: 'latex', extensions: ['.tex'] },
|
|
@@ -178,20 +179,41 @@ exports.languageExtensionDefinitions = [
|
|
|
178
179
|
//
|
|
179
180
|
{
|
|
180
181
|
id: 'image',
|
|
181
|
-
extensions: [
|
|
182
|
+
extensions: [
|
|
183
|
+
'.bmp',
|
|
184
|
+
'.exr',
|
|
185
|
+
'.gif',
|
|
186
|
+
'.ico',
|
|
187
|
+
'.jpeg',
|
|
188
|
+
'.jpg',
|
|
189
|
+
'.pbm',
|
|
190
|
+
'.pgm',
|
|
191
|
+
'.png',
|
|
192
|
+
'.ppm',
|
|
193
|
+
'.ras',
|
|
194
|
+
'.sgi',
|
|
195
|
+
'.tiff',
|
|
196
|
+
'.webp',
|
|
197
|
+
'.xbm',
|
|
198
|
+
],
|
|
199
|
+
format: 'Binary',
|
|
200
|
+
description: 'Some image extensions',
|
|
182
201
|
},
|
|
183
202
|
// cspell:ignore woff
|
|
184
203
|
{
|
|
185
204
|
id: 'binary',
|
|
186
205
|
extensions: ['.gz', '.exe', '.dll', '.lib', '.obj', '.o', '.eot', '.cur', '.zip'],
|
|
206
|
+
format: 'Binary',
|
|
187
207
|
},
|
|
188
208
|
{
|
|
189
209
|
id: 'fonts',
|
|
190
210
|
extensions: ['.ttf', '.woff', '.woff2'],
|
|
211
|
+
format: 'Binary',
|
|
191
212
|
},
|
|
192
213
|
{
|
|
193
214
|
id: 'video',
|
|
194
215
|
extensions: ['.mov', '.mpg'],
|
|
216
|
+
format: 'Binary',
|
|
195
217
|
},
|
|
196
218
|
{
|
|
197
219
|
id: 'lock',
|
|
@@ -204,8 +226,15 @@ exports.languageExtensionDefinitions = [
|
|
|
204
226
|
// cspell:ignore eslintcache
|
|
205
227
|
filenames: ['.cspellcache', '.DS_Store', '.eslintcache'],
|
|
206
228
|
},
|
|
229
|
+
{ id: 'dll', extensions: ['.dll'], format: 'Binary' },
|
|
230
|
+
{ id: 'exe', extensions: ['.exe'], format: 'Binary' },
|
|
231
|
+
{ id: 'object-file', extensions: ['.o', '.obj'], format: 'Binary' },
|
|
232
|
+
{ id: 'jar', extensions: ['.jar'], format: 'Binary' },
|
|
233
|
+
{ id: 'spv', extensions: ['.spv'], format: 'Binary', description: 'SPSS Output Document' },
|
|
234
|
+
{ id: 'mdb', extensions: ['.mdb'], format: 'Binary', description: 'Microsoft Access DB' },
|
|
207
235
|
];
|
|
208
|
-
exports.
|
|
236
|
+
const binaryFormatIds = exports.languageExtensionDefinitions.filter((d) => d.format === 'Binary').map((d) => d.id);
|
|
237
|
+
exports.binaryLanguages = new Set(['binary', 'image', 'video', 'fonts'].concat(binaryFormatIds));
|
|
209
238
|
exports.generatedFiles = new Set([...exports.binaryLanguages, 'map', 'lock', 'pdf', 'cache_files', 'rsa', 'pem']);
|
|
210
239
|
exports.languageIds = exports.languageExtensionDefinitions.map(({ id }) => id);
|
|
211
240
|
const mapExtensionToSetOfLanguageIds = buildLanguageExtensionMapSet(exports.languageExtensionDefinitions);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AdvancedCSpellSettingsWithSourceTrace, CSpellSettingsWithSourceTrace, DictionaryDefinitionAugmented, DictionaryDefinitionCustom, DictionaryDefinitionPreferred, Parser } from '@cspell/cspell-types';
|
|
2
|
-
import { WeightMap } from 'cspell-trie-lib';
|
|
3
|
-
import { OptionalOrUndefined } from '../util/types';
|
|
1
|
+
import type { AdvancedCSpellSettingsWithSourceTrace, CSpellSettingsWithSourceTrace, DictionaryDefinitionAugmented, DictionaryDefinitionCustom, DictionaryDefinitionPreferred, Parser } from '@cspell/cspell-types';
|
|
2
|
+
import type { WeightMap } from 'cspell-trie-lib';
|
|
3
|
+
import type { OptionalOrUndefined } from '../util/types';
|
|
4
4
|
export declare const SymbolCSpellSettingsInternal: unique symbol;
|
|
5
5
|
export interface CSpellSettingsInternal extends Omit<AdvancedCSpellSettingsWithSourceTrace, 'dictionaryDefinitions'> {
|
|
6
6
|
[SymbolCSpellSettingsInternal]: true;
|
|
@@ -27,11 +27,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.isTextDocument = exports.loadTextDocument = exports.updateTextDocument = exports.createTextDocument = void 0;
|
|
30
|
-
const LanguageIds_1 = require("../LanguageIds");
|
|
31
|
-
const Uri = __importStar(require("./Uri"));
|
|
32
|
-
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
33
30
|
const assert_1 = __importDefault(require("assert"));
|
|
34
31
|
const fs_1 = require("fs");
|
|
32
|
+
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
33
|
+
const LanguageIds_1 = require("../LanguageIds");
|
|
34
|
+
const Uri = __importStar(require("./Uri"));
|
|
35
35
|
class TextDocumentImpl {
|
|
36
36
|
constructor(uri, text, languageId, locale, version) {
|
|
37
37
|
this.uri = uri;
|
package/dist/Models/Uri.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { URI as Uri, Utils } from 'vscode-uri';
|
|
2
2
|
export { URI as Uri } from 'vscode-uri';
|
|
3
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
4
|
export declare function toUri(uriOrFile: string | Uri): Uri;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TextOffset as TextOffsetRW
|
|
1
|
+
import type { Issue, TextOffset as TextOffsetRW } from '@cspell/cspell-types';
|
|
2
2
|
export interface ValidationResult extends TextOffsetRW, Pick<Issue, 'message' | 'issueType'> {
|
|
3
3
|
line: TextOffsetRW;
|
|
4
4
|
isFlagged?: boolean | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AdvancedCSpellSettingsWithSourceTrace, Glob, ImportFileRef } from '@cspell/cspell-types';
|
|
2
|
-
import { CSpellSettingsInternal, CSpellSettingsInternalFinalized } from '../Models/CSpellSettingsInternalDef';
|
|
3
|
-
import { OptionalOrUndefined } from '../util/types';
|
|
2
|
+
import type { CSpellSettingsInternal, CSpellSettingsInternalFinalized } from '../Models/CSpellSettingsInternalDef';
|
|
3
|
+
import type { OptionalOrUndefined } from '../util/types';
|
|
4
4
|
type CSpellSettingsWST = AdvancedCSpellSettingsWithSourceTrace;
|
|
5
5
|
type CSpellSettingsWSTO = OptionalOrUndefined<AdvancedCSpellSettingsWithSourceTrace>;
|
|
6
6
|
type CSpellSettingsI = CSpellSettingsInternal;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { CSpellIO } from 'cspell-io';
|
|
1
|
+
import type { CSpellUserSettings, ImportFileRef, PnPSettings as PnPSettingsStrict } from '@cspell/cspell-types';
|
|
2
|
+
import type { CSpellIO } from 'cspell-io';
|
|
3
3
|
import { URI } from 'vscode-uri';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { LoaderResult } from '../pnpLoader';
|
|
4
|
+
import type { OptionalOrUndefined } from '../../../util/types';
|
|
5
|
+
import type { LoaderResult } from '../pnpLoader';
|
|
7
6
|
import { normalizeCacheSettings } from './normalizeRawSettings';
|
|
8
|
-
|
|
9
|
-
export type CSpellSettingsI = CSpellSettingsInternal;
|
|
7
|
+
import type { CSpellSettingsI, CSpellSettingsWST } from './types';
|
|
10
8
|
type PnPSettings = OptionalOrUndefined<PnPSettingsStrict>;
|
|
11
9
|
export declare const sectionCSpell = "cSpell";
|
|
12
10
|
export declare const defaultFileName = "cspell.json";
|
|
@@ -18,7 +16,7 @@ export declare class ConfigLoader {
|
|
|
18
16
|
* @param cspellIO - CSpellIO interface for reading files.
|
|
19
17
|
*/
|
|
20
18
|
protected constructor(cspellIO: CSpellIO);
|
|
21
|
-
protected cachedFiles: Map<string, CSpellSettingsInternal>;
|
|
19
|
+
protected cachedFiles: Map<string, import("../../../Models/CSpellSettingsInternalDef").CSpellSettingsInternal>;
|
|
22
20
|
protected cspellConfigExplorer: {
|
|
23
21
|
readonly search: (searchFrom?: string | undefined) => Promise<import("cosmiconfig/dist/types").CosmiconfigResult>;
|
|
24
22
|
readonly load: (filepath: string) => Promise<import("cosmiconfig/dist/types").CosmiconfigResult>;
|
|
@@ -73,7 +71,7 @@ export declare class ConfigLoader {
|
|
|
73
71
|
}
|
|
74
72
|
declare class ConfigLoaderInternal extends ConfigLoader {
|
|
75
73
|
constructor(cspellIO: CSpellIO);
|
|
76
|
-
get _cachedFiles(): Map<string, CSpellSettingsInternal>;
|
|
74
|
+
get _cachedFiles(): Map<string, import("../../../Models/CSpellSettingsInternalDef").CSpellSettingsInternal>;
|
|
77
75
|
get _cspellConfigExplorer(): {
|
|
78
76
|
readonly search: (searchFrom?: string | undefined) => Promise<import("cosmiconfig/dist/types").CosmiconfigResult>;
|
|
79
77
|
readonly load: (filepath: string) => Promise<import("cosmiconfig/dist/types").CosmiconfigResult>;
|
|
@@ -88,8 +86,8 @@ declare class ConfigLoaderInternal extends ConfigLoader {
|
|
|
88
86
|
readonly clearSearchCache: () => void;
|
|
89
87
|
readonly clearCaches: () => void;
|
|
90
88
|
};
|
|
91
|
-
readonly _readConfig: (fileRef: ImportFileRef) => CSpellSettingsWithSourceTrace;
|
|
92
|
-
readonly _normalizeSettings: (rawSettings: CSpellSettingsWithSourceTrace, pathToSettingsFile: string, pnpSettings: OptionalOrUndefined<PnPSettingsStrict>) => CSpellSettingsInternal;
|
|
89
|
+
readonly _readConfig: (fileRef: ImportFileRef) => import("@cspell/cspell-types").CSpellSettingsWithSourceTrace;
|
|
90
|
+
readonly _normalizeSettings: (rawSettings: import("@cspell/cspell-types").CSpellSettingsWithSourceTrace, pathToSettingsFile: string, pnpSettings: OptionalOrUndefined<PnPSettingsStrict>) => import("../../../Models/CSpellSettingsInternalDef").CSpellSettingsInternal;
|
|
93
91
|
}
|
|
94
92
|
export declare function searchForConfig(searchFrom: string | undefined, pnpSettings?: PnPSettings): Promise<CSpellSettingsI | undefined>;
|
|
95
93
|
export declare function searchForConfigSync(searchFrom: string | undefined, pnpSettings?: PnPSettings): CSpellSettingsI | undefined;
|
|
@@ -110,13 +108,6 @@ export declare function loadConfigSync(filename: string, pnpSettings?: PnPSettin
|
|
|
110
108
|
export declare function loadPnP(pnpSettings: PnPSettings, searchFrom: URI): Promise<LoaderResult>;
|
|
111
109
|
export declare function loadPnPSync(pnpSettings: PnPSettings, searchFrom: URI): LoaderResult;
|
|
112
110
|
export declare function readRawSettings(filename: string, relativeTo?: string): CSpellSettingsWST;
|
|
113
|
-
/**
|
|
114
|
-
*
|
|
115
|
-
* @param filenames - settings files to read
|
|
116
|
-
* @returns combined configuration
|
|
117
|
-
* @deprecated true
|
|
118
|
-
*/
|
|
119
|
-
export declare function readSettingsFiles(filenames: string[]): CSpellSettingsI;
|
|
120
111
|
export declare function getGlobalSettings(): CSpellSettingsI;
|
|
121
112
|
export declare function getCachedFileSize(): number;
|
|
122
113
|
export declare function clearCachedSettingsFiles(): void;
|
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.__testing__ = exports.getDefaultConfigLoader = exports.createConfigLoader = exports.clearCachedSettingsFiles = exports.getCachedFileSize = exports.getGlobalSettings = exports.
|
|
26
|
+
exports.__testing__ = exports.getDefaultConfigLoader = exports.createConfigLoader = exports.clearCachedSettingsFiles = exports.getCachedFileSize = exports.getGlobalSettings = exports.readRawSettings = exports.loadPnPSync = exports.loadPnP = exports.loadConfigSync = exports.loadConfig = exports.searchForConfigSync = exports.searchForConfig = exports.ConfigLoader = exports.defaultConfigFilenames = exports.defaultFileName = exports.sectionCSpell = void 0;
|
|
27
27
|
const json = __importStar(require("comment-json"));
|
|
28
28
|
const cosmiconfig_1 = require("cosmiconfig");
|
|
29
29
|
const cspell_io_1 = require("cspell-io");
|
|
@@ -37,8 +37,8 @@ const CSpellSettingsServer_1 = require("../../CSpellSettingsServer");
|
|
|
37
37
|
const GlobalSettings_1 = require("../../GlobalSettings");
|
|
38
38
|
const ImportError_1 = require("../ImportError");
|
|
39
39
|
const pnpLoader_1 = require("../pnpLoader");
|
|
40
|
+
const defaultSettings_1 = require("./defaultSettings");
|
|
40
41
|
const normalizeRawSettings_1 = require("./normalizeRawSettings");
|
|
41
|
-
const readSettings_1 = require("./readSettings");
|
|
42
42
|
const supportedCSpellConfigVersions = [constants_1.configSettingsFileVersion0_2];
|
|
43
43
|
const setOfSupportedConfigVersions = Object.freeze(new Set(supportedCSpellConfigVersions));
|
|
44
44
|
exports.sectionCSpell = 'cSpell';
|
|
@@ -87,11 +87,6 @@ function parseJson(_filename, content) {
|
|
|
87
87
|
return json.parse(content);
|
|
88
88
|
}
|
|
89
89
|
exports.defaultConfigFilenames = Object.freeze(searchPlaces.concat());
|
|
90
|
-
const defaultSettings = (0, CSpellSettingsInternalDef_1.createCSpellSettingsInternal)({
|
|
91
|
-
id: 'default',
|
|
92
|
-
name: 'default',
|
|
93
|
-
version: constants_1.currentSettingsFileVersion,
|
|
94
|
-
});
|
|
95
90
|
const defaultPnPSettings = {};
|
|
96
91
|
let defaultConfigLoader = undefined;
|
|
97
92
|
class ConfigLoader {
|
|
@@ -158,7 +153,7 @@ class ConfigLoader {
|
|
|
158
153
|
return s;
|
|
159
154
|
}
|
|
160
155
|
importSettings(fileRef, defaultValues, pnpSettings) {
|
|
161
|
-
defaultValues = defaultValues ?? defaultSettings;
|
|
156
|
+
defaultValues = defaultValues ?? defaultSettings_1.defaultSettings;
|
|
162
157
|
const { filename } = fileRef;
|
|
163
158
|
const importRef = { ...fileRef };
|
|
164
159
|
const cached = this.cachedFiles.get(filename);
|
|
@@ -198,7 +193,7 @@ class ConfigLoader {
|
|
|
198
193
|
loadPnPSync(pnpSettingsToUse, vscode_uri_1.URI.file(pathToSettingsDir));
|
|
199
194
|
// Fix up dictionaryDefinitions
|
|
200
195
|
const settings = {
|
|
201
|
-
version: defaultSettings.version,
|
|
196
|
+
version: defaultSettings_1.defaultSettings.version,
|
|
202
197
|
...rawSettings,
|
|
203
198
|
id,
|
|
204
199
|
name,
|
|
@@ -379,16 +374,6 @@ function readRawSettings(filename, relativeTo) {
|
|
|
379
374
|
return gcl()._readConfig(ref);
|
|
380
375
|
}
|
|
381
376
|
exports.readRawSettings = readRawSettings;
|
|
382
|
-
/**
|
|
383
|
-
*
|
|
384
|
-
* @param filenames - settings files to read
|
|
385
|
-
* @returns combined configuration
|
|
386
|
-
* @deprecated true
|
|
387
|
-
*/
|
|
388
|
-
function readSettingsFiles(filenames) {
|
|
389
|
-
return filenames.map((filename) => (0, readSettings_1.readSettings)(filename)).reduce((a, b) => (0, CSpellSettingsServer_1.mergeSettings)(a, b), defaultSettings);
|
|
390
|
-
}
|
|
391
|
-
exports.readSettingsFiles = readSettingsFiles;
|
|
392
377
|
function resolveFilename(filename, relativeTo) {
|
|
393
378
|
const r = (0, resolveFile_1.resolveFile)(filename, relativeTo);
|
|
394
379
|
return {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultSettings = void 0;
|
|
4
|
+
const CSpellSettingsInternalDef_1 = require("../../../Models/CSpellSettingsInternalDef");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
exports.defaultSettings = (0, CSpellSettingsInternalDef_1.createCSpellSettingsInternal)({
|
|
7
|
+
id: 'default',
|
|
8
|
+
name: 'default',
|
|
9
|
+
version: constants_1.currentSettingsFileVersion,
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=defaultSettings.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ImportFileRef } from '@cspell/cspell-types';
|
|
2
|
-
import { CSpellSettingsWST } from './
|
|
1
|
+
import type { ImportFileRef } from '@cspell/cspell-types';
|
|
2
|
+
import type { CSpellSettingsWST } from './types';
|
|
3
3
|
export declare function extractImportErrors(settings: CSpellSettingsWST): ImportFileRefWithError[];
|
|
4
4
|
export interface ImportFileRefWithError extends ImportFileRef {
|
|
5
5
|
error: Error;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { clearCachedSettingsFiles, ConfigLoader, createConfigLoader, defaultConfigFilenames, defaultFileName, getCachedFileSize, getGlobalSettings, loadConfig, loadConfigSync, loadPnP, loadPnPSync, readRawSettings,
|
|
1
|
+
export { __testing__, clearCachedSettingsFiles, ConfigLoader, createConfigLoader, defaultConfigFilenames, defaultFileName, getCachedFileSize, getGlobalSettings, loadConfig, loadConfigSync, loadPnP, loadPnPSync, readRawSettings, searchForConfig, searchForConfigSync, sectionCSpell, } from './configLoader';
|
|
2
2
|
export { extractImportErrors, ImportFileRefWithError } from './extractImportErrors';
|
|
3
3
|
export { readSettings } from './readSettings';
|
|
4
|
+
export { readSettingsFiles } from './readSettingsFiles';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.readSettingsFiles = exports.readSettings = exports.extractImportErrors = exports.sectionCSpell = exports.searchForConfigSync = exports.searchForConfig = exports.readRawSettings = exports.loadPnPSync = exports.loadPnP = exports.loadConfigSync = exports.loadConfig = exports.getGlobalSettings = exports.getCachedFileSize = exports.defaultFileName = exports.defaultConfigFilenames = exports.createConfigLoader = exports.ConfigLoader = exports.clearCachedSettingsFiles = exports.__testing__ = void 0;
|
|
4
4
|
var configLoader_1 = require("./configLoader");
|
|
5
|
+
Object.defineProperty(exports, "__testing__", { enumerable: true, get: function () { return configLoader_1.__testing__; } });
|
|
5
6
|
Object.defineProperty(exports, "clearCachedSettingsFiles", { enumerable: true, get: function () { return configLoader_1.clearCachedSettingsFiles; } });
|
|
6
7
|
Object.defineProperty(exports, "ConfigLoader", { enumerable: true, get: function () { return configLoader_1.ConfigLoader; } });
|
|
7
8
|
Object.defineProperty(exports, "createConfigLoader", { enumerable: true, get: function () { return configLoader_1.createConfigLoader; } });
|
|
@@ -14,13 +15,13 @@ Object.defineProperty(exports, "loadConfigSync", { enumerable: true, get: functi
|
|
|
14
15
|
Object.defineProperty(exports, "loadPnP", { enumerable: true, get: function () { return configLoader_1.loadPnP; } });
|
|
15
16
|
Object.defineProperty(exports, "loadPnPSync", { enumerable: true, get: function () { return configLoader_1.loadPnPSync; } });
|
|
16
17
|
Object.defineProperty(exports, "readRawSettings", { enumerable: true, get: function () { return configLoader_1.readRawSettings; } });
|
|
17
|
-
Object.defineProperty(exports, "readSettingsFiles", { enumerable: true, get: function () { return configLoader_1.readSettingsFiles; } });
|
|
18
18
|
Object.defineProperty(exports, "searchForConfig", { enumerable: true, get: function () { return configLoader_1.searchForConfig; } });
|
|
19
19
|
Object.defineProperty(exports, "searchForConfigSync", { enumerable: true, get: function () { return configLoader_1.searchForConfigSync; } });
|
|
20
20
|
Object.defineProperty(exports, "sectionCSpell", { enumerable: true, get: function () { return configLoader_1.sectionCSpell; } });
|
|
21
|
-
Object.defineProperty(exports, "__testing__", { enumerable: true, get: function () { return configLoader_1.__testing__; } });
|
|
22
21
|
var extractImportErrors_1 = require("./extractImportErrors");
|
|
23
22
|
Object.defineProperty(exports, "extractImportErrors", { enumerable: true, get: function () { return extractImportErrors_1.extractImportErrors; } });
|
|
24
23
|
var readSettings_1 = require("./readSettings");
|
|
25
24
|
Object.defineProperty(exports, "readSettings", { enumerable: true, get: function () { return readSettings_1.readSettings; } });
|
|
25
|
+
var readSettingsFiles_1 = require("./readSettingsFiles");
|
|
26
|
+
Object.defineProperty(exports, "readSettingsFiles", { enumerable: true, get: function () { return readSettingsFiles_1.readSettingsFiles; } });
|
|
26
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSpellUserSettings, GlobDef, LanguageSetting } from '@cspell/cspell-types';
|
|
2
|
-
import { OptionalOrUndefined } from '../../../util/types';
|
|
1
|
+
import type { CSpellUserSettings, GlobDef, LanguageSetting } from '@cspell/cspell-types';
|
|
2
|
+
import type { OptionalOrUndefined } from '../../../util/types';
|
|
3
3
|
interface NormalizableFields {
|
|
4
4
|
version?: string | number;
|
|
5
5
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CSpellSettingsI } from './types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param filenames - settings files to read
|
|
5
|
+
* @returns combined configuration
|
|
6
|
+
* @deprecated true
|
|
7
|
+
*/
|
|
8
|
+
export declare function readSettingsFiles(filenames: string[]): CSpellSettingsI;
|
|
9
|
+
//# sourceMappingURL=readSettingsFiles.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readSettingsFiles = void 0;
|
|
4
|
+
const CSpellSettingsServer_1 = require("../../CSpellSettingsServer");
|
|
5
|
+
const defaultSettings_1 = require("./defaultSettings");
|
|
6
|
+
const readSettings_1 = require("./readSettings");
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param filenames - settings files to read
|
|
10
|
+
* @returns combined configuration
|
|
11
|
+
* @deprecated true
|
|
12
|
+
*/
|
|
13
|
+
function readSettingsFiles(filenames) {
|
|
14
|
+
return filenames.map((filename) => (0, readSettings_1.readSettings)(filename)).reduce((a, b) => (0, CSpellSettingsServer_1.mergeSettings)(a, b), defaultSettings_1.defaultSettings);
|
|
15
|
+
}
|
|
16
|
+
exports.readSettingsFiles = readSettingsFiles;
|
|
17
|
+
//# sourceMappingURL=readSettingsFiles.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Glob, GlobDef } from '@cspell/cspell-types';
|
|
1
|
+
import type { Glob, GlobDef } from '@cspell/cspell-types';
|
|
2
2
|
export declare function toGlobDef(g: undefined, root: string | undefined, source: string | undefined): undefined;
|
|
3
3
|
export declare function toGlobDef(g: Glob, root: string | undefined, source: string | undefined): GlobDef;
|
|
4
4
|
export declare function toGlobDef(g: Glob[], root: string | undefined, source: string | undefined): GlobDef[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CSpellSettingsWithSourceTrace } from '@cspell/cspell-types';
|
|
2
|
+
import type { CSpellSettingsInternal } from '../../../Models/CSpellSettingsInternalDef';
|
|
3
|
+
export type CSpellSettingsWST = CSpellSettingsWithSourceTrace;
|
|
4
|
+
export type CSpellSettingsI = CSpellSettingsInternal;
|
|
5
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -7,10 +7,10 @@ exports.clearPnPGlobalCache = exports.pnpLoader = exports.PnpLoader = void 0;
|
|
|
7
7
|
/**
|
|
8
8
|
* Handles loading of `.pnp.js` and `.pnp.js` files.
|
|
9
9
|
*/
|
|
10
|
-
const vscode_uri_1 = require("vscode-uri");
|
|
11
|
-
const import_fresh_1 = __importDefault(require("import-fresh"));
|
|
12
|
-
const find_up_1 = __importDefault(require("find-up"));
|
|
13
10
|
const clear_module_1 = __importDefault(require("clear-module"));
|
|
11
|
+
const find_up_1 = __importDefault(require("find-up"));
|
|
12
|
+
const import_fresh_1 = __importDefault(require("import-fresh"));
|
|
13
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
14
14
|
const ImportError_1 = require("./ImportError");
|
|
15
15
|
const defaultPnpFiles = ['.pnp.cjs', '.pnp.js'];
|
|
16
16
|
const supportedSchemas = new Set(['file']);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSpellSettingsInternal } from '../Models/CSpellSettingsInternalDef';
|
|
1
|
+
import type { CSpellSettingsInternal } from '../Models/CSpellSettingsInternalDef';
|
|
2
2
|
export declare const _defaultSettingsBasis: Readonly<CSpellSettingsInternal>;
|
|
3
3
|
export declare const _defaultSettings: Readonly<CSpellSettingsInternal>;
|
|
4
4
|
export declare function getDefaultSettings(useDefaultDictionaries?: boolean): CSpellSettingsInternal;
|
|
@@ -29,7 +29,7 @@ const CSpellSettingsInternalDef_1 = require("../Models/CSpellSettingsInternalDef
|
|
|
29
29
|
const PatternRegExp_1 = require("../Models/PatternRegExp");
|
|
30
30
|
const resolveFile_1 = require("../util/resolveFile");
|
|
31
31
|
const configLoader_1 = require("./Controller/configLoader");
|
|
32
|
-
const
|
|
32
|
+
const CSpellSettingsServer_1 = require("./CSpellSettingsServer");
|
|
33
33
|
const LanguageSettings = __importStar(require("./LanguageSettings"));
|
|
34
34
|
const RegPat = __importStar(require("./RegExpPatterns"));
|
|
35
35
|
const defaultConfigFileModuleRef = '@cspell/cspell-bundled-dicts/cspell-default.json';
|
|
@@ -154,7 +154,7 @@ const getSettings = (function () {
|
|
|
154
154
|
}
|
|
155
155
|
if (!settings) {
|
|
156
156
|
const jsonSettings = (0, configLoader_1.readSettings)(defaultConfigFile);
|
|
157
|
-
settings = (0,
|
|
157
|
+
settings = (0, CSpellSettingsServer_1.mergeSettings)(exports._defaultSettings, jsonSettings);
|
|
158
158
|
if (jsonSettings.name !== undefined) {
|
|
159
159
|
settings.name = jsonSettings.name;
|
|
160
160
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DictionaryDefinition } from '@cspell/cspell-types';
|
|
2
|
-
import { CSpellSettingsInternal, DictionaryDefinitionInternal, DictionaryDefinitionInternalWithSource } from '../Models/CSpellSettingsInternalDef';
|
|
3
|
-
import { DictionaryReferenceCollection } from './DictionaryReferenceCollection';
|
|
2
|
+
import type { CSpellSettingsInternal, DictionaryDefinitionInternal, DictionaryDefinitionInternalWithSource } from '../Models/CSpellSettingsInternalDef';
|
|
3
|
+
import type { DictionaryReferenceCollection } from './DictionaryReferenceCollection';
|
|
4
4
|
export type DefMapArrayItem = [string, DictionaryDefinitionInternal];
|
|
5
5
|
/**
|
|
6
6
|
* Combines the list of desired dictionaries with the list of dictionary
|