@w5s/cspell-config 3.0.5 → 3.1.1

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/index.d.ts CHANGED
@@ -1,5 +1,1809 @@
1
- import { AdvancedCSpellSettings } from '@cspell/cspell-types';
2
-
3
- declare const settings: AdvancedCSpellSettings;
4
-
5
- export { settings as default };
1
+ //#region src/meta.d.ts
2
+ declare const meta: Readonly<{
3
+ name: string;
4
+ version: string;
5
+ buildNumber: number;
6
+ }>;
7
+ //#endregion
8
+ //#region ../../node_modules/.pnpm/@cspell+cspell-types@9.7.0/node_modules/@cspell/cspell-types/dist/TextMap-Cs2Bypvi.d.mts
9
+ //#region src/Parser/types.d.ts
10
+ /**
11
+ * A SourceMap is used to map or transform the location of a piece of text back to its original offsets.
12
+ * This is necessary in order to report the correct location of a spelling issue.
13
+ * An empty source map indicates that it was a 1:1 transformation.
14
+ *
15
+ * Non-1:1 transformations are considered to be a single segment and cannot be split.
16
+ *
17
+ * A partial index into a non-linear segment will get mapped to the start of the segment.
18
+ *
19
+ * To signal a non-1:1 transformation a 0,0 pair can be used in the source map. This indicates that the
20
+ * following segment is a non-linear transformation and should not be split.
21
+ *
22
+ * This is important when multiple transformations have been applied to the same text, and the source map
23
+ * is being used to map back to the original text.
24
+ *
25
+ * For example: `\u00e9` might be transformed to `é` in one transformation and then to HTML entity `&#233;`.
26
+ * The resulting sourceMap would be `[..., 0, 0, 6, 6, ...]` to indicate that the 6 character segment should
27
+ * not be split when mapping back to the original text.
28
+ *
29
+ * The values in a source map are number pairs (even, odd) relative to the beginning of each
30
+ * string segment.
31
+ * - even - span length in the source text
32
+ * - odd - span length in the transformed text
33
+ *
34
+ * Offsets start at 0
35
+ *
36
+ * Example:
37
+ *
38
+ * - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
39
+ * - Transformed text: `Grand Café Bjørvika`
40
+ * - Map: [9, 9, 6, 1, 3, 3, 6, 1, 5, 5]
41
+ *
42
+ * | offset | span | original | offset | span | transformed |
43
+ * | ------ | ---- | ----------- | ------ | ---- | ----------- |
44
+ * | 0-9 | 9 | `Grand Caf` | 0-9 | 9 | `Grand Caf` |
45
+ * | 9-15 | 6 | `\u00e9` | 9-10 | 1 | `é` |
46
+ * | 15-18 | 3 | ` Bj` | 10-13 | 3 | ` Bj` |
47
+ * | 18-24 | 6 | `\u00f8` | 13-14 | 1 | `ø` |
48
+ * | 24-29 | 5 | `rvika` | 14-19 | 5 | `rvika` |
49
+ *
50
+ * Note: The trailing 5,5 is not necessary since it is a 1:1 mapping, but it is included for clarity.
51
+ *
52
+ * <!--- cspell:ignore Bjørvika rvika --->
53
+ */
54
+ type SourceMap = number[];
55
+ /**
56
+ * A range of text in a document.
57
+ * The range is inclusive of the start and exclusive of the end.
58
+ */
59
+ type Range = readonly [start: number, end: number]; //#endregion
60
+ //#region src/Parser/Mapped.d.ts
61
+ interface Mapped {
62
+ /**
63
+ * The absolute start and end offset of the text in the source.
64
+ */
65
+ range: Range;
66
+ /**
67
+ * `(i, j)` number pairs where
68
+ * - `i` is the offset in the source relative to the start of the range
69
+ * - `j` is the offset in the transformed destination
70
+ *
71
+ * Example:
72
+ * - source text = `"caf\xe9"`
73
+ * - mapped text = `"café"`
74
+ * - map = `[3, 3, 4, 1]`
75
+ *
76
+ * See: {@link SourceMap}
77
+ *
78
+ */
79
+ map?: SourceMap | undefined;
80
+ } //#endregion
81
+ //#region src/Parser/parser.d.ts
82
+ type ParserName = string;
83
+ interface Parser {
84
+ /** Name of parser */
85
+ readonly name: ParserName;
86
+ /**
87
+ * Parse Method
88
+ * @param content - full content of the file
89
+ * @param filename - filename
90
+ */
91
+ parse(content: string, filename: string): ParseResult;
92
+ }
93
+ interface ParseResult {
94
+ readonly content: string;
95
+ readonly filename: string;
96
+ readonly parsedTexts: Iterable<ParsedText>;
97
+ }
98
+ interface ParsedText extends Readonly<Mapped> {
99
+ /**
100
+ * The text extracted and possibly transformed
101
+ */
102
+ readonly text: string;
103
+ /**
104
+ * The raw text before it has been transformed
105
+ */
106
+ readonly rawText?: string | undefined;
107
+ /**
108
+ * The Scope annotation for a segment of text.
109
+ * Used by the spell checker to apply spell checking options
110
+ * based upon the value of the scope.
111
+ */
112
+ readonly scope?: Scope | undefined;
113
+ /**
114
+ * Used to delegate parsing the contents of `text` to another parser.
115
+ *
116
+ */
117
+ readonly delegate?: DelegateInfo | undefined;
118
+ }
119
+ /**
120
+ * DelegateInfo is used by a parser to delegate parsing a subsection of a document to
121
+ * another parser. The following information is used by the spell checker to match
122
+ * the parser.
123
+ */
124
+ interface DelegateInfo {
125
+ /**
126
+ * Proposed virtual file name including the extension.
127
+ * Format: `./${source_filename}/${block_number}.${ext}
128
+ * Example: `./README.md/1.js`
129
+ */
130
+ readonly filename: string;
131
+ /**
132
+ * The filename of the origin of the virtual file block.
133
+ * Example: `./README.md`
134
+ */
135
+ readonly originFilename: string;
136
+ /**
137
+ * Proposed file extension
138
+ * Example: `.js`
139
+ */
140
+ readonly extension: string;
141
+ /**
142
+ * Filetype to use
143
+ * Example: `javascript`
144
+ */
145
+ readonly fileType?: string;
146
+ }
147
+ /**
148
+ * Scope - chain of scope going from local to global
149
+ *
150
+ * Example:
151
+ * ```
152
+ * `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
153
+ * ```
154
+ */
155
+ interface ScopeChain {
156
+ readonly value: string;
157
+ readonly parent?: ScopeChain | undefined;
158
+ }
159
+ /**
160
+ * A string representing a scope chain separated by spaces
161
+ *
162
+ * Example: `comment.block.documentation.ts meta.interface.ts source.ts`
163
+ */
164
+ type ScopeString = string;
165
+ type Scope = ScopeChain | ScopeString; //#endregion
166
+ //#region src/Parser/TextMap.d.ts
167
+ //#endregion
168
+ //#region ../../node_modules/.pnpm/@cspell+cspell-types@9.7.0/node_modules/@cspell/cspell-types/dist/index.d.mts
169
+ //#region src/cspell-vfs.d.ts
170
+ /**
171
+ * Binary data for CSpellVFS file.
172
+ * This can be exported by a JavaScript based CSpell Configuration file.
173
+ * @hidden
174
+ */
175
+ type CSpellVFSBinaryData = Uint8Array<ArrayBuffer>;
176
+ /**
177
+ * Data content stored in a string for CSpellVFS file.
178
+ * It is often encoded (e.g. base64) binary data.
179
+ */
180
+ type CSpellVFSTextData = string;
181
+ /**
182
+ * The data content of a CSpellVFS file.
183
+ */
184
+ type CSpellVFSData = CSpellVFSBinaryData | CSpellVFSTextData;
185
+ /**
186
+ * An entry in the CSpell Virtual File System.
187
+ * It may or may not have a URL.
188
+ * @since 9.7.0
189
+ */
190
+ interface CSpellVFSFileEntry {
191
+ /**
192
+ * The optional file vfs url. It is already part of the CSpellVFS key.
193
+ */
194
+ url?: CSpellVFSFileUrl;
195
+ /**
196
+ * The content data of the file.
197
+ */
198
+ data: CSpellVFSData;
199
+ /**
200
+ * The encoding of the data. In most cases the encoding is determined from the data type and filename url.
201
+ */
202
+ encoding?: "base64" | "plaintext" | "utf8";
203
+ }
204
+ /**
205
+ * A URL string representing a CSpellVFS file.
206
+ * It should be of the form:
207
+ *
208
+ * ```txt
209
+ * cspell-vfs:///<module>/<path-to-file>/<file-name>
210
+ * ```
211
+ *
212
+ * Example: `cspell-vfs:///@cspell/dict-en_us/en_US.trie.gz`
213
+ *
214
+ * @since 9.7.0
215
+ */
216
+ type CSpellVFSFileUrl = string;
217
+ /**
218
+ * A declaration of files to add to the CSpell Virtual File System.
219
+ * @since 9.7.0
220
+ * @stability experimental
221
+ */
222
+ type CSpellVFS = Record<CSpellVFSFileUrl, CSpellVFSFileEntry>; //#endregion
223
+ //#region src/SuggestionsConfiguration.d.ts
224
+ interface SuggestionsConfiguration {
225
+ /**
226
+ * Number of suggestions to make.
227
+ *
228
+ * @default 10
229
+ */
230
+ numSuggestions?: number;
231
+ /**
232
+ * The maximum amount of time in milliseconds to generate suggestions for a word.
233
+ *
234
+ * @default 500
235
+ */
236
+ suggestionsTimeout?: number;
237
+ /**
238
+ * The maximum number of changes allowed on a word to be considered a suggestions.
239
+ *
240
+ * For example, appending an `s` onto `example` -> `examples` is considered 1 change.
241
+ *
242
+ * Range: between 1 and 5.
243
+ *
244
+ * @default 3
245
+ */
246
+ suggestionNumChanges?: number;
247
+ } //#endregion
248
+ //#region src/TextOffset.d.ts
249
+ interface ReporterConfigurationBase {
250
+ /**
251
+ * The maximum number of problems to report in a file.
252
+ *
253
+ * @default 10000
254
+ */
255
+ maxNumberOfProblems?: number;
256
+ /**
257
+ * The maximum number of times the same word can be flagged as an error in a file.
258
+ *
259
+ * @default 5
260
+ */
261
+ maxDuplicateProblems?: number;
262
+ /**
263
+ * The minimum length of a word before checking it against a dictionary.
264
+ *
265
+ * @default 4
266
+ */
267
+ minWordLength?: number;
268
+ /**
269
+ * Ignore sequences of characters that look like random strings.
270
+ *
271
+ * @default true
272
+ */
273
+ ignoreRandomStrings?: boolean | undefined;
274
+ /**
275
+ * The minimum length of a random string to be ignored.
276
+ *
277
+ * @default 40
278
+ */
279
+ minRandomLength?: number | undefined;
280
+ }
281
+ interface ReportingConfiguration extends ReporterConfigurationBase, SuggestionsConfiguration, UnknownWordsConfiguration {}
282
+ /**
283
+ * Possible choices for how to handle unknown words.
284
+ */
285
+ type UnknownWordsChoices = "report-all" | "report-simple" | "report-common-typos" | "report-flagged";
286
+ interface UnknownWordsConfiguration {
287
+ /**
288
+ * Controls how unknown words are handled.
289
+ *
290
+ * - `report-all` - Report all unknown words (default behavior)
291
+ * - `report-simple` - Report unknown words that have simple spelling errors, typos, and flagged words.
292
+ * - `report-common-typos` - Report unknown words that are common typos and flagged words.
293
+ * - `report-flagged` - Report unknown words that are flagged.
294
+ *
295
+ * @default "report-all"
296
+ * @since 9.1.0
297
+ */
298
+ unknownWords?: UnknownWordsChoices | undefined;
299
+ } //#endregion
300
+ //#region src/suggestionCostsDef.d.ts
301
+ /**
302
+ * A WeightedMapDef enables setting weights for edits between related characters and substrings.
303
+ *
304
+ * Multiple groups can be defined using a `|`.
305
+ * A multi-character substring is defined using `()`.
306
+ *
307
+ * For example, in some languages, some letters sound alike.
308
+ *
309
+ * ```yaml
310
+ * map: 'sc(sh)(sch)(ss)|t(tt)' # two groups.
311
+ * replace: 50 # Make it 1/2 the cost of a normal edit to replace a `t` with `tt`.
312
+ * ```
313
+ *
314
+ * The following could be used to make inserting, removing, or replacing vowels cheaper.
315
+ * ```yaml
316
+ * map: 'aeiouy'
317
+ * insDel: 50 # Make it is cheaper to insert or delete a vowel.
318
+ * replace: 45 # It is even cheaper to replace one with another.
319
+ * ```
320
+ *
321
+ * Note: the default edit distance is 100.
322
+ */
323
+ type SuggestionCostMapDef = CostMapDefReplace | CostMapDefInsDel | CostMapDefSwap;
324
+ type SuggestionCostsDefs = SuggestionCostMapDef[];
325
+ interface CostMapDefBase {
326
+ /**
327
+ * The set of substrings to map, these are generally single character strings.
328
+ *
329
+ * Multiple sets can be defined by using a `|` to separate them.
330
+ *
331
+ * Example: `"eéê|aåá"` contains two different sets.
332
+ *
333
+ * To add a multi-character substring use `()`.
334
+ *
335
+ * Example: `"f(ph)(gh)"` results in the following set: `f`, `ph`, `gh`.
336
+ *
337
+ * - To match the beginning of a word, use `^`: `"(^I)""`.
338
+ * - To match the end of a word, use `$`: `"(e$)(ing$)"`.
339
+ *
340
+ */
341
+ map: string;
342
+ /** The cost to insert/delete one of the substrings in the map. Note: insert/delete costs are symmetrical. */
343
+ insDel?: number;
344
+ /**
345
+ * The cost to replace of of the substrings in the map with another substring in the map.
346
+ * Example: Map['a', 'i']
347
+ * This would be the cost to substitute `a` with `i`: Like `bat` to `bit` or the reverse.
348
+ */
349
+ replace?: number;
350
+ /**
351
+ * The cost to swap two adjacent substrings found in the map.
352
+ * Example: Map['e', 'i']
353
+ * This represents the cost to change `ei` to `ie` or the reverse.
354
+ */
355
+ swap?: number;
356
+ /**
357
+ * A description to describe the purpose of the map.
358
+ */
359
+ description?: string;
360
+ /**
361
+ * Add a penalty to the final cost.
362
+ * This is used to discourage certain suggestions.
363
+ *
364
+ * Example:
365
+ * ```yaml
366
+ * # Match adding/removing `-` to the end of a word.
367
+ * map: "$(-$)"
368
+ * replace: 50
369
+ * penalty: 100
370
+ * ```
371
+ *
372
+ * This makes adding a `-` to the end of a word more expensive.
373
+ *
374
+ * Think of it as taking the toll way for speed but getting the bill later.
375
+ */
376
+ penalty?: number;
377
+ }
378
+ interface CostMapDefReplace extends CostMapDefBase {
379
+ replace: number;
380
+ }
381
+ interface CostMapDefInsDel extends CostMapDefBase {
382
+ insDel: number;
383
+ }
384
+ interface CostMapDefSwap extends CostMapDefBase {
385
+ swap: number;
386
+ } //#endregion
387
+ //#region src/DictionaryInformation.d.ts
388
+ /**
389
+ * Use by dictionary authors to help improve the quality of suggestions
390
+ * given from the dictionary.
391
+ *
392
+ * Added with `v5.16.0`.
393
+ */
394
+ interface DictionaryInformation {
395
+ /**
396
+ * The locale of the dictionary.
397
+ * Example: `nl,nl-be`
398
+ */
399
+ locale?: string;
400
+ /**
401
+ * The alphabet to use.
402
+ * @default "a-zA-Z"
403
+ */
404
+ alphabet?: CharacterSet | CharacterSetCosts[];
405
+ /**
406
+ * The accent characters.
407
+ *
408
+ * Default: `"\u0300-\u0341"`
409
+ */
410
+ accents?: CharacterSet | CharacterSetCosts[];
411
+ /**
412
+ * Define edit costs.
413
+ */
414
+ costs?: EditCosts;
415
+ /**
416
+ * Used in making suggestions. The lower the value, the more likely the suggestion
417
+ * will be near the top of the suggestion list.
418
+ */
419
+ suggestionEditCosts?: SuggestionCostsDefs | undefined;
420
+ /**
421
+ * Used by dictionary authors
422
+ */
423
+ hunspellInformation?: HunspellInformation;
424
+ /**
425
+ * A collection of patterns to test against the suggested words.
426
+ * If the word matches the pattern, then the penalty is applied.
427
+ */
428
+ adjustments?: PatternAdjustment[];
429
+ /**
430
+ * An optional set of characters that can possibly be removed from a word before
431
+ * checking it.
432
+ *
433
+ * This is useful in languages like Arabic where Harakat accents are optional.
434
+ *
435
+ * Note: All matching characters are removed or none. Partial removal is not supported.
436
+ */
437
+ ignore?: CharacterSet;
438
+ }
439
+ interface HunspellInformation {
440
+ /**
441
+ * Selected Hunspell AFF content.
442
+ * The content must be UTF-8
443
+ *
444
+ * Sections:
445
+ * - TRY
446
+ * - MAP
447
+ * - REP
448
+ * - KEY
449
+ * - ICONV
450
+ * - OCONV
451
+ *
452
+ * Example:
453
+ * ```hunspell
454
+ * # Comment
455
+ * TRY aeistlunkodmrvpgjhäõbüoöfcwzxðqþ`
456
+ * MAP aàâäAÀÂÄ
457
+ * MAP eéèêëEÉÈÊË
458
+ * MAP iîïyIÎÏY
459
+ * MAP oôöOÔÖ
460
+ * MAP (IJ)(IJ)
461
+ * ```
462
+ */
463
+ aff: HunspellAffContent;
464
+ /** The costs to apply when using the hunspell settings */
465
+ costs?: HunspellCosts;
466
+ }
467
+ /**
468
+ * Selected Hunspell AFF content.
469
+ * The content must be UTF-8
470
+ *
471
+ * Sections:
472
+ * - TRY
473
+ * - NO-TRY
474
+ * - MAP
475
+ * - REP
476
+ * - KEY
477
+ * - ICONV
478
+ * - OCONV
479
+ *
480
+ * Example:
481
+ * ```hunspell
482
+ * # Comment
483
+ * TRY aeistlunkodmrvpgjhäõbüoöfcwzxðqþ`
484
+ * NO-TRY -0123456789 # Discourage adding numbers and dashes.
485
+ * MAP aàâäAÀÂÄ
486
+ * MAP eéèêëEÉÈÊË
487
+ * MAP iîïyIÎÏY
488
+ * MAP oôöOÔÖ
489
+ * MAP (IJ)(IJ)
490
+ * ```
491
+ */
492
+ type HunspellAffContent = string;
493
+ interface HunspellCosts extends EditCosts {
494
+ /**
495
+ * The cost of inserting / deleting / or swapping any `tryChars`
496
+ * Defaults to `baseCosts`
497
+ */
498
+ tryCharCost?: number;
499
+ /**
500
+ * The cost of replacing or swapping any adjacent keyboard characters.
501
+ *
502
+ * This should be slightly cheaper than `tryCharCost`.
503
+ * @default 99
504
+ */
505
+ keyboardCost?: number;
506
+ /**
507
+ * mapSet replacement cost is the cost to substitute one character with another from
508
+ * the same set.
509
+ *
510
+ * Map characters are considered very similar to each other and are often
511
+ * the cause of simple mistakes.
512
+ *
513
+ * @default 25
514
+ */
515
+ mapCost?: number;
516
+ /**
517
+ * The cost to convert between convert pairs.
518
+ *
519
+ * The value should be slightly higher than the mapCost.
520
+ *
521
+ * @default 30
522
+ */
523
+ ioConvertCost?: number;
524
+ /**
525
+ * The cost to substitute pairs found in the replace settings.
526
+ *
527
+ * @default 75
528
+ */
529
+ replaceCosts?: number;
530
+ }
531
+ /**
532
+ *
533
+ */
534
+ interface EditCosts {
535
+ /**
536
+ * This is the base cost for making an edit.
537
+ * @default 100
538
+ */
539
+ baseCost?: number;
540
+ /**
541
+ * This is the cost for characters not in the alphabet.
542
+ * @default 110
543
+ */
544
+ nonAlphabetCosts?: number;
545
+ /**
546
+ * The extra cost incurred for changing the first letter of a word.
547
+ * This value should be less than `100 - baseCost`.
548
+ * @default 4
549
+ */
550
+ firstLetterPenalty?: number;
551
+ /**
552
+ * The cost to change capitalization.
553
+ * This should be very cheap, it helps with fixing capitalization issues.
554
+ * @default 1
555
+ */
556
+ capsCosts?: number;
557
+ /**
558
+ * The cost to add / remove an accent
559
+ * This should be very cheap, it helps with fixing accent issues.
560
+ * @default 1
561
+ */
562
+ accentCosts?: number;
563
+ }
564
+ /**
565
+ * This is a set of characters that can include `-` or `|`
566
+ * - `-` - indicates a range of characters: `a-c` => `abc`
567
+ * - `|` - is a group separator, indicating that the characters on either side
568
+ * are not related.
569
+ */
570
+ type CharacterSet = string;
571
+ interface CharacterSetCosts {
572
+ /**
573
+ * This is a set of characters that can include `-` or `|`
574
+ * - `-` - indicates a range of characters: `a-c` => `abc`
575
+ * - `|` - is a group separator, indicating that the characters on either side
576
+ * are not related.
577
+ */
578
+ characters: CharacterSet;
579
+ /** the cost to insert / delete / replace / swap the characters in a group */
580
+ cost: number;
581
+ /**
582
+ * The penalty cost to apply if the accent is used.
583
+ * This is used to discourage
584
+ */
585
+ penalty?: number;
586
+ }
587
+ /**
588
+ * @hidden
589
+ */
590
+ type IRegExp = RegExp;
591
+ interface PatternAdjustment {
592
+ /** Id of the Adjustment, i.e. `short-compound` */
593
+ id: string;
594
+ /** RegExp pattern to match */
595
+ regexp: string | IRegExp;
596
+ /** The amount of penalty to apply. */
597
+ penalty: number;
598
+ } //#endregion
599
+ //#region src/InlineDictionary.d.ts
600
+ interface InlineDictionary {
601
+ /**
602
+ * List of words to be considered correct.
603
+ */
604
+ words?: string[];
605
+ /**
606
+ * List of words to always be considered incorrect. Words found in `flagWords` override `words`.
607
+ *
608
+ * Format of `flagWords`
609
+ * - single word entry - `word`
610
+ * - with suggestions - `word:suggestion` or `word->suggestion, suggestions`
611
+ *
612
+ * Example:
613
+ * ```ts
614
+ * "flagWords": [
615
+ * "color: colour",
616
+ * "incase: in case, encase",
617
+ * "canot->cannot",
618
+ * "cancelled->canceled"
619
+ * ]
620
+ * ```
621
+ */
622
+ flagWords?: string[];
623
+ /**
624
+ * List of words to be ignored. An ignored word will not show up as an error, even if it is
625
+ * also in the `flagWords`.
626
+ */
627
+ ignoreWords?: string[];
628
+ /**
629
+ * A list of suggested replacements for words.
630
+ * Suggested words provide a way to make preferred suggestions on word replacements.
631
+ * To hint at a preferred change, but not to require it.
632
+ *
633
+ * Format of `suggestWords`
634
+ * - Single suggestion (possible auto fix)
635
+ * - `word: suggestion`
636
+ * - `word->suggestion`
637
+ * - Multiple suggestions (not auto fixable)
638
+ * - `word: first, second, third`
639
+ * - `word->first, second, third`
640
+ */
641
+ suggestWords?: string[];
642
+ } //#endregion
643
+ //#region src/DictionaryDefinition.d.ts
644
+ type DictionaryDefinition = DictionaryDefinitionPreferred | DictionaryDefinitionCustom | DictionaryDefinitionAugmented | DictionaryDefinitionInline | DictionaryDefinitionSimple | DictionaryDefinitionAlternate | DictionaryDefinitionLegacy;
645
+ type DictionaryFileTypes = "S" | "W" | "C" | "T";
646
+ interface DictionaryDefinitionBase {
647
+ /**
648
+ * This is the name of a dictionary.
649
+ *
650
+ * Name Format:
651
+ * - Must contain at least 1 number or letter.
652
+ * - Spaces are allowed.
653
+ * - Leading and trailing space will be removed.
654
+ * - Names ARE case-sensitive.
655
+ * - Must not contain `*`, `!`, `;`, `,`, `{`, `}`, `[`, `]`, `~`.
656
+ */
657
+ name: DictionaryId;
658
+ /**
659
+ * Optional description of the contents / purpose of the dictionary.
660
+ */
661
+ description?: string | undefined;
662
+ /** Replacement pairs. */
663
+ repMap?: ReplaceMap | undefined;
664
+ /** Use Compounds. */
665
+ useCompounds?: boolean | undefined;
666
+ /**
667
+ * Indicate that suggestions should not come from this dictionary.
668
+ * Words in this dictionary are considered correct, but will not be
669
+ * used when making spell correction suggestions.
670
+ *
671
+ * Note: if a word is suggested by another dictionary, but found in
672
+ * this dictionary, it will be removed from the set of
673
+ * possible suggestions.
674
+ */
675
+ noSuggest?: boolean | undefined;
676
+ /**
677
+ * Some dictionaries may contain forbidden words to prevent compounding from generating
678
+ * words that are not valid in the language. These are often
679
+ * words that are used in other languages or might be generated through compounding.
680
+ * This setting allows flagged words to be ignored when checking the dictionary.
681
+ * The effect is similar to the word not being in the dictionary.
682
+ */
683
+ ignoreForbiddenWords?: boolean | undefined;
684
+ /**
685
+ * Type of file:
686
+ * - S - single word per line,
687
+ * - W - each line can contain one or more words separated by space,
688
+ * - C - each line is treated like code (Camel Case is allowed).
689
+ *
690
+ * Default is S.
691
+ *
692
+ * C is the slowest to load due to the need to split each line based upon code splitting rules.
693
+ *
694
+ * Note: this settings does not apply to inline dictionaries or `.trie` files.
695
+ *
696
+ * @default "S"
697
+ */
698
+ type?: DictionaryFileTypes | undefined;
699
+ /**
700
+ * Strip case and accents to allow for case insensitive searches and
701
+ * words without accents.
702
+ *
703
+ * Note: this setting only applies to word lists. It has no-impact on trie
704
+ * dictionaries.
705
+ *
706
+ * @default true
707
+ */
708
+ supportNonStrictSearches?: boolean | undefined;
709
+ }
710
+ interface DictionaryDefinitionPreferred extends DictionaryDefinitionBase {
711
+ /**
712
+ * Path or url to the dictionary file.
713
+ */
714
+ path: DictionaryPath;
715
+ /**
716
+ * An alternative path to a bTrie dictionary file.
717
+ * It will be used in place of `path` if the version of CSpell being used
718
+ * supports btrie files.
719
+ * @since 9.6.0
720
+ */
721
+ btrie?: DictionaryPathToBTrie | undefined;
722
+ /**
723
+ * Only for legacy dictionary definitions.
724
+ * @deprecated true
725
+ * @deprecationMessage Use {@link path} instead.
726
+ * @hidden
727
+ */
728
+ file?: undefined;
729
+ }
730
+ interface HiddenPaths {
731
+ /**
732
+ * @hide
733
+ */
734
+ path?: string | undefined;
735
+ /**
736
+ * @hide
737
+ */
738
+ btrie?: string | undefined;
739
+ /**
740
+ * @hide
741
+ */
742
+ file?: undefined;
743
+ }
744
+ interface DictionaryDefinitionBaseWithPathsHidden extends DictionaryDefinitionBase, HiddenPaths {}
745
+ /**
746
+ * An Empty Dictionary Definition
747
+ */
748
+ interface DictionaryDefinitionSimple extends DictionaryDefinitionBaseWithPathsHidden {
749
+ /**
750
+ * @hide
751
+ */
752
+ repMap?: ReplaceMap | undefined;
753
+ /**
754
+ * @hide
755
+ */
756
+ useCompounds?: boolean | undefined;
757
+ /**
758
+ * @hide
759
+ */
760
+ noSuggest?: boolean | undefined;
761
+ /**
762
+ * @hide
763
+ */
764
+ ignoreForbiddenWords?: boolean | undefined;
765
+ /**
766
+ * @hide
767
+ */
768
+ type?: DictionaryFileTypes | undefined;
769
+ }
770
+ /**
771
+ * Used to provide extra data related to the dictionary
772
+ */
773
+ interface DictionaryDefinitionAugmented extends DictionaryDefinitionPreferred {
774
+ dictionaryInformation?: DictionaryInformation;
775
+ }
776
+ interface HiddenFields {
777
+ /**
778
+ * Not used
779
+ * @hide
780
+ */
781
+ path?: undefined;
782
+ /**
783
+ * Not used
784
+ * @hide
785
+ */
786
+ btrie?: string | undefined;
787
+ /**
788
+ * Not used
789
+ * @hide
790
+ */
791
+ file?: undefined;
792
+ /**
793
+ * Not used
794
+ * @hide
795
+ */
796
+ type?: undefined;
797
+ /**
798
+ * Use `ignoreWords` instead.
799
+ * @hide
800
+ */
801
+ noSuggest?: undefined;
802
+ /**
803
+ * Not used
804
+ * @hide
805
+ */
806
+ ignoreForbiddenWords?: undefined;
807
+ /**
808
+ * Not used
809
+ * @hide
810
+ */
811
+ useCompounds?: undefined;
812
+ /**
813
+ * @hide
814
+ */
815
+ repMap?: undefined;
816
+ }
817
+ /**
818
+ * Inline Dictionary Definition
819
+ *
820
+ * All words are defined inline.
821
+ */
822
+ type DictionaryDefinitionInlineBase = Omit<DictionaryDefinitionBase, keyof HiddenFields> & HiddenFields & InlineDictionary;
823
+ interface DictionaryDefinitionInlineWords extends DictionaryDefinitionInlineBase, Required<Pick<InlineDictionary, "words">> {
824
+ words: string[];
825
+ }
826
+ interface DictionaryDefinitionInlineFlagWords extends DictionaryDefinitionInlineBase, Required<Pick<InlineDictionary, "flagWords">> {
827
+ flagWords: string[];
828
+ }
829
+ interface DictionaryDefinitionInlineIgnoreWords extends DictionaryDefinitionInlineBase, Required<Pick<InlineDictionary, "ignoreWords">> {
830
+ ignoreWords: string[];
831
+ }
832
+ interface DictionaryDefinitionInlineSuggestWords extends DictionaryDefinitionInlineBase, Required<Pick<InlineDictionary, "suggestWords">> {
833
+ suggestWords: string[];
834
+ }
835
+ /**
836
+ * Inline Dictionary Definitions
837
+ * @since 6.23.0
838
+ */
839
+ type DictionaryDefinitionInline = DictionaryDefinitionInlineWords | DictionaryDefinitionInlineIgnoreWords | DictionaryDefinitionInlineFlagWords | DictionaryDefinitionInlineSuggestWords;
840
+ /**
841
+ * Only for legacy dictionary definitions.
842
+ * @deprecated true
843
+ * @deprecationMessage Use {@link DictionaryDefinitionPreferred} instead.
844
+ * This will be removed in a future release.
845
+ */
846
+ interface DictionaryDefinitionAlternate extends DictionaryDefinitionBase, Omit<HiddenPaths, "file"> {
847
+ /**
848
+ * Path to the file, only for legacy dictionary definitions.
849
+ * @deprecated true
850
+ * @deprecationMessage Use `path` instead.
851
+ */
852
+ file: DictionaryPath;
853
+ /**
854
+ * @hidden
855
+ */
856
+ suggestionEditCosts?: undefined;
857
+ }
858
+ /**
859
+ * @deprecated true
860
+ * @deprecationMessage Use {@link DictionaryDefinitionPreferred} instead.
861
+ * This will be removed in a future release.
862
+ * @hidden
863
+ */
864
+ interface DictionaryDefinitionLegacy extends DictionaryDefinitionBase, Omit<HiddenPaths, "file" | "path"> {
865
+ /** Path to the file, if undefined the path to the extension dictionaries is assumed. */
866
+ path?: FsDictionaryPath;
867
+ /**
868
+ * File name.
869
+ * @deprecated true
870
+ * @deprecationMessage Use {@link path} instead.
871
+ */
872
+ file: FsDictionaryPath;
873
+ /**
874
+ * Type of file:
875
+ * - S - single word per line,
876
+ * - W - each line can contain one or more words separated by space,
877
+ * - C - each line is treated like code (Camel Case is allowed).
878
+ *
879
+ * Default is S.
880
+ *
881
+ * C is the slowest to load due to the need to split each line based upon code splitting rules.
882
+ * @default "S"
883
+ */
884
+ type?: DictionaryFileTypes;
885
+ /**
886
+ * @hidden
887
+ */
888
+ suggestionEditCosts?: undefined;
889
+ }
890
+ /**
891
+ * Specifies the scope of a dictionary.
892
+ */
893
+ type CustomDictionaryScope = "user" | "workspace" | "folder";
894
+ /**
895
+ * For Defining Custom dictionaries. They are generally scoped to a
896
+ * `user`, `workspace`, or `folder`.
897
+ * When `addWords` is true, indicates that the spell checker can add words
898
+ * to the file.
899
+ *
900
+ * Note: only plain text files with one word per line are supported at this moment.
901
+ */
902
+ interface DictionaryDefinitionCustom extends DictionaryDefinitionPreferred {
903
+ /**
904
+ * A file path or url to a custom dictionary file.
905
+ */
906
+ path: CustomDictionaryPath;
907
+ /**
908
+ * Defines the scope for when words will be added to the dictionary.
909
+ *
910
+ * Scope values: `user`, `workspace`, `folder`.
911
+ */
912
+ scope?: CustomDictionaryScope | CustomDictionaryScope[];
913
+ /**
914
+ * When `true`, let's the spell checker know that words can be added to this dictionary.
915
+ */
916
+ addWords: boolean;
917
+ }
918
+ /**
919
+ * This is the name of a dictionary.
920
+ *
921
+ * Name Format:
922
+ * - Must contain at least 1 number or letter.
923
+ * - Spaces are allowed.
924
+ * - Leading and trailing space will be removed.
925
+ * - Names ARE case-sensitive.
926
+ * - Must not contain `*`, `!`, `;`, `,`, `{`, `}`, `[`, `]`, `~`.
927
+ *
928
+ * @pattern ^(?=[^!*,;{}[\]~\n]+$)(?=(.*\w)).+$
929
+ */
930
+ type DictionaryId = string;
931
+ type ReplaceEntry = [string, string];
932
+ type ReplaceMap = ReplaceEntry[];
933
+ /**
934
+ * A File System Path. Relative paths are relative to the configuration file.
935
+ */
936
+ type FsDictionaryPath = string;
937
+ /**
938
+ * A File System Path to a dictionary file.
939
+ * Pattern: `^.*\.(?:txt|trie|btrie|dic)(?:\.gz)?$`
940
+ */
941
+ type DictionaryPath = string;
942
+ /**
943
+ * A File System Path to a dictionary file.
944
+ * Pattern: `^.*\.(?:btrie)(?:\.gz)?$`
945
+ * @since 9.6.0
946
+ */
947
+ type DictionaryPathToBTrie = string;
948
+ /**
949
+ * A path or url to a custom dictionary file.
950
+ */
951
+ type CustomDictionaryPath = string;
952
+ /**
953
+ * Reference to a dictionary by name.
954
+ * One of:
955
+ * - {@link DictionaryRef}
956
+ * - {@link DictionaryNegRef}
957
+ */
958
+ type DictionaryReference = DictionaryRef | DictionaryNegRef;
959
+ /**
960
+ * This a reference to a named dictionary.
961
+ * It is expected to match the name of a dictionary.
962
+ */
963
+ type DictionaryRef = DictionaryId;
964
+ /**
965
+ * This a negative reference to a named dictionary.
966
+ *
967
+ * It is used to exclude or include a dictionary by name.
968
+ *
969
+ * The reference starts with 1 or more `!`.
970
+ * - `!<dictionary_name>` - Used to exclude the dictionary matching `<dictionary_name>`.
971
+ * - `!!<dictionary_name>` - Used to re-include a dictionary matching `<dictionary_name>`.
972
+ * Overrides `!<dictionary_name>`.
973
+ * - `!!!<dictionary_name>` - Used to exclude a dictionary matching `<dictionary_name>`.
974
+ * Overrides `!!<dictionary_name>`.
975
+ *
976
+ * @pattern ^(?=!+[^!*,;{}[\]~\n]+$)(?=(.*\w)).+$
977
+ */
978
+ type DictionaryNegRef = string; //#endregion
979
+ //#region src/features.d.ts
980
+ /**
981
+ * These are experimental features and are subject to change or removal without notice.
982
+ */
983
+ interface FeaturesExperimental {
984
+ /**
985
+ * Enable/disable using weighted suggestions.
986
+ */
987
+ "weighted-suggestions": FeatureEnableOnly;
988
+ }
989
+ /**
990
+ * These are the current set of active features
991
+ */
992
+ interface FeaturesActive {
993
+ /**
994
+ * @hidden
995
+ */
996
+ featureName?: boolean;
997
+ }
998
+ /**
999
+ * These are feature settings that have been deprecated or moved elsewhere they will have no
1000
+ * effect on the code but are here to prevent schema errors. The will get cleaned out on major versions.
1001
+ */
1002
+ interface FeaturesDeprecated {
1003
+ /**
1004
+ * @hidden
1005
+ */
1006
+ featureName?: boolean;
1007
+ }
1008
+ /**
1009
+ * Features are behaviors or settings that can be explicitly configured.
1010
+ */
1011
+ interface Features extends Partial<FeaturesActive>, Partial<FeaturesDeprecated>, Partial<FeaturesExperimental> {}
1012
+ type FeatureEnableOnly = boolean;
1013
+ /**
1014
+ * Feature Configuration.
1015
+ */
1016
+ //#endregion
1017
+ //#region src/Substitutions.d.ts
1018
+ /**
1019
+ * The ID for a substitution definition. This is used to reference the substitution definition in the substitutions array.
1020
+ * @since 9.7.0
1021
+ */
1022
+ type SubstitutionID = string;
1023
+ /**
1024
+ * A substitution entry is a tuple of the form `[find, replacement]`. The find string is the string to find,
1025
+ * and the replacement string is the string to replace it with.
1026
+ *
1027
+ * - `find` - The string to find. This is the string that will be replaced in the text. Only an exact match will be replaced.
1028
+ * The find string is not treated as a regular expression.
1029
+ * - `replacement` - The string to replace the `find` string with. This is the string that will be used to replace the `find`
1030
+ * string in the text.
1031
+ *
1032
+ * @since 9.7.0
1033
+ */
1034
+ type SubstitutionEntry = [find: string, replacement: string];
1035
+ /**
1036
+ * Allows for the definition of a substitution set. A substitution set is a collection of substitution
1037
+ * entries that can be applied to a document before spell checking. This is useful for converting html entities, url encodings,
1038
+ * or other transformations that may be necessary to get the correct text for spell checking.
1039
+ *
1040
+ * Substitutions are applied based upon the longest matching find string. If there are multiple matches of the same `find`,
1041
+ * the last one in the list is used. This allows for the overriding of substitutions. For example, if you have a substitution
1042
+ * for `&` to `and`, and then a substitution for `&amp;` to `&`, the `&amp;` substitution will be used for the string `&amp;`,
1043
+ * and the `&` substitution will be used for the string `&`.
1044
+ *
1045
+ * @since 9.7.0
1046
+ */
1047
+ interface SubstitutionDefinition {
1048
+ /**
1049
+ * The name of the substitution definition. This is used to reference the substitution definition in the substitutions array.
1050
+ */
1051
+ name: SubstitutionID;
1052
+ /**
1053
+ * An optional description of the substitution definition. This is not used for anything, but can be useful for
1054
+ * documentation purposes.
1055
+ */
1056
+ description?: string;
1057
+ /**
1058
+ * The entries for the substitution definition. This is a collection of substitution entries that can be applied to a
1059
+ * document before spell checking.
1060
+ */
1061
+ entries: SubstitutionEntry[];
1062
+ }
1063
+ /**
1064
+ * The set of available substitutions. This is a collection of substitution definitions that can be applied to a document
1065
+ * before spell checking.
1066
+ */
1067
+ type SubstitutionDefinitions = SubstitutionDefinition[];
1068
+ /**
1069
+ * The set of substitutions to apply to a document before spell checking.
1070
+ * This is a collection of substitution entries that can be applied to a document before spell checking.
1071
+ */
1072
+ type Substitutions = (SubstitutionEntry | SubstitutionID)[]; //#endregion
1073
+ //#region src/types.d.ts
1074
+ type Serializable = number | string | boolean | null | object; //#endregion
1075
+ //#region src/CSpellSettingsDef.d.ts
1076
+ /**
1077
+ * These settings come from user and workspace settings.
1078
+ */
1079
+ interface CSpellSettings extends FileSettings, LegacySettings {}
1080
+ interface FileSettings extends ExtendableSettings, CommandLineSettings {
1081
+ /**
1082
+ * Url to JSON Schema
1083
+ * @default "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json"
1084
+ */
1085
+ $schema?: string;
1086
+ /**
1087
+ * Configuration format version of the settings file.
1088
+ *
1089
+ * This controls how the settings in the configuration file behave.
1090
+ *
1091
+ * @default "0.2"
1092
+ */
1093
+ version?: Version;
1094
+ /** Words to add to global dictionary -- should only be in the user config file. */
1095
+ userWords?: string[];
1096
+ /**
1097
+ * Allows this configuration to inherit configuration for one or more other files.
1098
+ *
1099
+ * See [Importing / Extending Configuration](https://cspell.org/configuration/imports/) for more details.
1100
+ */
1101
+ import?: FsPath | FsPath[];
1102
+ /**
1103
+ * The root to use for glob patterns found in this configuration.
1104
+ * Default: location of the configuration file.
1105
+ * For compatibility reasons, config files with version 0.1, the glob root will
1106
+ * default to be `${cwd}`.
1107
+ *
1108
+ * Use `globRoot` to define a different location.
1109
+ * `globRoot` can be relative to the location of this configuration file.
1110
+ * Defining globRoot, does not impact imported configurations.
1111
+ *
1112
+ * Special Values:
1113
+ * - `${cwd}` - will be replaced with the current working directory.
1114
+ * - `.` - will be the location of the containing configuration file.
1115
+ *
1116
+ */
1117
+ globRoot?: FSPathResolvable;
1118
+ /**
1119
+ * Glob patterns of files to be checked.
1120
+ *
1121
+ * Glob patterns are relative to the `globRoot` of the configuration file that defines them.
1122
+ */
1123
+ files?: Glob[];
1124
+ /**
1125
+ * Enable scanning files and directories beginning with `.` (period).
1126
+ *
1127
+ * By default, CSpell does not scan `hidden` files.
1128
+ *
1129
+ * @default false
1130
+ */
1131
+ enableGlobDot?: boolean;
1132
+ /**
1133
+ * Glob patterns of files to be ignored.
1134
+ *
1135
+ * Glob patterns are relative to the {@link globRoot} of the configuration file that defines them.
1136
+ */
1137
+ ignorePaths?: Glob[];
1138
+ /**
1139
+ * Prevents searching for local configuration when checking individual documents.
1140
+ *
1141
+ * @default false
1142
+ */
1143
+ noConfigSearch?: boolean;
1144
+ /**
1145
+ * Indicate that the configuration file should not be modified.
1146
+ * This is used to prevent tools like the VS Code Spell Checker from
1147
+ * modifying the file to add words and other configuration.
1148
+ *
1149
+ * @default false
1150
+ */
1151
+ readonly?: boolean;
1152
+ /**
1153
+ * Define which reports to use.
1154
+ * `default` - is a special name for the default cli reporter.
1155
+ *
1156
+ * Examples:
1157
+ * - `["default"]` - to use the default reporter
1158
+ * - `["@cspell/cspell-json-reporter"]` - use the cspell JSON reporter.
1159
+ * - `[["@cspell/cspell-json-reporter", { "outFile": "out.json" }]]`
1160
+ * - `[ "default", ["@cspell/cspell-json-reporter", { "outFile": "out.json" }]]` - Use both the default reporter and the cspell-json-reporter.
1161
+ *
1162
+ * @default ["default"]
1163
+ */
1164
+ reporters?: ReporterSettings[];
1165
+ /**
1166
+ * Tells the spell checker to load `.gitignore` files and skip files that match the globs in the `.gitignore` files found.
1167
+ * @default false
1168
+ */
1169
+ useGitignore?: boolean;
1170
+ /**
1171
+ * Tells the spell checker to stop searching for `.gitignore` files when it reaches a matching root.
1172
+ */
1173
+ gitignoreRoot?: FsPath | FsPath[];
1174
+ /**
1175
+ * Verify that the in-document directives are correct.
1176
+ */
1177
+ validateDirectives?: boolean;
1178
+ /**
1179
+ * Files to add to the CSpell Virtual File System.
1180
+ *
1181
+ * They can be referenced using `cspell-vfs:///<module>/<path-to-file>/<file-name>` URLs.
1182
+ *
1183
+ * They can be referenced in the `path` field of dictionary definitions.
1184
+ *
1185
+ * @since 9.7.0
1186
+ * @stability experimental
1187
+ */
1188
+ vfs?: CSpellVFS | undefined;
1189
+ /**
1190
+ * Configure CSpell features.
1191
+ *
1192
+ * @since 5.16.0
1193
+ */
1194
+ features?: Features;
1195
+ /**
1196
+ * Specify compatible engine versions.
1197
+ *
1198
+ * This allows dictionaries and other components to specify the versions of engines (like cspell) they are compatible with.
1199
+ *
1200
+ * It does not enforce compatibility, it is up to the client to use this information as needed.
1201
+ *
1202
+ * @since 9.6.3
1203
+ */
1204
+ engines?: CompatibleEngineVersions;
1205
+ }
1206
+ /**
1207
+ * In the below JSDoc comment, we helpfully specify an example configuration for the end-user to
1208
+ * reference. And this example will get captured by the automatic documentation generator.
1209
+ *
1210
+ * However, specifying the glob pattern inside of a JSDoc is tricky, because the glob contains the
1211
+ * same symbol as the end-of-JSDoc symbol. To work around this, we insert a zero-width space in
1212
+ * between the "*" and the "/" symbols. The zero-width space is automatically removed by the schema generator.
1213
+ */
1214
+ interface ExtendableSettings extends Settings {
1215
+ /**
1216
+ * Overrides are used to apply settings for specific files in your project.
1217
+ *
1218
+ * For example:
1219
+ *
1220
+ * ```javascript
1221
+ * "overrides": [
1222
+ * // Force `*.hrr` and `*.crr` files to be treated as `cpp` files:
1223
+ * {
1224
+ * "filename": "**​/{*.hrr,*.crr}",
1225
+ * "languageId": "cpp"
1226
+ * },
1227
+ * // Force `*.txt` to use the Dutch dictionary (Dutch dictionary needs to be installed separately):
1228
+ * {
1229
+ * "language": "nl",
1230
+ * "filename": "**​/dutch/**​/*.txt"
1231
+ * }
1232
+ * ]
1233
+ * ```
1234
+ */
1235
+ overrides?: OverrideSettings[];
1236
+ }
1237
+ interface SpellCheckerExtensionSettings {
1238
+ /**
1239
+ * Specify a list of file types to spell check. It is better to use {@link Settings.enabledFileTypes} to Enable / Disable checking files types.
1240
+ * @title Enabled Language Ids
1241
+ * @uniqueItems true
1242
+ */
1243
+ enabledLanguageIds?: LanguageIdSingle[];
1244
+ /**
1245
+ * Enable / Disable checking file types (languageIds).
1246
+ *
1247
+ * These are in additional to the file types specified by {@link Settings.enabledLanguageIds}.
1248
+ * To disable a language, prefix with `!` as in `!json`,
1249
+ *
1250
+ *
1251
+ * **Example: individual file types**
1252
+ *
1253
+ * ```
1254
+ * jsonc // enable checking for jsonc
1255
+ * !json // disable checking for json
1256
+ * kotlin // enable checking for kotlin
1257
+ * ```
1258
+ *
1259
+ * **Example: enable all file types**
1260
+ *
1261
+ * ```
1262
+ * * // enable checking for all file types
1263
+ * !json // except for json
1264
+ * ```
1265
+ * @title Enable File Types
1266
+ * @scope resource
1267
+ * @uniqueItems true
1268
+ */
1269
+ enableFiletypes?: LanguageIdSingle[];
1270
+ /**
1271
+ * Enable / Disable checking file types (languageIds).
1272
+ *
1273
+ * This setting replaces: {@link Settings.enabledLanguageIds} and {@link Settings.enableFiletypes}.
1274
+ *
1275
+ * A Value of:
1276
+ * - `true` - enable checking for the file type
1277
+ * - `false` - disable checking for the file type
1278
+ *
1279
+ * A file type of `*` is a wildcard that enables all file types.
1280
+ *
1281
+ * **Example: enable all file types**
1282
+ *
1283
+ * | File Type | Enabled | Comment |
1284
+ * | --------- | ------- | ------- |
1285
+ * | `*` | `true` | Enable all file types. |
1286
+ * | `json` | `false` | Disable checking for json files. |
1287
+ *
1288
+ * @title Enabled File Types to Check
1289
+ * @since 8.8.1
1290
+ */
1291
+ enabledFileTypes?: Record<string, boolean>;
1292
+ }
1293
+ interface Settings extends ReportingConfiguration, BaseSetting, PnPSettings, SpellCheckerExtensionSettings {
1294
+ /**
1295
+ * Current active spelling language. This specifies the language locale to use in choosing the
1296
+ * general dictionary.
1297
+ *
1298
+ * For example:
1299
+ *
1300
+ * - "en-GB" for British English.
1301
+ * - "en,nl" to enable both English and Dutch.
1302
+ *
1303
+ * @default "en"
1304
+ */
1305
+ language?: LocaleId;
1306
+ /**
1307
+ * Additional settings for individual languages.
1308
+ *
1309
+ * See [Language Settings](https://cspell.org/configuration/language-settings/) for more details.
1310
+ *
1311
+ */
1312
+ languageSettings?: LanguageSetting[];
1313
+ /** Forces the spell checker to assume a give language id. Used mainly as an Override. */
1314
+ languageId?: MatchingFileType;
1315
+ /**
1316
+ * By default, the bundled dictionary configurations are loaded. Explicitly setting this to `false`
1317
+ * will prevent ALL default configuration from being loaded.
1318
+ *
1319
+ * @default true
1320
+ */
1321
+ loadDefaultConfiguration?: boolean;
1322
+ /**
1323
+ * The Maximum size of a file to spell check. This is used to prevent spell checking very large files.
1324
+ *
1325
+ * The value can be number or a string formatted `<number>[units]`, number with optional units.
1326
+ *
1327
+ * Supported units:
1328
+ *
1329
+ * - K, KB - value * 1024
1330
+ * - M, MB - value * 2^20
1331
+ * - G, GB - value * 2^30
1332
+ *
1333
+ * Special values:
1334
+ * - `0` - has the effect of removing the limit.
1335
+ *
1336
+ * Examples:
1337
+ * - `1000000` - 1 million bytes
1338
+ * - `1000K` or `1000KB` - 1 thousand kilobytes
1339
+ * - `0.5M` or `0.5MB` - 0.5 megabytes
1340
+ *
1341
+ * default: no limit
1342
+ * @since 9.4.0
1343
+ */
1344
+ maxFileSize?: number | string | undefined;
1345
+ }
1346
+ /**
1347
+ * Plug N Play settings to support package systems like Yarn 2.
1348
+ */
1349
+ interface PnPSettings {
1350
+ /**
1351
+ * Packages managers like Yarn 2 use a `.pnp.cjs` file to assist in loading
1352
+ * packages stored in the repository.
1353
+ *
1354
+ * When true, the spell checker will search up the directory structure for the existence
1355
+ * of a PnP file and load it.
1356
+ *
1357
+ * @default false
1358
+ */
1359
+ usePnP?: boolean;
1360
+ /**
1361
+ * The PnP files to search for. Note: `.mjs` files are not currently supported.
1362
+ *
1363
+ * @default [".pnp.js", ".pnp.cjs"]
1364
+ */
1365
+ pnpFiles?: string[];
1366
+ }
1367
+ /**
1368
+ * The Strategy to use to detect if a file has changed.
1369
+ * - `content` - uses a hash of the file content to check file changes (slower - more accurate).
1370
+ * - `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI).
1371
+ * @default 'content'
1372
+ */
1373
+ type CacheStrategy = "content" | "metadata";
1374
+ type CacheFormat = "legacy" | "universal";
1375
+ interface CacheSettings {
1376
+ /**
1377
+ * Store the results of processed files in order to only operate on the changed ones.
1378
+ * @default false
1379
+ */
1380
+ useCache?: boolean;
1381
+ /**
1382
+ * Path to the cache location. Can be a file or a directory.
1383
+ * If none specified `.cspellcache` will be used.
1384
+ * Relative paths are relative to the config file in which it
1385
+ * is defined.
1386
+ *
1387
+ * A prefix of `${cwd}` is replaced with the current working directory.
1388
+ */
1389
+ cacheLocation?: FSPathResolvable;
1390
+ /**
1391
+ * Strategy to use for detecting changed files, default: metadata
1392
+ * @default 'metadata'
1393
+ */
1394
+ cacheStrategy?: CacheStrategy;
1395
+ /**
1396
+ * Format of the cache file.
1397
+ * - `legacy` - use absolute paths in the cache file
1398
+ * - `universal` - use a sharable format.
1399
+ * @default 'universal'
1400
+ */
1401
+ cacheFormat?: CacheFormat | undefined;
1402
+ }
1403
+ /**
1404
+ * These are settings only used by the command line application.
1405
+ */
1406
+ interface CommandLineSettings {
1407
+ /**
1408
+ * Define cache settings.
1409
+ */
1410
+ cache?: CacheSettings;
1411
+ /**
1412
+ * Exit with non-zero code as soon as an issue/error is encountered (useful for CI or git hooks)
1413
+ * @default false
1414
+ */
1415
+ failFast?: boolean;
1416
+ }
1417
+ /**
1418
+ * To prevent the unwanted execution of untrusted code, WorkspaceTrustSettings
1419
+ * are use to set the trust levels.
1420
+ *
1421
+ * Trust setting have an impact on both `cspell.config.js` files and on `.pnp.js` files.
1422
+ * In an untrusted location, these files will NOT be used.
1423
+ *
1424
+ * This will also prevent any associated plugins from being loaded.
1425
+ */
1426
+ /**
1427
+ * VS Code Spell Checker Settings.
1428
+ * To be Removed.
1429
+ * @deprecated true
1430
+ */
1431
+ interface LegacySettings {
1432
+ /**
1433
+ * Show status.
1434
+ * @deprecated true
1435
+ */
1436
+ showStatus?: boolean;
1437
+ /**
1438
+ * Delay in ms after a document has changed before checking it for spelling errors.
1439
+ * @deprecated true
1440
+ */
1441
+ spellCheckDelayMs?: number;
1442
+ }
1443
+ interface OverrideSettings extends Settings, OverrideFilterFields {
1444
+ /** Sets the programming language id to match file type. */
1445
+ languageId?: MatchingFileType;
1446
+ /** Sets the locale. */
1447
+ language?: LocaleId;
1448
+ }
1449
+ interface OverrideFilterFields {
1450
+ /** Glob pattern or patterns to match against. */
1451
+ filename: Glob | Glob[];
1452
+ }
1453
+ interface BaseSetting extends InlineDictionary, ExperimentalBaseSettings, UnknownWordsConfiguration {
1454
+ /** Optional identifier. */
1455
+ id?: string;
1456
+ /** Optional name of configuration. */
1457
+ name?: string;
1458
+ /** Optional description of configuration. */
1459
+ description?: string;
1460
+ /**
1461
+ * Is the spell checker enabled.
1462
+ * @default true
1463
+ */
1464
+ enabled?: boolean;
1465
+ /**
1466
+ * True to enable compound word checking.
1467
+ *
1468
+ * @default false
1469
+ */
1470
+ allowCompoundWords?: boolean;
1471
+ /**
1472
+ * Determines if words must match case and accent rules.
1473
+ *
1474
+ * See [Case Sensitivity](https://cspell.org/docs/case-sensitive/) for more details.
1475
+ *
1476
+ * - `false` - Case is ignored and accents can be missing on the entire word.
1477
+ * Incorrect accents or partially missing accents will be marked as incorrect.
1478
+ * - `true` - Case and accents are enforced.
1479
+ *
1480
+ * @default false
1481
+ */
1482
+ caseSensitive?: boolean;
1483
+ /**
1484
+ * Define additional available dictionaries.
1485
+ *
1486
+ * For example, you can use the following to add a custom dictionary:
1487
+ *
1488
+ * ```json
1489
+ * "dictionaryDefinitions": [
1490
+ * { "name": "custom-words", "path": "./custom-words.txt"}
1491
+ * ],
1492
+ * "dictionaries": ["custom-words"]
1493
+ * ```
1494
+ */
1495
+ dictionaryDefinitions?: DictionaryDefinition[];
1496
+ /**
1497
+ * Optional list of dictionaries to use. Each entry should match the name of the dictionary.
1498
+ *
1499
+ * To remove a dictionary from the list, add `!` before the name.
1500
+ *
1501
+ * For example, `!typescript` will turn off the dictionary with the name `typescript`.
1502
+ *
1503
+ * See the [Dictionaries](https://cspell.org/docs/dictionaries/)
1504
+ * and [Custom Dictionaries](https://cspell.org/docs/dictionaries/custom-dictionaries/) for more details.
1505
+ */
1506
+ dictionaries?: DictionaryReference[];
1507
+ /**
1508
+ * Optional list of dictionaries that will not be used for suggestions.
1509
+ * Words in these dictionaries are considered correct, but will not be
1510
+ * used when making spell correction suggestions.
1511
+ *
1512
+ * Note: if a word is suggested by another dictionary, but found in
1513
+ * one of these dictionaries, it will be removed from the set of
1514
+ * possible suggestions.
1515
+ */
1516
+ noSuggestDictionaries?: DictionaryReference[];
1517
+ /**
1518
+ * List of regular expression patterns or pattern names to exclude from spell checking.
1519
+ *
1520
+ * Example: `["href"]` - to exclude html href pattern.
1521
+ *
1522
+ * Regular expressions use JavaScript regular expression syntax.
1523
+ *
1524
+ * Example: to ignore ALL-CAPS words
1525
+ *
1526
+ * JSON
1527
+ * ```json
1528
+ * "ignoreRegExpList": ["/\\b[A-Z]+\\b/g"]
1529
+ * ```
1530
+ *
1531
+ * YAML
1532
+ * ```yaml
1533
+ * ignoreRegExpList:
1534
+ * - >-
1535
+ * /\b[A-Z]+\b/g
1536
+ * ```
1537
+ *
1538
+ * By default, several patterns are excluded. See
1539
+ * [Configuration](https://cspell.org/configuration/patterns) for more details.
1540
+ *
1541
+ * While you can create your own patterns, you can also leverage several patterns that are
1542
+ * [built-in to CSpell](https://cspell.org/types/cspell-types/types/PredefinedPatterns.html).
1543
+ */
1544
+ ignoreRegExpList?: RegExpPatternList;
1545
+ /**
1546
+ * List of regular expression patterns or defined pattern names to match for spell checking.
1547
+ *
1548
+ * If this property is defined, only text matching the included patterns will be checked.
1549
+ *
1550
+ * While you can create your own patterns, you can also leverage several patterns that are
1551
+ * [built-in to CSpell](https://cspell.org/types/cspell-types/types/PredefinedPatterns.html).
1552
+ */
1553
+ includeRegExpList?: RegExpPatternList;
1554
+ /**
1555
+ * Defines a list of patterns that can be used with the {@link ignoreRegExpList} and
1556
+ * {@link includeRegExpList} options.
1557
+ *
1558
+ * For example:
1559
+ *
1560
+ * ```javascript
1561
+ * "ignoreRegExpList": ["comments"],
1562
+ * "patterns": [
1563
+ * {
1564
+ * "name": "comment-single-line",
1565
+ * "pattern": "/#.*​/g"
1566
+ * },
1567
+ * {
1568
+ * "name": "comment-multi-line",
1569
+ * "pattern": "/(?:\\/\\*[\\s\\S]*?\\*\\/)/g"
1570
+ * },
1571
+ * // You can also combine multiple named patterns into one single named pattern
1572
+ * {
1573
+ * "name": "comments",
1574
+ * "pattern": ["comment-single-line", "comment-multi-line"]
1575
+ * }
1576
+ * ]
1577
+ * ```
1578
+ */
1579
+ patterns?: RegExpPatternDefinition[];
1580
+ /**
1581
+ * The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.
1582
+ * @since 9.7.0
1583
+ */
1584
+ substitutionDefinitions?: SubstitutionDefinitions;
1585
+ /**
1586
+ * The set of substitutions to apply to a document before spell checking.
1587
+ * @since 9.7.0
1588
+ */
1589
+ substitutions?: Substitutions;
1590
+ }
1591
+ interface LanguageSetting extends LanguageSettingFilterFields, BaseSetting {}
1592
+ interface LanguageSettingFilterFields extends LanguageSettingFilterFieldsPreferred, LanguageSettingFilterFieldsDeprecated {}
1593
+ interface LanguageSettingFilterFieldsPreferred {
1594
+ /** The language id. Ex: `typescript`, `html`, or `php`. `*` -- will match all languages. */
1595
+ languageId: MatchingFileType;
1596
+ /** The locale filter, matches against the language. This can be a comma separated list. `*` will match all locales. */
1597
+ locale?: LocaleId | LocaleId[];
1598
+ }
1599
+ interface LanguageSettingFilterFieldsDeprecated {
1600
+ /** The language id. Ex: `typescript`, `html`, or `php`. `*` -- will match all languages. */
1601
+ languageId: MatchingFileType;
1602
+ /**
1603
+ * Deprecated - The locale filter, matches against the language. This can be a comma separated list. `*` will match all locales.
1604
+ * @deprecated true
1605
+ * @deprecationMessage Use `locale` instead.
1606
+ */
1607
+ local?: LocaleId | LocaleId[];
1608
+ }
1609
+ /** @hidden */
1610
+ type InternalRegExp = RegExp;
1611
+ type Pattern = string | InternalRegExp;
1612
+ type PredefinedPatterns = "Base64" | "Base64MultiLine" | "Base64SingleLine" | "CStyleComment" | "CStyleHexValue" | "CSSHexValue" | "CommitHash" | "CommitHashLink" | "Email" | "EscapeCharacters" | "HexValues" | "href" | "PhpHereDoc" | "PublicKey" | "RsaCert" | "SshRsa" | "SHA" | "HashStrings" | "SpellCheckerDisable" | "SpellCheckerDisableBlock" | "SpellCheckerDisableLine" | "SpellCheckerDisableNext" | "SpellCheckerIgnoreInDocSetting" | "string" | "UnicodeRef" | "Urls" | "UUID" | "Everything";
1613
+ /** This matches the name in a pattern definition. */
1614
+ type PatternId = string;
1615
+ /** A PatternRef is a Pattern or PatternId. */
1616
+ type PatternRef = Pattern | PatternId | PredefinedPatterns;
1617
+ /** A list of pattern names or regular expressions. */
1618
+ type RegExpPatternList = PatternRef[];
1619
+ /** This is a written language locale like: `en`, `en-GB`, `fr`, `es`, `de` or `en,fr` for both English and French */
1620
+ type LocaleId = string;
1621
+ /**
1622
+ * Configuration File Version.
1623
+ */
1624
+ type VersionLatest = "0.2";
1625
+ /**
1626
+ * Legacy Configuration File Versions.
1627
+ * @deprecated true
1628
+ * @deprecationMessage Use `0.2` instead.
1629
+ */
1630
+ type VersionLegacy = "0.1";
1631
+ type Version = VersionLatest | VersionLegacy;
1632
+ /**
1633
+ * @deprecated true
1634
+ * @deprecationMessage Use `LocaleId` instead.
1635
+ */
1636
+ /** These are glob expressions. */
1637
+ type Glob = SimpleGlob | GlobDef;
1638
+ /** Simple Glob string, the root will be globRoot. */
1639
+ type SimpleGlob = string;
1640
+ /**
1641
+ * Used to define fully qualified glob patterns.
1642
+ * It is currently hidden to make the json-schema a bit easier to use
1643
+ * when crafting cspell.json files by hand.
1644
+ * @hidden
1645
+ */
1646
+ interface GlobDef {
1647
+ /** Glob pattern to match. */
1648
+ glob: string;
1649
+ /** Optional root to use when matching the glob. Defaults to current working dir. */
1650
+ root?: string;
1651
+ /**
1652
+ * Optional source of the glob, used when merging settings to determine the origin.
1653
+ * @hidden
1654
+ */
1655
+ source?: string;
1656
+ }
1657
+ /**
1658
+ * A file type:
1659
+ * - `*` - will match ALL file types.
1660
+ * - `typescript`, `cpp`, `json`, etc.
1661
+ * @pattern ^(!?[-\w_\s]+)|(\*)$
1662
+ */
1663
+ type LanguageIdSingle = string;
1664
+ /**
1665
+ * A single string with a comma separated list of file types:
1666
+ * - `typescript,cpp`
1667
+ * - `json,jsonc,yaml`
1668
+ * - etc.
1669
+ * @pattern ^([-\w_\s]+)(,[-\w_\s]+)*$
1670
+ */
1671
+ type LanguageIdMultiple = string;
1672
+ /**
1673
+ * A Negative File Type used to exclude files of that type.
1674
+ * - `!typescript` - will exclude typescript files.
1675
+ * - `!cpp,!json` - will exclude cpp and json files.
1676
+ * - `!typescript,javascript` - will exclude typescript files and include javascript files.
1677
+ * @pattern ^(![-\w_\s]+)(,!?[-\w_\s]+)*$
1678
+ */
1679
+ type LanguageIdMultipleNeg = string;
1680
+ type LanguageId = LanguageIdSingle | LanguageIdMultiple | LanguageIdMultipleNeg;
1681
+ type MatchingFileType = LanguageId | LanguageId[];
1682
+ /**
1683
+ * A File System Path. Relative paths are relative to the configuration file.
1684
+ */
1685
+ type FsPath = string;
1686
+ /**
1687
+ * A File System Path.
1688
+ *
1689
+ * Special Properties:
1690
+ * - `${cwd}` prefix - will be replaced with the current working directory.
1691
+ * - Relative paths are relative to the configuration file.
1692
+ */
1693
+ type FSPathResolvable = FsPath;
1694
+ /** Trust Security Level. */
1695
+ interface RegExpPatternDefinition {
1696
+ /**
1697
+ * Pattern name, used as an identifier in ignoreRegExpList and includeRegExpList.
1698
+ * It is possible to redefine one of the predefined patterns to override its value.
1699
+ */
1700
+ name: PatternId;
1701
+ /**
1702
+ * RegExp pattern or array of RegExp patterns.
1703
+ */
1704
+ pattern: Pattern | Pattern[];
1705
+ /**
1706
+ * Description of the pattern.
1707
+ */
1708
+ description?: string | undefined;
1709
+ }
1710
+ /**
1711
+ * The module or path to the the reporter to load.
1712
+ */
1713
+ type ReporterModuleName = string;
1714
+ /**
1715
+ * Options to send to the reporter. These are defined by the reporter.
1716
+ */
1717
+ type ReporterOptions = Serializable;
1718
+ /**
1719
+ * Declare a reporter to use.
1720
+ *
1721
+ * `default` - is a special name for the default cli reporter.
1722
+ *
1723
+ * Examples:
1724
+ * - `"default"` - to use the default reporter
1725
+ * - `"@cspell/cspell-json-reporter"` - use the cspell JSON reporter.
1726
+ * - `["@cspell/cspell-json-reporter", { "outFile": "out.json" }]`
1727
+ */
1728
+ type ReporterSettings = ReporterModuleName | [name: ReporterModuleName] | [name: ReporterModuleName, options: ReporterOptions];
1729
+ /**
1730
+ * Experimental Configuration / Options
1731
+ *
1732
+ * This Configuration is subject to change without warning.
1733
+ * @experimental
1734
+ * @hidden
1735
+ */
1736
+ interface ExperimentalFileSettings {
1737
+ /**
1738
+ * Future Plugin support
1739
+ * @experimental
1740
+ * @since 6.2.0
1741
+ */
1742
+ plugins?: Plugin[];
1743
+ }
1744
+ /**
1745
+ * Extends CSpellSettings with {@link ExperimentalFileSettings}
1746
+ * @experimental
1747
+ * @hidden
1748
+ */
1749
+ interface AdvancedCSpellSettings extends CSpellSettings, ExperimentalFileSettings {}
1750
+ /**
1751
+ * Experimental Configuration / Options
1752
+ *
1753
+ * This Configuration is subject to change without warning.
1754
+ * @experimental
1755
+ * @hidden
1756
+ */
1757
+ interface ExperimentalBaseSettings {
1758
+ /**
1759
+ * Parser to use for the file content
1760
+ * @experimental
1761
+ * @since 6.2.0
1762
+ */
1763
+ parser?: ParserName;
1764
+ }
1765
+ /**
1766
+ * Plugin API
1767
+ * @experimental
1768
+ * @since 6.2.0
1769
+ */
1770
+ interface Plugin {
1771
+ parsers?: Parser[];
1772
+ }
1773
+ /**
1774
+ * Semantic Version Predicate
1775
+ *
1776
+ * Examples:
1777
+ * - `>=8`
1778
+ */
1779
+ type SemVersionPredicate = string;
1780
+ /**
1781
+ * Engine version predicates.
1782
+ *
1783
+ * This allows dictionaries and other components to specify the versions of engines (like cspell) they are compatible with.
1784
+ *
1785
+ * @since 9.6.3
1786
+ */
1787
+ interface CompatibleEngineVersions {
1788
+ /**
1789
+ * CSpell version predicate.
1790
+ * @since 9.6.3
1791
+ */
1792
+ cspell?: SemVersionPredicate | undefined;
1793
+ /**
1794
+ * The VSCode Spell Checker version predicate.
1795
+ * @since 9.6.3
1796
+ */
1797
+ "code-spell-checker"?: SemVersionPredicate | undefined;
1798
+ /**
1799
+ * Other engine version predicates.
1800
+ */
1801
+ [engine: string]: SemVersionPredicate | undefined;
1802
+ } //#endregion
1803
+ //#region src/configFields.d.ts
1804
+ //#endregion
1805
+ //#region src/config.d.ts
1806
+ declare const config: AdvancedCSpellSettings;
1807
+ //#endregion
1808
+ export { config as default, meta };
1809
+ //# sourceMappingURL=index.d.ts.map