@cspell/cspell-types 5.15.2 → 5.15.3

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.
@@ -30,6 +30,96 @@
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`.",
46
+ "type": "string"
47
+ },
48
+ "replace": {
49
+ "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.",
50
+ "type": "number"
51
+ },
52
+ "swap": {
53
+ "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.",
54
+ "type": "number"
55
+ }
56
+ },
57
+ "required": [
58
+ "insDel",
59
+ "map"
60
+ ],
61
+ "type": "object"
62
+ },
63
+ "CostMapDefReplace": {
64
+ "additionalProperties": false,
65
+ "properties": {
66
+ "description": {
67
+ "description": "A description to describe the purpose of the map.",
68
+ "type": "string"
69
+ },
70
+ "insDel": {
71
+ "description": "The cost to insert/delete one of the substrings in the map. Note: insert/delete costs are symmetrical.",
72
+ "type": "number"
73
+ },
74
+ "map": {
75
+ "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`.",
76
+ "type": "string"
77
+ },
78
+ "replace": {
79
+ "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.",
80
+ "type": "number"
81
+ },
82
+ "swap": {
83
+ "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.",
84
+ "type": "number"
85
+ }
86
+ },
87
+ "required": [
88
+ "map",
89
+ "replace"
90
+ ],
91
+ "type": "object"
92
+ },
93
+ "CostMapDefSwap": {
94
+ "additionalProperties": false,
95
+ "properties": {
96
+ "description": {
97
+ "description": "A description to describe the purpose of the map.",
98
+ "type": "string"
99
+ },
100
+ "insDel": {
101
+ "description": "The cost to insert/delete one of the substrings in the map. Note: insert/delete costs are symmetrical.",
102
+ "type": "number"
103
+ },
104
+ "map": {
105
+ "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`.",
106
+ "type": "string"
107
+ },
108
+ "replace": {
109
+ "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.",
110
+ "type": "number"
111
+ },
112
+ "swap": {
113
+ "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.",
114
+ "type": "number"
115
+ }
116
+ },
117
+ "required": [
118
+ "map",
119
+ "swap"
120
+ ],
121
+ "type": "object"
122
+ },
33
123
  "CustomDictionaryPath": {
34
124
  "description": "A File System Path to a dictionary file.",
35
125
  "pattern": "^.*\\.txt$",
@@ -85,6 +175,10 @@
85
175
  "$ref": "#/definitions/ReplaceMap",
86
176
  "description": "Replacement pairs."
87
177
  },
178
+ "suggestionEditCosts": {
179
+ "$ref": "#/definitions/SuggestionCostsDefs",
180
+ "description": "Used in making suggestions. The lower the value, the more likely the suggestion will be near the top of the suggestion list.\n\nAdded with `v5.16.0`."
181
+ },
88
182
  "type": {
89
183
  "$ref": "#/definitions/DictionaryFileTypes",
90
184
  "default": "S",
@@ -143,6 +237,10 @@
143
237
  ],
144
238
  "description": "Defines the scope for when words will be added to the dictionary. Scope values: `user`, `workspace`, `folder`."
145
239
  },
240
+ "suggestionEditCosts": {
241
+ "$ref": "#/definitions/SuggestionCostsDefs",
242
+ "description": "Used in making suggestions. The lower the value, the more likely the suggestion will be near the top of the suggestion list.\n\nAdded with `v5.16.0`."
243
+ },
146
244
  "type": {
147
245
  "$ref": "#/definitions/DictionaryFileTypes",
148
246
  "default": "S",
@@ -183,6 +281,10 @@
183
281
  "$ref": "#/definitions/ReplaceMap",
184
282
  "description": "Replacement pairs."
185
283
  },
284
+ "suggestionEditCosts": {
285
+ "$ref": "#/definitions/SuggestionCostsDefs",
286
+ "description": "Used in making suggestions. The lower the value, the more likely the suggestion will be near the top of the suggestion list.\n\nAdded with `v5.16.0`."
287
+ },
186
288
  "type": {
187
289
  "$ref": "#/definitions/DictionaryFileTypes",
188
290
  "default": "S",
@@ -242,6 +344,20 @@
242
344
  "$ref": "#/definitions/FsPath",
243
345
  "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
346
  },
347
+ "FeatureEnableOnly": {
348
+ "type": "boolean"
349
+ },
350
+ "Features": {
351
+ "additionalProperties": false,
352
+ "description": "Features are behaviors or settings that can be explicitly configured.",
353
+ "properties": {
354
+ "weighted-suggestions": {
355
+ "$ref": "#/definitions/FeatureEnableOnly",
356
+ "description": "Enable/disable using weighted suggestions."
357
+ }
358
+ },
359
+ "type": "object"
360
+ },
245
361
  "FsPath": {
246
362
  "description": "A File System Path. Relative paths are relative to the configuration file.",
247
363
  "type": "string"
@@ -742,6 +858,26 @@
742
858
  "description": "Simple Glob string, the root will be globRoot.",
743
859
  "type": "string"
744
860
  },
