@cspell/cspell-types 5.15.1 → 5.17.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cspell.schema.json +256 -0
- package/dist/CSpellReporter.d.ts +1 -1
- package/dist/CSpellSettingsDef.d.ts +26 -1
- package/dist/DictionaryInformation.d.ts +217 -0
- package/dist/DictionaryInformation.js +3 -0
- package/dist/configFields.js +2 -0
- package/dist/features.d.ts +38 -0
- package/dist/features.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/suggestionCostsDef.d.ts +88 -0
- package/dist/suggestionCostsDef.js +3 -0
- package/package.json +7 -6
package/cspell.schema.json
CHANGED
|
@@ -30,6 +30,108 @@
|
|
|
30
30
|
],
|
|
31
31
|
"type": "string"
|
|
32
32
|
},
|
|
33
|
+
"CostMapDefInsDel": {
|
|
34
|
+
"additionalProperties": false,
|
|
35
|
+
"properties": {
|
|
36
|
+
"description": {
|
|
37
|
+
"description": "A description to describe the purpose of the map.",
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"insDel": {
|
|
41
|
+
"description": "The cost to insert/delete one of the substrings in the map. Note: insert/delete costs are symmetrical.",
|
|
42
|
+
"type": "number"
|
|
43
|
+
},
|
|
44
|
+
"map": {
|
|
45
|
+
"description": "The set of substrings to map, these are generally single character strings.\n\nMultiple sets can be defined by using a `|` to separate them.\n\nExample: `\"eéê|aåá\"` contains two different sets.\n\nTo add a multi-character substring use `()`.\n\nExample: `\"f(ph)(gh)\"` results in the following set: `f`, `ph`, `gh`.\n\n- To match the beginning of a word, use `^`: `\"(^I)\"\"`.\n- To match the end of a word, use `$`: `\"(e$)(ing$)\"`.",
|
|
46
|
+
"type": "string"
|
|
47
|
+
},
|
|
48
|
+
"penalty": {
|
|
49
|
+
"description": "Add a penalty to the final cost. This is used to discourage certain suggestions.\n\nExample: ```yaml # Match adding/removing `-` to the end of a word. map: \"$(-$)\" replace: 50 penalty: 100 ```\n\nThis makes adding a `-` to the end of a word more expensive.\n\nThink of it as taking the toll way for speed but getting the bill later.",
|
|
50
|
+
"type": "number"
|
|
51
|
+
},
|
|
52
|
+
"replace": {
|
|
53
|
+
"description": "The cost to replace of of the substrings in the map with another substring in the map. Example: Map['a', 'i'] This would be the cost to substitute `a` with `i`: Like `bat` to `bit` or the reverse.",
|
|
54
|
+
"type": "number"
|
|
55
|
+
},
|
|
56
|
+
"swap": {
|
|
57
|
+
"description": "The cost to swap two adjacent substrings found in the map. Example: Map['e', 'i'] This represents the cost to change `ei` to `ie` or the reverse.",
|
|
58
|
+
"type": "number"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"required": [
|
|
62
|
+
"insDel",
|
|
63
|
+
"map"
|
|
64
|
+
],
|
|
65
|
+
"type": "object"
|
|
66
|
+
},
|
|
67
|
+
"CostMapDefReplace": {
|
|
68
|
+
"additionalProperties": false,
|
|
69
|
+
"properties": {
|
|
70
|
+
"description": {
|
|
71
|
+
"description": "A description to describe the purpose of the map.",
|
|
72
|
+
"type": "string"
|
|
73
|
+
},
|
|
74
|
+
"insDel": {
|
|
75
|
+
"description": "The cost to insert/delete one of the substrings in the map. Note: insert/delete costs are symmetrical.",
|
|
76
|
+
"type": "number"
|
|
77
|
+
},
|
|
78
|
+
"map": {
|
|
79
|
+
"description": "The set of substrings to map, these are generally single character strings.\n\nMultiple sets can be defined by using a `|` to separate them.\n\nExample: `\"eéê|aåá\"` contains two different sets.\n\nTo add a multi-character substring use `()`.\n\nExample: `\"f(ph)(gh)\"` results in the following set: `f`, `ph`, `gh`.\n\n- To match the beginning of a word, use `^`: `\"(^I)\"\"`.\n- To match the end of a word, use `$`: `\"(e$)(ing$)\"`.",
|
|
80
|
+
"type": "string"
|
|
81
|
+
},
|
|
82
|
+
"penalty": {
|
|
83
|
+
"description": "Add a penalty to the final cost. This is used to discourage certain suggestions.\n\nExample: ```yaml # Match adding/removing `-` to the end of a word. map: \"$(-$)\" replace: 50 penalty: 100 ```\n\nThis makes adding a `-` to the end of a word more expensive.\n\nThink of it as taking the toll way for speed but getting the bill later.",
|
|
84
|
+
"type": "number"
|
|
85
|
+
},
|
|
86
|
+
"replace": {
|
|
87
|
+
"description": "The cost to replace of of the substrings in the map with another substring in the map. Example: Map['a', 'i'] This would be the cost to substitute `a` with `i`: Like `bat` to `bit` or the reverse.",
|
|
88
|
+
"type": "number"
|
|
89
|
+
},
|
|
90
|
+
"swap": {
|
|
91
|
+
"description": "The cost to swap two adjacent substrings found in the map. Example: Map['e', 'i'] This represents the cost to change `ei` to `ie` or the reverse.",
|
|
92
|
+
"type": "number"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"required": [
|
|
96
|
+
"map",
|
|
97
|
+
"replace"
|
|
98
|
+
],
|
|
99
|
+
"type": "object"
|
|
100
|
+
},
|
|
101
|
+
"CostMapDefSwap": {
|
|
102
|
+
"additionalProperties": false,
|
|
103
|
+
"properties": {
|
|
104
|
+
"description": {
|
|
105
|
+
"description": "A description to describe the purpose of the map.",
|
|
106
|
+
"type": "string"
|
|
107
|
+
},
|
|
108
|
+
"insDel": {
|
|
109
|
+
"description": "The cost to insert/delete one of the substrings in the map. Note: insert/delete costs are symmetrical.",
|
|
110
|
+
"type": "number"
|
|
111
|
+
},
|
|
112
|
+
"map": {
|
|
113
|
+
"description": "The set of substrings to map, these are generally single character strings.\n\nMultiple sets can be defined by using a `|` to separate them.\n\nExample: `\"eéê|aåá\"` contains two different sets.\n\nTo add a multi-character substring use `()`.\n\nExample: `\"f(ph)(gh)\"` results in the following set: `f`, `ph`, `gh`.\n\n- To match the beginning of a word, use `^`: `\"(^I)\"\"`.\n- To match the end of a word, use `$`: `\"(e$)(ing$)\"`.",
|
|
114
|
+
"type": "string"
|
|
115
|
+
},
|
|
116
|
+
"penalty": {
|
|
117
|
+
"description": "Add a penalty to the final cost. This is used to discourage certain suggestions.\n\nExample: ```yaml # Match adding/removing `-` to the end of a word. map: \"$(-$)\" replace: 50 penalty: 100 ```\n\nThis makes adding a `-` to the end of a word more expensive.\n\nThink of it as taking the toll way for speed but getting the bill later.",
|
|
118
|
+
"type": "number"
|
|
119
|
+
},
|
|
120
|
+
"replace": {
|
|
121
|
+
"description": "The cost to replace of of the substrings in the map with another substring in the map. Example: Map['a', 'i'] This would be the cost to substitute `a` with `i`: Like `bat` to `bit` or the reverse.",
|
|
122
|
+
"type": "number"
|
|
123
|
+
},
|
|
124
|
+
"swap": {
|
|
125
|
+
"description": "The cost to swap two adjacent substrings found in the map. Example: Map['e', 'i'] This represents the cost to change `ei` to `ie` or the reverse.",
|
|
126
|
+
"type": "number"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"required": [
|
|
130
|
+
"map",
|
|
131
|
+
"swap"
|
|
132
|
+
],
|
|
133
|
+
"type": "object"
|
|
134
|
+
},
|
|
33
135
|
"CustomDictionaryPath": {
|
|
34
136
|
"description": "A File System Path to a dictionary file.",
|
|
35
137
|
"pattern": "^.*\\.txt$",
|
|
@@ -52,6 +154,9 @@
|
|
|
52
154
|
{
|
|
53
155
|
"$ref": "#/definitions/DictionaryDefinitionCustom"
|
|
54
156
|
},
|
|
157
|
+
{
|
|
158
|
+
"$ref": "#/definitions/DictionaryDefinitionAugmented"
|
|
159
|
+
},
|
|
55
160
|
{
|
|
56
161
|
"$ref": "#/definitions/DictionaryDefinitionAlternate"
|
|
57
162
|
}
|
|
@@ -101,6 +206,49 @@
|
|
|
101
206
|
],
|
|
102
207
|
"type": "object"
|
|
103
208
|
},
|
|
209
|
+
"DictionaryDefinitionAugmented": {
|
|
210
|
+
"additionalProperties": false,
|
|
211
|
+
"description": "Used to provide extra data related to the dictionary",
|
|
212
|
+
"properties": {
|
|
213
|
+
"description": {
|
|
214
|
+
"description": "Optional description.",
|
|
215
|
+
"type": "string"
|
|
216
|
+
},
|
|
217
|
+
"dictionaryInformation": {
|
|
218
|
+
"$ref": "#/definitions/DictionaryInformation"
|
|
219
|
+
},
|
|
220
|
+
"name": {
|
|
221
|
+
"$ref": "#/definitions/DictionaryId",
|
|
222
|
+
"description": "This is the name of a dictionary.\n\nName Format:\n- Must contain at least 1 number or letter.\n- Spaces are allowed.\n- Leading and trailing space will be removed.\n- Names ARE case-sensitive.\n- Must not contain `*`, `!`, `;`, `,`, `{`, `}`, `[`, `]`, `~`."
|
|
223
|
+
},
|
|
224
|
+
"noSuggest": {
|
|
225
|
+
"description": "Indicate that suggestions should not come from this dictionary. Words in this dictionary are considered correct, but will not be used when making spell correction suggestions.\n\nNote: if a word is suggested by another dictionary, but found in this dictionary, it will be removed from the set of possible suggestions.",
|
|
226
|
+
"type": "boolean"
|
|
227
|
+
},
|
|
228
|
+
"path": {
|
|
229
|
+
"$ref": "#/definitions/DictionaryPath",
|
|
230
|
+
"description": "Path to the file."
|
|
231
|
+
},
|
|
232
|
+
"repMap": {
|
|
233
|
+
"$ref": "#/definitions/ReplaceMap",
|
|
234
|
+
"description": "Replacement pairs."
|
|
235
|
+
},
|
|
236
|
+
"type": {
|
|
237
|
+
"$ref": "#/definitions/DictionaryFileTypes",
|
|
238
|
+
"default": "S",
|
|
239
|
+
"description": "Type of file: S - single word per line, W - each line can contain one or more words separated by space, C - each line is treated like code (Camel Case is allowed). Default is S. C is the slowest to load due to the need to split each line based upon code splitting rules."
|
|
240
|
+
},
|
|
241
|
+
"useCompounds": {
|
|
242
|
+
"description": "Use Compounds.",
|
|
243
|
+
"type": "boolean"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"required": [
|
|
247
|
+
"name",
|
|
248
|
+
"path"
|
|
249
|
+
],
|
|
250
|
+
"type": "object"
|
|
251
|
+
},
|
|
104
252
|
"DictionaryDefinitionCustom": {
|
|
105
253
|
"additionalProperties": false,
|
|
106
254
|
"description": "For Defining Custom dictionaries. They are generally scoped to a `user`, `workspace`, or `folder`. When `addWords` is true, indicates that the spell checker can add words to the file. Note: only plain text files with one word per line are supported at this moment.",
|
|
@@ -213,6 +361,21 @@
|
|
|
213
361
|
"pattern": "^(?=[^!*,;{}[\\]~\\n]+$)(?=(.*\\w)).+$",
|
|
214
362
|
"type": "string"
|
|
215
363
|
},
|
|
364
|
+
"DictionaryInformation": {
|
|
365
|
+
"additionalProperties": false,
|
|
366
|
+
"description": "Use by dictionary authors to help improve the quality of suggestions given from the dictionary.\n\nAdded with `v5.16.0`.",
|
|
367
|
+
"properties": {
|
|
368
|
+
"hunspellInformation": {
|
|
369
|
+
"$ref": "#/definitions/HunspellInformation",
|
|
370
|
+
"description": "Used by dictionary authors"
|
|
371
|
+
},
|
|
372
|
+
"suggestionEditCosts": {
|
|
373
|
+
"$ref": "#/definitions/SuggestionCostsDefs",
|
|
374
|
+
"description": "Used in making suggestions. The lower the value, the more likely the suggestion will be near the top of the suggestion list."
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
"type": "object"
|
|
378
|
+
},
|
|
216
379
|
"DictionaryNegRef": {
|
|
217
380
|
"description": "This a negative reference to a named dictionary.\n\nIt is used to exclude or include a dictionary by name.\n\nThe reference starts with 1 or more `!`.\n- `!<dictionary_name>` - Used to exclude the dictionary matching `<dictionary_name>`.\n- `!!<dictionary_name>` - Used to re-include a dictionary matching `<dictionary_name>`. Overrides `!<dictionary_name>`.\n- `!!!<dictionary_name>` - Used to exclude a dictionary matching `<dictionary_name>`. Overrides `!!<dictionary_name>`.",
|
|
218
381
|
"pattern": "^(?=!+[^!*,;{}[\\]~\\n]+$)(?=(.*\\w)).+$",
|
|
@@ -242,6 +405,20 @@
|
|
|
242
405
|
"$ref": "#/definitions/FsPath",
|
|
243
406
|
"description": "A File System Path.\n\nSpecial Properties:\n- `${cwd}` prefix - will be replaced with the current working directory.\n- Relative paths are relative to the configuration file."
|
|
244
407
|
},
|
|
408
|
+
"FeatureEnableOnly": {
|
|
409
|
+
"type": "boolean"
|
|
410
|
+
},
|
|
411
|
+
"Features": {
|
|
412
|
+
"additionalProperties": false,
|
|
413
|
+
"description": "Features are behaviors or settings that can be explicitly configured.",
|
|
414
|
+
"properties": {
|
|
415
|
+
"weighted-suggestions": {
|
|
416
|
+
"$ref": "#/definitions/FeatureEnableOnly",
|
|
417
|
+
"description": "Enable/disable using weighted suggestions."
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
"type": "object"
|
|
421
|
+
},
|
|
245
422
|
"FsPath": {
|
|
246
423
|
"description": "A File System Path. Relative paths are relative to the configuration file.",
|
|
247
424
|
"type": "string"
|
|
@@ -250,6 +427,56 @@
|
|
|
250
427
|
"$ref": "#/definitions/SimpleGlob",
|
|
251
428
|
"description": "These are glob expressions."
|
|
252
429
|
},
|
|
430
|
+
"HunspellInformation": {
|
|
431
|
+
"additionalProperties": false,
|
|
432
|
+
"properties": {
|
|
433
|
+
"aff": {
|
|
434
|
+
"description": "Selected Hunspell AFF content. The content must be UTF-8\n\nSections:\n- TRY\n- MAP\n- REP\n- KEY\n- ICONV\n- OCONV\n\nExample: ```hunspell # Comment TRY aeistlunkodmrvpgjhäõbüoöfcwzxðqþ` MAP aàâäAÀÂÄ MAP eéèêëEÉÈÊË MAP iîïyIÎÏY MAP oôöOÔÖ MAP (IJ)(IJ) ```",
|
|
435
|
+
"type": "string"
|
|
436
|
+
},
|
|
437
|
+
"costs": {
|
|
438
|
+
"additionalProperties": false,
|
|
439
|
+
"description": "The costs to apply when using the hunspell settings",
|
|
440
|
+
"properties": {
|
|
441
|
+
"firstLetterPenalty": {
|
|
442
|
+
"default": 4,
|
|
443
|
+
"description": "The extra cost incurred for changing the first letter of a word. This value should be less than `100 - tryCharCost`.",
|
|
444
|
+
"type": "number"
|
|
445
|
+
},
|
|
446
|
+
"ioConvertCost": {
|
|
447
|
+
"default": 30,
|
|
448
|
+
"description": "The cost to convert between convert pairs.\n\nThe value should be slightly higher than the mapCost.",
|
|
449
|
+
"type": "number"
|
|
450
|
+
},
|
|
451
|
+
"keyboardCost": {
|
|
452
|
+
"default": 94,
|
|
453
|
+
"description": "The cost of replacing or swapping any adjacent keyboard characters.\n\nThis should be slightly cheaper than `tryCharCost`.",
|
|
454
|
+
"type": "number"
|
|
455
|
+
},
|
|
456
|
+
"mapCost": {
|
|
457
|
+
"default": 25,
|
|
458
|
+
"description": "mapSet replacement cost is the cost to substitute one character with another from the same set.\n\nMap characters are considered very similar to each other and are often the cause of simple mistakes.",
|
|
459
|
+
"type": "number"
|
|
460
|
+
},
|
|
461
|
+
"replaceCosts": {
|
|
462
|
+
"default": 75,
|
|
463
|
+
"description": "The cost to substitute pairs found in the replace settings.",
|
|
464
|
+
"type": "number"
|
|
465
|
+
},
|
|
466
|
+
"tryCharCost": {
|
|
467
|
+
"default": 95,
|
|
468
|
+
"description": "The cost of inserting / deleting / or swapping any `tryChars`",
|
|
469
|
+
"type": "number"
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
"type": "object"
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
"required": [
|
|
476
|
+
"aff"
|
|
477
|
+
],
|
|
478
|
+
"type": "object"
|
|
479
|
+
},
|
|
253
480
|
"LanguageId": {
|
|
254
481
|
"anyOf": [
|
|
255
482
|
{
|
|
@@ -742,6 +969,26 @@
|
|
|
742
969
|
"description": "Simple Glob string, the root will be globRoot.",
|
|
743
970
|
"type": "string"
|
|
744
971
|
},
|
|
972
|
+
"SuggestionCostMapDef": {
|
|
973
|
+
"anyOf": [
|
|
974
|
+
{
|
|
975
|
+
"$ref": "#/definitions/CostMapDefReplace"
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
"$ref": "#/definitions/CostMapDefInsDel"
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
"$ref": "#/definitions/CostMapDefSwap"
|
|
982
|
+
}
|
|
983
|
+
],
|
|
984
|
+
"description": "A WeightedMapDef enables setting weights for edits between related characters and substrings.\n\nMultiple groups can be defined using a `|`. A multi-character substring is defined using `()`.\n\nFor example, in some languages, some letters sound alike.\n\n```yaml map: 'sc(sh)(sch)(ss)|t(tt)' # two groups. replace: 50 # Make it 1/2 the cost of a normal edit to replace a `t` with `tt`. ```\n\nThe following could be used to make inserting, removing, or replacing vowels cheaper. ```yaml map: 'aeiouy' insDel: 50 # Make it is cheaper to insert or delete a vowel. replace: 45 # It is even cheaper to replace one with another. ```\n\nNote: the default edit distance is 100."
|
|
985
|
+
},
|
|
986
|
+
"SuggestionCostsDefs": {
|
|
987
|
+
"items": {
|
|
988
|
+
"$ref": "#/definitions/SuggestionCostMapDef"
|
|
989
|
+
},
|
|
990
|
+
"type": "array"
|
|
991
|
+
},
|
|
745
992
|
"Version": {
|
|
746
993
|
"anyOf": [
|
|
747
994
|
{
|
|
@@ -828,6 +1075,15 @@
|
|
|
828
1075
|
},
|
|
829
1076
|
"type": "array"
|
|
830
1077
|
},
|
|
1078
|
+
"failFast": {
|
|
1079
|
+
"default": false,
|
|
1080
|
+
"description": "Exit with non-zero code as soon as an issue/error is encountered (useful for CI or git hooks)",
|
|
1081
|
+
"type": "boolean"
|
|
1082
|
+
},
|
|
1083
|
+
"features": {
|
|
1084
|
+
"$ref": "#/definitions/Features",
|
|
1085
|
+
"description": "Configure CSpell features.\n\n- Added with `v5.16.0`."
|
|
1086
|
+
},
|
|
831
1087
|
"files": {
|
|
832
1088
|
"description": "Glob patterns of files to be checked. Glob patterns are relative to the `globRoot` of the configuration file that defines them.",
|
|
833
1089
|
"items": {
|
package/dist/CSpellReporter.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export interface RunResult {
|
|
|
45
45
|
/** Number of processing errors. */
|
|
46
46
|
errors: number;
|
|
47
47
|
/** Number files that used results from the cache. */
|
|
48
|
-
cachedFiles
|
|
48
|
+
cachedFiles?: number;
|
|
49
49
|
}
|
|
50
50
|
export declare type ResultEmitter = (result: RunResult) => void | Promise<void>;
|
|
51
51
|
export interface CSpellReporter {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { DictionaryInformation } from './DictionaryInformation';
|
|
2
|
+
import type { Features } from './features';
|
|
1
3
|
export declare type ReplaceEntry = [string, string];
|
|
2
4
|
export declare type ReplaceMap = ReplaceEntry[];
|
|
3
5
|
/**
|
|
@@ -86,6 +88,12 @@ export interface FileSettings extends ExtendableSettings, CommandLineSettings {
|
|
|
86
88
|
* Tells the spell checker to searching for `.gitignore` files when it reaches a matching root.
|
|
87
89
|
*/
|
|
88
90
|
gitignoreRoot?: FsPath | FsPath[];
|
|
91
|
+
/**
|
|
92
|
+
* Configure CSpell features.
|
|
93
|
+
*
|
|
94
|
+
* - Added with `v5.16.0`.
|
|
95
|
+
*/
|
|
96
|
+
features?: Features;
|
|
89
97
|
}
|
|
90
98
|
export interface ExtendableSettings extends Settings {
|
|
91
99
|
/** Overrides to apply based upon the file path. */
|
|
@@ -219,6 +227,11 @@ export interface CommandLineSettings {
|
|
|
219
227
|
* Define cache settings.
|
|
220
228
|
*/
|
|
221
229
|
cache?: CacheSettings;
|
|
230
|
+
/**
|
|
231
|
+
* Exit with non-zero code as soon as an issue/error is encountered (useful for CI or git hooks)
|
|
232
|
+
* @default false
|
|
233
|
+
*/
|
|
234
|
+
failFast?: boolean;
|
|
222
235
|
}
|
|
223
236
|
/**
|
|
224
237
|
* To prevent the unwanted execution of untrusted code, WorkspaceTrustSettings
|
|
@@ -338,7 +351,7 @@ export interface BaseSetting {
|
|
|
338
351
|
patterns?: RegExpPatternDefinition[];
|
|
339
352
|
}
|
|
340
353
|
export declare type DictionaryFileTypes = 'S' | 'W' | 'C' | 'T';
|
|
341
|
-
export declare type DictionaryDefinition = DictionaryDefinitionPreferred | DictionaryDefinitionCustom | DictionaryDefinitionAlternate | DictionaryDefinitionLegacy;
|
|
354
|
+
export declare type DictionaryDefinition = DictionaryDefinitionPreferred | DictionaryDefinitionCustom | DictionaryDefinitionAugmented | DictionaryDefinitionAlternate | DictionaryDefinitionLegacy;
|
|
342
355
|
export interface DictionaryDefinitionBase {
|
|
343
356
|
/**
|
|
344
357
|
* This is the name of a dictionary.
|
|
@@ -389,6 +402,12 @@ export interface DictionaryDefinitionPreferred extends DictionaryDefinitionBase
|
|
|
389
402
|
*/
|
|
390
403
|
file?: undefined;
|
|
391
404
|
}
|
|
405
|
+
/**
|
|
406
|
+
* Used to provide extra data related to the dictionary
|
|
407
|
+
*/
|
|
408
|
+
export interface DictionaryDefinitionAugmented extends DictionaryDefinitionPreferred {
|
|
409
|
+
dictionaryInformation?: DictionaryInformation;
|
|
410
|
+
}
|
|
392
411
|
/**
|
|
393
412
|
* Only for legacy dictionary definitions.
|
|
394
413
|
* @deprecated true
|
|
@@ -403,6 +422,8 @@ export interface DictionaryDefinitionAlternate extends DictionaryDefinitionBase
|
|
|
403
422
|
* @deprecationMessage Use `path` instead.
|
|
404
423
|
*/
|
|
405
424
|
file: DictionaryPath;
|
|
425
|
+
/** @hidden */
|
|
426
|
+
suggestionEditCosts?: undefined;
|
|
406
427
|
}
|
|
407
428
|
/**
|
|
408
429
|
* @deprecated true
|
|
@@ -427,6 +448,10 @@ export interface DictionaryDefinitionLegacy extends DictionaryDefinitionBase {
|
|
|
427
448
|
* @default "S"
|
|
428
449
|
*/
|
|
429
450
|
type?: DictionaryFileTypes;
|
|
451
|
+
/**
|
|
452
|
+
* @hidden
|
|
453
|
+
*/
|
|
454
|
+
suggestionEditCosts?: undefined;
|
|
430
455
|
}
|
|
431
456
|
/**
|
|
432
457
|
* Specifies the scope of a dictionary.
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { SuggestionCostsDefs } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* Use by dictionary authors to help improve the quality of suggestions
|
|
4
|
+
* given from the dictionary.
|
|
5
|
+
*
|
|
6
|
+
* Added with `v5.16.0`.
|
|
7
|
+
*/
|
|
8
|
+
export interface DictionaryInformation {
|
|
9
|
+
/**
|
|
10
|
+
* Used in making suggestions. The lower the value, the more likely the suggestion
|
|
11
|
+
* will be near the top of the suggestion list.
|
|
12
|
+
*/
|
|
13
|
+
suggestionEditCosts?: SuggestionCostsDefs | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Used by dictionary authors
|
|
16
|
+
*/
|
|
17
|
+
hunspellInformation?: HunspellInformation;
|
|
18
|
+
}
|
|
19
|
+
export interface HunspellInformationParsed {
|
|
20
|
+
/**
|
|
21
|
+
* This is generally the alphabet used in the dictionary.
|
|
22
|
+
* It stands for the characters to try using for substitutions
|
|
23
|
+
* when looking for a suggestions.
|
|
24
|
+
*
|
|
25
|
+
* Example:
|
|
26
|
+
* - Hunspell:
|
|
27
|
+
* ```hunspell
|
|
28
|
+
* TRY aeistlunkodmrvpgjhäõbüoöfcwzxðqþ`
|
|
29
|
+
* ```
|
|
30
|
+
* - Use: yaml
|
|
31
|
+
* ```yaml
|
|
32
|
+
* tryChars: "aeistlunkodmrvpgjhäõbüoöfcwzxðqþ"
|
|
33
|
+
* ```
|
|
34
|
+
* <!--- cspell:ignore aeistlunkodmrvpgjhäõbüoöfcwzxðqþ --
|
|
35
|
+
*/
|
|
36
|
+
tryChars?: string;
|
|
37
|
+
/**
|
|
38
|
+
* This defines characters that are good substitutes for each other.
|
|
39
|
+
* - A `()` is need for multi character sequences like letters with multiple accents.
|
|
40
|
+
* - Separate unrelated characters with `|` or `\n`
|
|
41
|
+
*
|
|
42
|
+
* Example:
|
|
43
|
+
* - Hunspell:
|
|
44
|
+
* ```hunspell
|
|
45
|
+
* MAP aàâäAÀÂÄ
|
|
46
|
+
* MAP eéèêëEÉÈÊË
|
|
47
|
+
* MAP iîïyIÎÏY
|
|
48
|
+
* MAP oôöOÔÖ
|
|
49
|
+
* MAP (IJ)(IJ)
|
|
50
|
+
* ```
|
|
51
|
+
* - Use:
|
|
52
|
+
* `yaml`
|
|
53
|
+
* ```yaml
|
|
54
|
+
* mapSets: |
|
|
55
|
+
* aàâäAÀÂÄ|eéèêëEÉÈÊË`
|
|
56
|
+
* eéèêëEÉÈÊË|iîïyIÎÏY
|
|
57
|
+
* oôöOÔÖ|(IJ)(IJ)
|
|
58
|
+
* ```
|
|
59
|
+
* <!--- cspell:ignore aàâä eéèêë iîïy -->
|
|
60
|
+
*/
|
|
61
|
+
mapSets?: string | string[];
|
|
62
|
+
/**
|
|
63
|
+
* This represents the layout of a common keyboard.
|
|
64
|
+
* Used for adjacency mistakes.
|
|
65
|
+
*
|
|
66
|
+
* Hunspell:
|
|
67
|
+
* ```hunspell
|
|
68
|
+
* KEY qwertyuiop|asdfghjkl|zxcvbnm
|
|
69
|
+
* ```
|
|
70
|
+
* Use:
|
|
71
|
+
* ```yaml
|
|
72
|
+
* keyboard: qwertyuiop|asdfghjkl|zxcvbnm
|
|
73
|
+
* ```
|
|
74
|
+
* <!--- cspell:ignore asdfghjkl qwertyuiop zxcvbnm -->
|
|
75
|
+
*/
|
|
76
|
+
keyboard?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Output Conversions
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
81
|
+
outConvert?: string | string[];
|
|
82
|
+
inConvert?: string | string[];
|
|
83
|
+
/**
|
|
84
|
+
* Common Substitutions.
|
|
85
|
+
* Special characters:
|
|
86
|
+
* - `^` - matches the beginning of a word.
|
|
87
|
+
* - `$` - matches the end of a word.
|
|
88
|
+
*
|
|
89
|
+
* Hunspell:
|
|
90
|
+
* ```hunspell
|
|
91
|
+
* REP c ss
|
|
92
|
+
* REP e ij
|
|
93
|
+
* REP é ee
|
|
94
|
+
* REP g ch
|
|
95
|
+
* REP ï ii
|
|
96
|
+
* REP t d # gebiest=>gebiesd
|
|
97
|
+
* REP u ij
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* Use:
|
|
101
|
+
* ```yaml
|
|
102
|
+
* replace: |
|
|
103
|
+
* c ss
|
|
104
|
+
* e ij
|
|
105
|
+
* é ee
|
|
106
|
+
* g ch
|
|
107
|
+
* ï ii
|
|
108
|
+
* t d
|
|
109
|
+
* u ij
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* <!--- cspell:ignore gebiesd gebiest -->
|
|
113
|
+
*/
|
|
114
|
+
replace?: string | string[];
|
|
115
|
+
/** The costs to apply when using the hunspell settings */
|
|
116
|
+
costs?: HunspellCosts;
|
|
117
|
+
}
|
|
118
|
+
export interface HunspellInformation {
|
|
119
|
+
/**
|
|
120
|
+
* Selected Hunspell AFF content.
|
|
121
|
+
* The content must be UTF-8
|
|
122
|
+
*
|
|
123
|
+
* Sections:
|
|
124
|
+
* - TRY
|
|
125
|
+
* - MAP
|
|
126
|
+
* - REP
|
|
127
|
+
* - KEY
|
|
128
|
+
* - ICONV
|
|
129
|
+
* - OCONV
|
|
130
|
+
*
|
|
131
|
+
* Example:
|
|
132
|
+
* ```hunspell
|
|
133
|
+
* # Comment
|
|
134
|
+
* TRY aeistlunkodmrvpgjhäõbüoöfcwzxðqþ`
|
|
135
|
+
* MAP aàâäAÀÂÄ
|
|
136
|
+
* MAP eéèêëEÉÈÊË
|
|
137
|
+
* MAP iîïyIÎÏY
|
|
138
|
+
* MAP oôöOÔÖ
|
|
139
|
+
* MAP (IJ)(IJ)
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
aff: HunspellAffContent;
|
|
143
|
+
/** The costs to apply when using the hunspell settings */
|
|
144
|
+
costs?: HunspellCosts;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Selected Hunspell AFF content.
|
|
148
|
+
* The content must be UTF-8
|
|
149
|
+
*
|
|
150
|
+
* Sections:
|
|
151
|
+
* - TRY
|
|
152
|
+
* - NO-TRY
|
|
153
|
+
* - MAP
|
|
154
|
+
* - REP
|
|
155
|
+
* - KEY
|
|
156
|
+
* - ICONV
|
|
157
|
+
* - OCONV
|
|
158
|
+
*
|
|
159
|
+
* Example:
|
|
160
|
+
* ```hunspell
|
|
161
|
+
* # Comment
|
|
162
|
+
* TRY aeistlunkodmrvpgjhäõbüoöfcwzxðqþ`
|
|
163
|
+
* NO-TRY -0123456789 # Discourage adding numbers and dashes.
|
|
164
|
+
* MAP aàâäAÀÂÄ
|
|
165
|
+
* MAP eéèêëEÉÈÊË
|
|
166
|
+
* MAP iîïyIÎÏY
|
|
167
|
+
* MAP oôöOÔÖ
|
|
168
|
+
* MAP (IJ)(IJ)
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
declare type HunspellAffContent = string;
|
|
172
|
+
interface HunspellCosts {
|
|
173
|
+
/**
|
|
174
|
+
* The cost of inserting / deleting / or swapping any `tryChars`
|
|
175
|
+
* @default 95
|
|
176
|
+
*/
|
|
177
|
+
tryCharCost?: number;
|
|
178
|
+
/**
|
|
179
|
+
* The extra cost incurred for changing the first letter of a word.
|
|
180
|
+
* This value should be less than `100 - tryCharCost`.
|
|
181
|
+
* @default 4
|
|
182
|
+
*/
|
|
183
|
+
firstLetterPenalty?: number;
|
|
184
|
+
/**
|
|
185
|
+
* The cost of replacing or swapping any adjacent keyboard characters.
|
|
186
|
+
*
|
|
187
|
+
* This should be slightly cheaper than `tryCharCost`.
|
|
188
|
+
* @default 94
|
|
189
|
+
*/
|
|
190
|
+
keyboardCost?: number;
|
|
191
|
+
/**
|
|
192
|
+
* mapSet replacement cost is the cost to substitute one character with another from
|
|
193
|
+
* the same set.
|
|
194
|
+
*
|
|
195
|
+
* Map characters are considered very similar to each other and are often
|
|
196
|
+
* the cause of simple mistakes.
|
|
197
|
+
*
|
|
198
|
+
* @default 25
|
|
199
|
+
*/
|
|
200
|
+
mapCost?: number;
|
|
201
|
+
/**
|
|
202
|
+
* The cost to convert between convert pairs.
|
|
203
|
+
*
|
|
204
|
+
* The value should be slightly higher than the mapCost.
|
|
205
|
+
*
|
|
206
|
+
* @default 30
|
|
207
|
+
*/
|
|
208
|
+
ioConvertCost?: number;
|
|
209
|
+
/**
|
|
210
|
+
* The cost to substitute pairs found in the replace settings.
|
|
211
|
+
*
|
|
212
|
+
* @default 75
|
|
213
|
+
*/
|
|
214
|
+
replaceCosts?: number;
|
|
215
|
+
}
|
|
216
|
+
export {};
|
|
217
|
+
//# sourceMappingURL=DictionaryInformation.d.ts.map
|
package/dist/configFields.js
CHANGED
|
@@ -12,6 +12,8 @@ exports.ConfigFields = {
|
|
|
12
12
|
enabledLanguageIds: 'enabledLanguageIds',
|
|
13
13
|
enableFiletypes: 'enableFiletypes',
|
|
14
14
|
enableGlobDot: 'enableGlobDot',
|
|
15
|
+
failFast: 'failFast',
|
|
16
|
+
features: 'features',
|
|
15
17
|
files: 'files',
|
|
16
18
|
flagWords: 'flagWords',
|
|
17
19
|
gitignoreRoot: 'gitignoreRoot',
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These are experimental features and are subject to change or removal without notice.
|
|
3
|
+
*/
|
|
4
|
+
export interface FeaturesExperimental {
|
|
5
|
+
/**
|
|
6
|
+
* Enable/disable using weighted suggestions.
|
|
7
|
+
*/
|
|
8
|
+
'weighted-suggestions': FeatureEnableOnly;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* These are the current set of active features
|
|
12
|
+
*/
|
|
13
|
+
export interface FeaturesActive {
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* These are feature settings that have been deprecated or moved elsewhere they will have no
|
|
17
|
+
* effect on the code but are here to prevent schema errors. The will get cleaned out on major versions.
|
|
18
|
+
*/
|
|
19
|
+
export interface FeaturesDeprecated {
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Features are behaviors or settings that can be explicitly configured.
|
|
23
|
+
*/
|
|
24
|
+
export interface Features extends Partial<FeaturesActive>, Partial<FeaturesDeprecated>, Partial<FeaturesExperimental> {
|
|
25
|
+
}
|
|
26
|
+
export declare type Feature = FeatureEnableOnly | FeatureWithConfiguration;
|
|
27
|
+
export declare type FeatureEnableOnly = boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Feature Configuration.
|
|
30
|
+
*/
|
|
31
|
+
export interface FeatureWithConfiguration {
|
|
32
|
+
enable: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare type FeatureNamesKnown = keyof Features;
|
|
35
|
+
export declare type FeatureNamesExperimental = keyof FeaturesExperimental;
|
|
36
|
+
export declare type FeatureNamesActive = keyof FeaturesActive;
|
|
37
|
+
export declare type FeatureNamesDeprecated = keyof FeaturesDeprecated;
|
|
38
|
+
//# sourceMappingURL=features.d.ts.map
|
package/dist/features.js
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,7 @@ export { ConfigFields } from './configFields';
|
|
|
2
2
|
export type { CSpellUserSettingsFields } from './configFields';
|
|
3
3
|
export * from './CSpellReporter';
|
|
4
4
|
export * from './CSpellSettingsDef';
|
|
5
|
+
export type { SuggestionCostMapDef, SuggestionCostsDefs } from './suggestionCostsDef';
|
|
5
6
|
export type { TextDocumentOffset, TextOffset } from './TextOffset';
|
|
7
|
+
export type { Features, Feature } from './features';
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A WeightedMapDef enables setting weights for edits between related characters and substrings.
|
|
3
|
+
*
|
|
4
|
+
* Multiple groups can be defined using a `|`.
|
|
5
|
+
* A multi-character substring is defined using `()`.
|
|
6
|
+
*
|
|
7
|
+
* For example, in some languages, some letters sound alike.
|
|
8
|
+
*
|
|
9
|
+
* ```yaml
|
|
10
|
+
* map: 'sc(sh)(sch)(ss)|t(tt)' # two groups.
|
|
11
|
+
* replace: 50 # Make it 1/2 the cost of a normal edit to replace a `t` with `tt`.
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The following could be used to make inserting, removing, or replacing vowels cheaper.
|
|
15
|
+
* ```yaml
|
|
16
|
+
* map: 'aeiouy'
|
|
17
|
+
* insDel: 50 # Make it is cheaper to insert or delete a vowel.
|
|
18
|
+
* replace: 45 # It is even cheaper to replace one with another.
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Note: the default edit distance is 100.
|
|
22
|
+
*/
|
|
23
|
+
export declare type SuggestionCostMapDef = CostMapDefReplace | CostMapDefInsDel | CostMapDefSwap;
|
|
24
|
+
export declare type SuggestionCostsDefs = SuggestionCostMapDef[];
|
|
25
|
+
interface CostMapDefBase {
|
|
26
|
+
/**
|
|
27
|
+
* The set of substrings to map, these are generally single character strings.
|
|
28
|
+
*
|
|
29
|
+
* Multiple sets can be defined by using a `|` to separate them.
|
|
30
|
+
*
|
|
31
|
+
* Example: `"eéê|aåá"` contains two different sets.
|
|
32
|
+
*
|
|
33
|
+
* To add a multi-character substring use `()`.
|
|
34
|
+
*
|
|
35
|
+
* Example: `"f(ph)(gh)"` results in the following set: `f`, `ph`, `gh`.
|
|
36
|
+
*
|
|
37
|
+
* - To match the beginning of a word, use `^`: `"(^I)""`.
|
|
38
|
+
* - To match the end of a word, use `$`: `"(e$)(ing$)"`.
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
map: string;
|
|
42
|
+
/** The cost to insert/delete one of the substrings in the map. Note: insert/delete costs are symmetrical. */
|
|
43
|
+
insDel?: number;
|
|
44
|
+
/**
|
|
45
|
+
* The cost to replace of of the substrings in the map with another substring in the map.
|
|
46
|
+
* Example: Map['a', 'i']
|
|
47
|
+
* This would be the cost to substitute `a` with `i`: Like `bat` to `bit` or the reverse.
|
|
48
|
+
*/
|
|
49
|
+
replace?: number;
|
|
50
|
+
/**
|
|
51
|
+
* The cost to swap two adjacent substrings found in the map.
|
|
52
|
+
* Example: Map['e', 'i']
|
|
53
|
+
* This represents the cost to change `ei` to `ie` or the reverse.
|
|
54
|
+
*/
|
|
55
|
+
swap?: number;
|
|
56
|
+
/**
|
|
57
|
+
* A description to describe the purpose of the map.
|
|
58
|
+
*/
|
|
59
|
+
description?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Add a penalty to the final cost.
|
|
62
|
+
* This is used to discourage certain suggestions.
|
|
63
|
+
*
|
|
64
|
+
* Example:
|
|
65
|
+
* ```yaml
|
|
66
|
+
* # Match adding/removing `-` to the end of a word.
|
|
67
|
+
* map: "$(-$)"
|
|
68
|
+
* replace: 50
|
|
69
|
+
* penalty: 100
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* This makes adding a `-` to the end of a word more expensive.
|
|
73
|
+
*
|
|
74
|
+
* Think of it as taking the toll way for speed but getting the bill later.
|
|
75
|
+
*/
|
|
76
|
+
penalty?: number;
|
|
77
|
+
}
|
|
78
|
+
export interface CostMapDefReplace extends CostMapDefBase {
|
|
79
|
+
replace: number;
|
|
80
|
+
}
|
|
81
|
+
export interface CostMapDefInsDel extends CostMapDefBase {
|
|
82
|
+
insDel: number;
|
|
83
|
+
}
|
|
84
|
+
export interface CostMapDefSwap extends CostMapDefBase {
|
|
85
|
+
swap: number;
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=suggestionCostsDef.d.ts.map
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "5.
|
|
6
|
+
"version": "5.17.0-alpha.0",
|
|
7
7
|
"description": "Types for cspell and cspell-lib",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"typings": "dist/index.d.ts",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"build": "npm run compile && npm run build-schema",
|
|
19
19
|
"build-dev": "tsc -p tsconfig.dev.json",
|
|
20
20
|
"build-schema": "ts-json-schema-generator --no-top-ref --path src/CSpellSettingsDef.ts --type CSpellSettings --validation-keywords markdownDescription --validation-keywords scope --validation-keywords deprecated --validation-keywords deprecationMessage -o ./cspell.schema.json && cp ./cspell.schema.json ../..",
|
|
21
|
-
"build-docs": "typedoc --out ../../docs/types/cspell-types src/index.ts",
|
|
21
|
+
"build-docs": "rimraf ../../docs/types/cspell-types && typedoc --out ../../docs/types/cspell-types src/index.ts",
|
|
22
|
+
"test-build-docs": "typedoc --out ./temp/docs src/index.ts",
|
|
22
23
|
"clean-build": "npm run clean && npm run build",
|
|
23
24
|
"compile": "tsc -p .",
|
|
24
25
|
"test-schema": "ajv -s ./cspell.schema.json -d \"cspell.test.{json,yaml}\" -c ./ajv.config.js",
|
|
@@ -52,9 +53,9 @@
|
|
|
52
53
|
"jest": "^27.4.7",
|
|
53
54
|
"rimraf": "^3.0.2",
|
|
54
55
|
"ts-json-schema-generator": "^0.97.0",
|
|
55
|
-
"typedoc": "
|
|
56
|
-
"typedoc-plugin-markdown": "^3.11.
|
|
57
|
-
"typescript": "^4.5.
|
|
56
|
+
"typedoc": "0.22.11",
|
|
57
|
+
"typedoc-plugin-markdown": "^3.11.12",
|
|
58
|
+
"typescript": "^4.5.5"
|
|
58
59
|
},
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "d884218703cac72186fd69e8ba1e9eb78558c7ca"
|
|
60
61
|
}
|