@cspell/cspell-types 8.17.0 → 8.17.2

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