861
+ "SuggestionCostMapDef": {
862
+ "anyOf": [
863
+ {
864
+ "$ref": "#/definitions/CostMapDefReplace"
865
+ },
866
+ {
867
+ "$ref": "#/definitions/CostMapDefInsDel"
868
+ },
869
+ {
870
+ "$ref": "#/definitions/CostMapDefSwap"
871
+ }
872
+ ],
873
+ "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```ts { 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. ```ts { 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."
874
+ },
875
+ "SuggestionCostsDefs": {
876
+ "items": {
877
+ "$ref": "#/definitions/SuggestionCostMapDef"
878
+ },
879
+ "type": "array"
880
+ },
745
881
  "Version": {
746
882
  "anyOf": [
747
883
  {
@@ -828,6 +964,10 @@
828
964
  },
829
965
  "type": "array"
830
966
  },
967
+ "features": {
968
+ "$ref": "#/definitions/Features",
969
+ "description": "Configure CSpell features.\n\n- Added with `v5.16.0`."
970
+ },
831
971
  "files": {
832
972
  "description": "Glob patterns of files to be checked. Glob patterns are relative to the `globRoot` of the configuration file that defines them.",
833
973
  "items": {
@@ -1,3 +1,5 @@
1
+ import { Features } from './features';
2
+ import type { SuggestionCostsDefs } from './suggestionCostsDef';
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. */
@@ -377,6 +385,13 @@ export interface DictionaryDefinitionBase {
377
385
  * @default "S"
378
386
  */
379
387
  type?: DictionaryFileTypes;
388
+ /**
389
+ * Used in making suggestions. The lower the value, the more likely the suggestion
390
+ * will be near the top of the suggestion list.
391
+ *
392
+ * Added with `v5.16.0`.
393
+ */
394
+ suggestionEditCosts?: SuggestionCostsDefs;
380
395
  }
381
396
  export interface DictionaryDefinitionPreferred extends DictionaryDefinitionBase {
382
397
  /** Path to the file. */
@@ -12,6 +12,7 @@ exports.ConfigFields = {
12
12
  enabledLanguageIds: 'enabledLanguageIds',
13
13
  enableFiletypes: 'enableFiletypes',
14
14
  enableGlobDot: 'enableGlobDot',
15
+ features: 'features',
15
16
  files: 'files',
16
17
  flagWords: 'flagWords',
17
18
  gitignoreRoot: 'gitignoreRoot',
@@ -0,0 +1,38 @@
1
+ /**
2
+ * These are experimental features and are subject to change or removal.
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
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-empty-interface */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=features.js.map
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,71 @@
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
+ * ```ts
10
+ * {
11
+ * map: 'sc(sh)(sch)(ss)|t(tt)', // two groups.
12
+ * replace: 50, // Make it 1/2 the cost of a normal edit to replace a `t` with `tt`.
13
+ * }
14
+ * ```
15
+ *
16
+ * The following could be used to make inserting, removing, or replacing vowels cheaper.
17
+ * ```ts
18
+ * {
19
+ * map: 'aeiouy', //.
20
+ * insDel: 50, // Make it is cheaper to insert or delete a vowel.
21
+ * replace: 45, // It is even cheaper to replace one with another.
22
+ * }
23
+ * ```
24
+ *
25
+ * Note: the default edit distance is 100.
26
+ */
27
+ export declare type SuggestionCostMapDef = CostMapDefReplace | CostMapDefInsDel | CostMapDefSwap;
28
+ export declare type SuggestionCostsDefs = SuggestionCostMapDef[];
29
+ interface CostMapDefBase {
30
+ /**
31
+ * The set of substrings to map, these are generally single character strings.
32
+ *
33
+ * Multiple sets can be defined by using a `|` to separate them.
34
+ *
35
+ * Example: `"eéê|aåá"` contains two different sets.
36
+ *
37
+ * To add a multi-character substring use `()`.
38
+ *
39
+ * Example: `"f(ph)(gh)"` results in the following set: `f`, `ph`, `gh`.
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
+ export interface CostMapDefReplace extends CostMapDefBase {
62
+ replace: number;
63
+ }
64
+ export interface CostMapDefInsDel extends CostMapDefBase {
65
+ insDel: number;
66
+ }
67
+ export interface CostMapDefSwap extends CostMapDefBase {
68
+ swap: number;
69
+ }
70
+ export {};
71
+ //# sourceMappingURL=suggestionCostsDef.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=suggestionCostsDef.js.map
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "5.15.2",
6
+ "version": "5.15.3",
7
7
  "description": "Types for cspell and cspell-lib",
8
8
  "main": "dist/index.js",
9
9
  "typings": "dist/index.d.ts",
@@ -19,6 +19,7 @@
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
21
  "build-docs": "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": "^0.22.10",
56
- "typedoc-plugin-markdown": "^3.11.11",
56
+ "typedoc": "0.22.11",
57
+ "typedoc-plugin-markdown": "^3.11.12",
57
58
  "typescript": "^4.5.4"
58
59
  },
59
- "gitHead": "b047b5458980010a8f3ab31c6dc9434e0e782d5e"
60
+ "gitHead": "8a7c55b7d0b340d3c4e964ba91390a405f2cda2d"
60
61
  }