@cspell/cspell-types 9.6.4 → 9.8.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 +114 -0
- package/dist/Parser/index.d.mts +2 -129
- package/dist/Parser/index.d.ts +2 -129
- package/dist/Parser/index.mjs +1 -1
- package/dist/index-B8xFbW_T.d.mts +176 -0
- package/dist/index-BaCVS8dY.d.ts +176 -0
- package/dist/index.d.mts +76 -38
- package/dist/index.d.ts +76 -38
- package/dist/index.js +117 -5
- package/dist/index.mjs +116 -5
- package/package.json +2 -2
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
//#region src/Parser/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A SourceMap is used to map or transform the location of a piece of text back to its original offsets.
|
|
4
|
+
* This is necessary in order to report the correct location of a spelling issue.
|
|
5
|
+
* An empty source map indicates that it was a 1:1 transformation.
|
|
6
|
+
*
|
|
7
|
+
* Non-1:1 transformations are considered to be a single segment and cannot be split.
|
|
8
|
+
*
|
|
9
|
+
* A partial index into a non-linear segment will get mapped to the start of the segment.
|
|
10
|
+
*
|
|
11
|
+
* To signal a non-1:1 transformation a 0,0 pair can be used in the source map. This indicates that the
|
|
12
|
+
* following segment is a non-linear transformation and should not be split.
|
|
13
|
+
*
|
|
14
|
+
* This is important when multiple transformations have been applied to the same text, and the source map
|
|
15
|
+
* is being used to map back to the original text.
|
|
16
|
+
*
|
|
17
|
+
* For example: `\u00e9` might be transformed to `é` in one transformation and then to HTML entity `é`.
|
|
18
|
+
* The resulting sourceMap would be `[..., 0, 0, 6, 6, ...]` to indicate that the 6 character segment should
|
|
19
|
+
* not be split when mapping back to the original text.
|
|
20
|
+
*
|
|
21
|
+
* The values in a source map are number pairs (even, odd) relative to the beginning of each
|
|
22
|
+
* string segment.
|
|
23
|
+
* - even - span length in the source text
|
|
24
|
+
* - odd - span length in the transformed text
|
|
25
|
+
*
|
|
26
|
+
* Offsets start at 0
|
|
27
|
+
*
|
|
28
|
+
* Example:
|
|
29
|
+
*
|
|
30
|
+
* - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
|
|
31
|
+
* - Transformed text: `Grand Café Bjørvika`
|
|
32
|
+
* - Map: [9, 9, 6, 1, 3, 3, 6, 1, 5, 5]
|
|
33
|
+
*
|
|
34
|
+
* | offset | span | original | offset | span | transformed |
|
|
35
|
+
* | ------ | ---- | ----------- | ------ | ---- | ----------- |
|
|
36
|
+
* | 0-9 | 9 | `Grand Caf` | 0-9 | 9 | `Grand Caf` |
|
|
37
|
+
* | 9-15 | 6 | `\u00e9` | 9-10 | 1 | `é` |
|
|
38
|
+
* | 15-18 | 3 | ` Bj` | 10-13 | 3 | ` Bj` |
|
|
39
|
+
* | 18-24 | 6 | `\u00f8` | 13-14 | 1 | `ø` |
|
|
40
|
+
* | 24-29 | 5 | `rvika` | 14-19 | 5 | `rvika` |
|
|
41
|
+
*
|
|
42
|
+
* Note: The trailing 5,5 is not necessary since it is a 1:1 mapping, but it is included for clarity.
|
|
43
|
+
*
|
|
44
|
+
* <!--- cspell:ignore Bjørvika rvika --->
|
|
45
|
+
*/
|
|
46
|
+
type SourceMap = number[];
|
|
47
|
+
/**
|
|
48
|
+
* A range of text in a document.
|
|
49
|
+
* The range is inclusive of the start and exclusive of the end.
|
|
50
|
+
*/
|
|
51
|
+
type Range = readonly [start: number, end: number];
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/Parser/Mapped.d.ts
|
|
54
|
+
interface Mapped {
|
|
55
|
+
/**
|
|
56
|
+
* The absolute start and end offset of the text in the source.
|
|
57
|
+
*/
|
|
58
|
+
range: Range;
|
|
59
|
+
/**
|
|
60
|
+
* `(i, j)` number pairs where
|
|
61
|
+
* - `i` is the offset in the source relative to the start of the range
|
|
62
|
+
* - `j` is the offset in the transformed destination
|
|
63
|
+
*
|
|
64
|
+
* Example:
|
|
65
|
+
* - source text = `"caf\xe9"`
|
|
66
|
+
* - mapped text = `"café"`
|
|
67
|
+
* - map = `[3, 3, 4, 1]`
|
|
68
|
+
*
|
|
69
|
+
* See: {@link SourceMap}
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
map?: SourceMap | undefined;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/Parser/parser.d.ts
|
|
76
|
+
type ParserOptions = Record<string, unknown>;
|
|
77
|
+
type ParserName = string;
|
|
78
|
+
interface Parser {
|
|
79
|
+
/** Name of parser */
|
|
80
|
+
readonly name: ParserName;
|
|
81
|
+
/**
|
|
82
|
+
* Parse Method
|
|
83
|
+
* @param content - full content of the file
|
|
84
|
+
* @param filename - filename
|
|
85
|
+
*/
|
|
86
|
+
parse(content: string, filename: string): ParseResult;
|
|
87
|
+
}
|
|
88
|
+
interface ParseResult {
|
|
89
|
+
readonly content: string;
|
|
90
|
+
readonly filename: string;
|
|
91
|
+
readonly parsedTexts: Iterable<ParsedText>;
|
|
92
|
+
}
|
|
93
|
+
interface ParsedText extends Readonly<Mapped> {
|
|
94
|
+
/**
|
|
95
|
+
* The text extracted and possibly transformed
|
|
96
|
+
*/
|
|
97
|
+
readonly text: string;
|
|
98
|
+
/**
|
|
99
|
+
* The raw text before it has been transformed
|
|
100
|
+
*/
|
|
101
|
+
readonly rawText?: string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* The Scope annotation for a segment of text.
|
|
104
|
+
* Used by the spell checker to apply spell checking options
|
|
105
|
+
* based upon the value of the scope.
|
|
106
|
+
*/
|
|
107
|
+
readonly scope?: Scope | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Used to delegate parsing the contents of `text` to another parser.
|
|
110
|
+
*
|
|
111
|
+
*/
|
|
112
|
+
readonly delegate?: DelegateInfo | undefined;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* DelegateInfo is used by a parser to delegate parsing a subsection of a document to
|
|
116
|
+
* another parser. The following information is used by the spell checker to match
|
|
117
|
+
* the parser.
|
|
118
|
+
*/
|
|
119
|
+
interface DelegateInfo {
|
|
120
|
+
/**
|
|
121
|
+
* Proposed virtual file name including the extension.
|
|
122
|
+
* Format: `./${source_filename}/${block_number}.${ext}
|
|
123
|
+
* Example: `./README.md/1.js`
|
|
124
|
+
*/
|
|
125
|
+
readonly filename: string;
|
|
126
|
+
/**
|
|
127
|
+
* The filename of the origin of the virtual file block.
|
|
128
|
+
* Example: `./README.md`
|
|
129
|
+
*/
|
|
130
|
+
readonly originFilename: string;
|
|
131
|
+
/**
|
|
132
|
+
* Proposed file extension
|
|
133
|
+
* Example: `.js`
|
|
134
|
+
*/
|
|
135
|
+
readonly extension: string;
|
|
136
|
+
/**
|
|
137
|
+
* Filetype to use
|
|
138
|
+
* Example: `javascript`
|
|
139
|
+
*/
|
|
140
|
+
readonly fileType?: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Scope - chain of scope going from local to global
|
|
144
|
+
*
|
|
145
|
+
* Example:
|
|
146
|
+
* ```
|
|
147
|
+
* `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
interface ScopeChain {
|
|
151
|
+
readonly value: string;
|
|
152
|
+
readonly parent?: ScopeChain | undefined;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* A string representing a scope chain separated by spaces
|
|
156
|
+
*
|
|
157
|
+
* Example: `comment.block.documentation.ts meta.interface.ts source.ts`
|
|
158
|
+
*/
|
|
159
|
+
type ScopeString = string;
|
|
160
|
+
type Scope = ScopeChain | ScopeString;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/Parser/TextMap.d.ts
|
|
163
|
+
type MappedText = Readonly<TransformedText>;
|
|
164
|
+
interface TransformedText extends Mapped {
|
|
165
|
+
/**
|
|
166
|
+
* Transformed text with an optional map.
|
|
167
|
+
*/
|
|
168
|
+
text: string;
|
|
169
|
+
/**
|
|
170
|
+
* The original text
|
|
171
|
+
*/
|
|
172
|
+
rawText?: string | undefined;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { Parser as a, Scope as c, Range as d, SourceMap as f, ParsedText as i, ScopeChain as l, DelegateInfo as n, ParserName as o, ParseResult as r, ParserOptions as s, MappedText as t, ScopeString as u };
|
|
176
|
+
//# sourceMappingURL=index-BaCVS8dY.d.ts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as Parser, d as Range, f as SourceMap, i as ParsedText, o as ParserName, r as ParseResult, s as ParserOptions, t as MappedText } from "./index-B8xFbW_T.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/cspell-vfs.d.ts
|
|
4
4
|
/**
|
|
@@ -6,7 +6,7 @@ import { ParseResult, ParsedText, Parser, ParserName, ParserOptions } from "./Pa
|
|
|
6
6
|
* This can be exported by a JavaScript based CSpell Configuration file.
|
|
7
7
|
* @hidden
|
|
8
8
|
*/
|
|
9
|
-
type CSpellVFSBinaryData = Uint8Array
|
|
9
|
+
type CSpellVFSBinaryData = Uint8Array<ArrayBuffer>;
|
|
10
10
|
/**
|
|
11
11
|
* Data content stored in a string for CSpellVFS file.
|
|
12
12
|
* It is often encoded (e.g. base64) binary data.
|
|
@@ -101,10 +101,10 @@ interface TextOffset {
|
|
|
101
101
|
/**
|
|
102
102
|
* Assumed to match `text.length` if the text has not been transformed.
|
|
103
103
|
*/
|
|
104
|
-
length?: number;
|
|
104
|
+
length?: number | undefined;
|
|
105
105
|
}
|
|
106
106
|
interface TextDocumentOffset extends TextOffset {
|
|
107
|
-
uri?: string;
|
|
107
|
+
uri?: string | undefined;
|
|
108
108
|
doc: string;
|
|
109
109
|
row: number;
|
|
110
110
|
col: number;
|
|
@@ -1122,6 +1122,63 @@ interface FeatureWithConfiguration {
|
|
|
1122
1122
|
enable: boolean;
|
|
1123
1123
|
}
|
|
1124
1124
|
//#endregion
|
|
1125
|
+
//#region src/Substitutions.d.ts
|
|
1126
|
+
/**
|
|
1127
|
+
* The ID for a substitution definition. This is used to reference the substitution definition in the substitutions array.
|
|
1128
|
+
* @since 9.7.0
|
|
1129
|
+
*/
|
|
1130
|
+
type SubstitutionID = string;
|
|
1131
|
+
/**
|
|
1132
|
+
* A substitution entry is a tuple of the form `[find, replacement]`. The find string is the string to find,
|
|
1133
|
+
* and the replacement string is the string to replace it with.
|
|
1134
|
+
*
|
|
1135
|
+
* - `find` - The string to find. This is the string that will be replaced in the text. Only an exact match will be replaced.
|
|
1136
|
+
* The find string is not treated as a regular expression.
|
|
1137
|
+
* - `replacement` - The string to replace the `find` string with. This is the string that will be used to replace the `find`
|
|
1138
|
+
* string in the text.
|
|
1139
|
+
*
|
|
1140
|
+
* @since 9.7.0
|
|
1141
|
+
*/
|
|
1142
|
+
type SubstitutionEntry = [find: string, replacement: string];
|
|
1143
|
+
/**
|
|
1144
|
+
* Allows for the definition of a substitution set. A substitution set is a collection of substitution
|
|
1145
|
+
* entries that can be applied to a document before spell checking. This is useful for converting html entities, url encodings,
|
|
1146
|
+
* or other transformations that may be necessary to get the correct text for spell checking.
|
|
1147
|
+
*
|
|
1148
|
+
* Substitutions are applied based upon the longest matching find string. If there are multiple matches of the same `find`,
|
|
1149
|
+
* the last one in the list is used. This allows for the overriding of substitutions. For example, if you have a substitution
|
|
1150
|
+
* for `&` to `and`, and then a substitution for `&` to `&`, the `&` substitution will be used for the string `&`,
|
|
1151
|
+
* and the `&` substitution will be used for the string `&`.
|
|
1152
|
+
*
|
|
1153
|
+
* @since 9.7.0
|
|
1154
|
+
*/
|
|
1155
|
+
interface SubstitutionDefinition {
|
|
1156
|
+
/**
|
|
1157
|
+
* The name of the substitution definition. This is used to reference the substitution definition in the substitutions array.
|
|
1158
|
+
*/
|
|
1159
|
+
name: SubstitutionID;
|
|
1160
|
+
/**
|
|
1161
|
+
* An optional description of the substitution definition. This is not used for anything, but can be useful for
|
|
1162
|
+
* documentation purposes.
|
|
1163
|
+
*/
|
|
1164
|
+
description?: string;
|
|
1165
|
+
/**
|
|
1166
|
+
* The entries for the substitution definition. This is a collection of substitution entries that can be applied to a
|
|
1167
|
+
* document before spell checking.
|
|
1168
|
+
*/
|
|
1169
|
+
entries: SubstitutionEntry[];
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* The set of available substitutions. This is a collection of substitution definitions that can be applied to a document
|
|
1173
|
+
* before spell checking.
|
|
1174
|
+
*/
|
|
1175
|
+
type SubstitutionDefinitions = SubstitutionDefinition[];
|
|
1176
|
+
/**
|
|
1177
|
+
* The set of substitutions to apply to a document before spell checking.
|
|
1178
|
+
* This is a collection of substitution entries that can be applied to a document before spell checking.
|
|
1179
|
+
*/
|
|
1180
|
+
type Substitutions = (SubstitutionEntry | SubstitutionID)[];
|
|
1181
|
+
//#endregion
|
|
1125
1182
|
//#region src/types.d.ts
|
|
1126
1183
|
type Serializable = number | string | boolean | null | object;
|
|
1127
1184
|
//#endregion
|
|
@@ -1659,6 +1716,16 @@ interface BaseSetting extends InlineDictionary, ExperimentalBaseSettings, Unknow
|
|
|
1659
1716
|
* ```
|
|
1660
1717
|
*/
|
|
1661
1718
|
patterns?: RegExpPatternDefinition[];
|
|
1719
|
+
/**
|
|
1720
|
+
* The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.
|
|
1721
|
+
* @since 9.7.0
|
|
1722
|
+
*/
|
|
1723
|
+
substitutionDefinitions?: SubstitutionDefinitions;
|
|
1724
|
+
/**
|
|
1725
|
+
* The set of substitutions to apply to a document before spell checking.
|
|
1726
|
+
* @since 9.7.0
|
|
1727
|
+
*/
|
|
1728
|
+
substitutions?: Substitutions;
|
|
1662
1729
|
}
|
|
1663
1730
|
interface LanguageSetting extends LanguageSettingFilterFields, BaseSetting {}
|
|
1664
1731
|
interface LanguageSettingFilterFields extends LanguageSettingFilterFieldsPreferred, LanguageSettingFilterFieldsDeprecated {}
|
|
@@ -1931,39 +1998,10 @@ declare const defaultCSpellSettings: {
|
|
|
1931
1998
|
//#region src/defineConfig.d.ts
|
|
1932
1999
|
declare function defineConfig(config: CSpellSettings): CSpellSettings;
|
|
1933
2000
|
//#endregion
|
|
1934
|
-
//#region src/
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
/**
|
|
1939
|
-
* `(i, j)` number pairs where
|
|
1940
|
-
* - `i` is the offset in the source
|
|
1941
|
-
* - `j` is the offset in the destination
|
|
1942
|
-
*
|
|
1943
|
-
* Example:
|
|
1944
|
-
* - source text = `"caf\xe9"`
|
|
1945
|
-
* - mapped text = `"café"`
|
|
1946
|
-
* - map = `[3, 3, 7, 4]`, which is equivalent to `[0, 0, 3, 3, 7, 4]`
|
|
1947
|
-
* where the `[0, 0]` is unnecessary.
|
|
1948
|
-
*
|
|
1949
|
-
*/
|
|
1950
|
-
map: number[];
|
|
1951
|
-
}
|
|
1952
|
-
interface TransformedText extends PartialOrUndefined<Mapped> {
|
|
1953
|
-
/**
|
|
1954
|
-
* Transformed text with an optional map.
|
|
1955
|
-
*/
|
|
1956
|
-
text: string;
|
|
1957
|
-
/**
|
|
1958
|
-
* The original text
|
|
1959
|
-
*/
|
|
1960
|
-
rawText?: string | undefined;
|
|
1961
|
-
/**
|
|
1962
|
-
* The start and end offset of the text in the document.
|
|
1963
|
-
*/
|
|
1964
|
-
range: Range;
|
|
1965
|
-
}
|
|
1966
|
-
type PartialOrUndefined<T> = { [P in keyof T]?: T[P] | undefined };
|
|
2001
|
+
//#region src/merge.d.ts
|
|
2002
|
+
declare function mergeConfig(settings: CSpellSettings[]): CSpellSettings;
|
|
2003
|
+
declare function mergeConfig(...settings: [CSpellSettings, ...CSpellSettings[]]): CSpellSettings;
|
|
2004
|
+
declare function mergeConfig(...settings: [CSpellSettings[], ...CSpellSettings[]]): CSpellSettings;
|
|
1967
2005
|
//#endregion
|
|
1968
|
-
export { type AdvancedCSpellSettings, type AdvancedCSpellSettingsWithSourceTrace, type BaseSetting, type CSpellPackageSettings, type CSpellReporter, type CSpellReporterEmitters, type CSpellReporterModule, type CSpellSettings, type CSpellSettingsWithSourceTrace, type CSpellUserSettings, type CSpellUserSettingsFields, type CSpellUserSettingsWithComments, type CSpellVFS, type CSpellVFSBinaryData, type CSpellVFSData, type CSpellVFSFile, type CSpellVFSFileEntry, type CSpellVFSFileUrl, type CSpellVFSTextData, 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 DictionaryDefinitionSimple, 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 FeaturesSupportedByReporter, 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, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, 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 ReportIssueOptions, 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 UnknownWordsChoices, type UnknownWordsConfiguration, type Version, type VersionLatest, type VersionLegacy, type WorkspaceTrustSettings, defaultCSpellSettings, defineConfig, unknownWordsChoices };
|
|
2006
|
+
export { type AdvancedCSpellSettings, type AdvancedCSpellSettingsWithSourceTrace, type BaseSetting, type CSpellPackageSettings, type CSpellReporter, type CSpellReporterEmitters, type CSpellReporterModule, type CSpellSettings, type CSpellSettingsWithSourceTrace, type CSpellUserSettings, type CSpellUserSettingsFields, type CSpellUserSettingsWithComments, type CSpellVFS, type CSpellVFSBinaryData, type CSpellVFSData, type CSpellVFSFile, type CSpellVFSFileEntry, type CSpellVFSFileUrl, type CSpellVFSTextData, 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 DictionaryDefinitionSimple, 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 FeaturesSupportedByReporter, 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, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, 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 Range, type RegExpPatternDefinition, type RegExpPatternList, type ReplaceEntry, type ReplaceMap, type ReportIssueOptions, type ReporterConfiguration, type ReporterSettings, type ReportingConfiguration, type ResultEmitter, type RunResult, type Settings, type SimpleGlob, type Source, type SourceMap, type SpellingErrorEmitter, type SubstitutionDefinition, type SubstitutionDefinitions, type SubstitutionEntry, type SubstitutionID, type Substitutions, type SuggestionCostMapDef, type SuggestionCostsDefs, type SuggestionsConfiguration, type TextDocumentOffset, type TextOffset, type TrustLevel, type UnknownWordsChoices, type UnknownWordsConfiguration, type Version, type VersionLatest, type VersionLegacy, type WorkspaceTrustSettings, defaultCSpellSettings, defineConfig, mergeConfig, unknownWordsChoices };
|
|
1969
2007
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as Parser, d as Range, f as SourceMap, i as ParsedText, o as ParserName, r as ParseResult, s as ParserOptions, t as MappedText } from "./index-BaCVS8dY.js";
|
|
2
2
|
|
|
3
3
|
//#region src/cspell-vfs.d.ts
|
|
4
4
|
/**
|
|
@@ -6,7 +6,7 @@ import { ParseResult, ParsedText, Parser, ParserName, ParserOptions } from "./Pa
|
|
|
6
6
|
* This can be exported by a JavaScript based CSpell Configuration file.
|
|
7
7
|
* @hidden
|
|
8
8
|
*/
|
|
9
|
-
type CSpellVFSBinaryData = Uint8Array
|
|
9
|
+
type CSpellVFSBinaryData = Uint8Array<ArrayBuffer>;
|
|
10
10
|
/**
|
|
11
11
|
* Data content stored in a string for CSpellVFS file.
|
|
12
12
|
* It is often encoded (e.g. base64) binary data.
|
|
@@ -101,10 +101,10 @@ interface TextOffset {
|
|
|
101
101
|
/**
|
|
102
102
|
* Assumed to match `text.length` if the text has not been transformed.
|
|
103
103
|
*/
|
|
104
|
-
length?: number;
|
|
104
|
+
length?: number | undefined;
|
|
105
105
|
}
|
|
106
106
|
interface TextDocumentOffset extends TextOffset {
|
|
107
|
-
uri?: string;
|
|
107
|
+
uri?: string | undefined;
|
|
108
108
|
doc: string;
|
|
109
109
|
row: number;
|
|
110
110
|
col: number;
|
|
@@ -1122,6 +1122,63 @@ interface FeatureWithConfiguration {
|
|
|
1122
1122
|
enable: boolean;
|
|
1123
1123
|
}
|
|
1124
1124
|
//#endregion
|
|
1125
|
+
//#region src/Substitutions.d.ts
|
|
1126
|
+
/**
|
|
1127
|
+
* The ID for a substitution definition. This is used to reference the substitution definition in the substitutions array.
|
|
1128
|
+
* @since 9.7.0
|
|
1129
|
+
*/
|
|
1130
|
+
type SubstitutionID = string;
|
|
1131
|
+
/**
|
|
1132
|
+
* A substitution entry is a tuple of the form `[find, replacement]`. The find string is the string to find,
|
|
1133
|
+
* and the replacement string is the string to replace it with.
|
|
1134
|
+
*
|
|
1135
|
+
* - `find` - The string to find. This is the string that will be replaced in the text. Only an exact match will be replaced.
|
|
1136
|
+
* The find string is not treated as a regular expression.
|
|
1137
|
+
* - `replacement` - The string to replace the `find` string with. This is the string that will be used to replace the `find`
|
|
1138
|
+
* string in the text.
|
|
1139
|
+
*
|
|
1140
|
+
* @since 9.7.0
|
|
1141
|
+
*/
|
|
1142
|
+
type SubstitutionEntry = [find: string, replacement: string];
|
|
1143
|
+
/**
|
|
1144
|
+
* Allows for the definition of a substitution set. A substitution set is a collection of substitution
|
|
1145
|
+
* entries that can be applied to a document before spell checking. This is useful for converting html entities, url encodings,
|
|
1146
|
+
* or other transformations that may be necessary to get the correct text for spell checking.
|
|
1147
|
+
*
|
|
1148
|
+
* Substitutions are applied based upon the longest matching find string. If there are multiple matches of the same `find`,
|
|
1149
|
+
* the last one in the list is used. This allows for the overriding of substitutions. For example, if you have a substitution
|
|
1150
|
+
* for `&` to `and`, and then a substitution for `&` to `&`, the `&` substitution will be used for the string `&`,
|
|
1151
|
+
* and the `&` substitution will be used for the string `&`.
|
|
1152
|
+
*
|
|
1153
|
+
* @since 9.7.0
|
|
1154
|
+
*/
|
|
1155
|
+
interface SubstitutionDefinition {
|
|
1156
|
+
/**
|
|
1157
|
+
* The name of the substitution definition. This is used to reference the substitution definition in the substitutions array.
|
|
1158
|
+
*/
|
|
1159
|
+
name: SubstitutionID;
|
|
1160
|
+
/**
|
|
1161
|
+
* An optional description of the substitution definition. This is not used for anything, but can be useful for
|
|
1162
|
+
* documentation purposes.
|
|
1163
|
+
*/
|
|
1164
|
+
description?: string;
|
|
1165
|
+
/**
|
|
1166
|
+
* The entries for the substitution definition. This is a collection of substitution entries that can be applied to a
|
|
1167
|
+
* document before spell checking.
|
|
1168
|
+
*/
|
|
1169
|
+
entries: SubstitutionEntry[];
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* The set of available substitutions. This is a collection of substitution definitions that can be applied to a document
|
|
1173
|
+
* before spell checking.
|
|
1174
|
+
*/
|
|
1175
|
+
type SubstitutionDefinitions = SubstitutionDefinition[];
|
|
1176
|
+
/**
|
|
1177
|
+
* The set of substitutions to apply to a document before spell checking.
|
|
1178
|
+
* This is a collection of substitution entries that can be applied to a document before spell checking.
|
|
1179
|
+
*/
|
|
1180
|
+
type Substitutions = (SubstitutionEntry | SubstitutionID)[];
|
|
1181
|
+
//#endregion
|
|
1125
1182
|
//#region src/types.d.ts
|
|
1126
1183
|
type Serializable = number | string | boolean | null | object;
|
|
1127
1184
|
//#endregion
|
|
@@ -1659,6 +1716,16 @@ interface BaseSetting extends InlineDictionary, ExperimentalBaseSettings, Unknow
|
|
|
1659
1716
|
* ```
|
|
1660
1717
|
*/
|
|
1661
1718
|
patterns?: RegExpPatternDefinition[];
|
|
1719
|
+
/**
|
|
1720
|
+
* The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.
|
|
1721
|
+
* @since 9.7.0
|
|
1722
|
+
*/
|
|
1723
|
+
substitutionDefinitions?: SubstitutionDefinitions;
|
|
1724
|
+
/**
|
|
1725
|
+
* The set of substitutions to apply to a document before spell checking.
|
|
1726
|
+
* @since 9.7.0
|
|
1727
|
+
*/
|
|
1728
|
+
substitutions?: Substitutions;
|
|
1662
1729
|
}
|
|
1663
1730
|
interface LanguageSetting extends LanguageSettingFilterFields, BaseSetting {}
|
|
1664
1731
|
interface LanguageSettingFilterFields extends LanguageSettingFilterFieldsPreferred, LanguageSettingFilterFieldsDeprecated {}
|
|
@@ -1931,39 +1998,10 @@ declare const defaultCSpellSettings: {
|
|
|
1931
1998
|
//#region src/defineConfig.d.ts
|
|
1932
1999
|
declare function defineConfig(config: CSpellSettings): CSpellSettings;
|
|
1933
2000
|
//#endregion
|
|
1934
|
-
//#region src/
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
/**
|
|
1939
|
-
* `(i, j)` number pairs where
|
|
1940
|
-
* - `i` is the offset in the source
|
|
1941
|
-
* - `j` is the offset in the destination
|
|
1942
|
-
*
|
|
1943
|
-
* Example:
|
|
1944
|
-
* - source text = `"caf\xe9"`
|
|
1945
|
-
* - mapped text = `"café"`
|
|
1946
|
-
* - map = `[3, 3, 7, 4]`, which is equivalent to `[0, 0, 3, 3, 7, 4]`
|
|
1947
|
-
* where the `[0, 0]` is unnecessary.
|
|
1948
|
-
*
|
|
1949
|
-
*/
|
|
1950
|
-
map: number[];
|
|
1951
|
-
}
|
|
1952
|
-
interface TransformedText extends PartialOrUndefined<Mapped> {
|
|
1953
|
-
/**
|
|
1954
|
-
* Transformed text with an optional map.
|
|
1955
|
-
*/
|
|
1956
|
-
text: string;
|
|
1957
|
-
/**
|
|
1958
|
-
* The original text
|
|
1959
|
-
*/
|
|
1960
|
-
rawText?: string | undefined;
|
|
1961
|
-
/**
|
|
1962
|
-
* The start and end offset of the text in the document.
|
|
1963
|
-
*/
|
|
1964
|
-
range: Range;
|
|
1965
|
-
}
|
|
1966
|
-
type PartialOrUndefined<T> = { [P in keyof T]?: T[P] | undefined };
|
|
2001
|
+
//#region src/merge.d.ts
|
|
2002
|
+
declare function mergeConfig(settings: CSpellSettings[]): CSpellSettings;
|
|
2003
|
+
declare function mergeConfig(...settings: [CSpellSettings, ...CSpellSettings[]]): CSpellSettings;
|
|
2004
|
+
declare function mergeConfig(...settings: [CSpellSettings[], ...CSpellSettings[]]): CSpellSettings;
|
|
1967
2005
|
//#endregion
|
|
1968
|
-
export { type AdvancedCSpellSettings, type AdvancedCSpellSettingsWithSourceTrace, type BaseSetting, type CSpellPackageSettings, type CSpellReporter, type CSpellReporterEmitters, type CSpellReporterModule, type CSpellSettings, type CSpellSettingsWithSourceTrace, type CSpellUserSettings, type CSpellUserSettingsFields, type CSpellUserSettingsWithComments, type CSpellVFS, type CSpellVFSBinaryData, type CSpellVFSData, type CSpellVFSFile, type CSpellVFSFileEntry, type CSpellVFSFileUrl, type CSpellVFSTextData, 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 DictionaryDefinitionSimple, 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 FeaturesSupportedByReporter, 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, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, 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 ReportIssueOptions, 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 UnknownWordsChoices, type UnknownWordsConfiguration, type Version, type VersionLatest, type VersionLegacy, type WorkspaceTrustSettings, defaultCSpellSettings, defineConfig, unknownWordsChoices };
|
|
2006
|
+
export { type AdvancedCSpellSettings, type AdvancedCSpellSettingsWithSourceTrace, type BaseSetting, type CSpellPackageSettings, type CSpellReporter, type CSpellReporterEmitters, type CSpellReporterModule, type CSpellSettings, type CSpellSettingsWithSourceTrace, type CSpellUserSettings, type CSpellUserSettingsFields, type CSpellUserSettingsWithComments, type CSpellVFS, type CSpellVFSBinaryData, type CSpellVFSData, type CSpellVFSFile, type CSpellVFSFileEntry, type CSpellVFSFileUrl, type CSpellVFSTextData, 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 DictionaryDefinitionSimple, 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 FeaturesSupportedByReporter, 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, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, 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 Range, type RegExpPatternDefinition, type RegExpPatternList, type ReplaceEntry, type ReplaceMap, type ReportIssueOptions, type ReporterConfiguration, type ReporterSettings, type ReportingConfiguration, type ResultEmitter, type RunResult, type Settings, type SimpleGlob, type Source, type SourceMap, type SpellingErrorEmitter, type SubstitutionDefinition, type SubstitutionDefinitions, type SubstitutionEntry, type SubstitutionID, type Substitutions, type SuggestionCostMapDef, type SuggestionCostsDefs, type SuggestionsConfiguration, type TextDocumentOffset, type TextOffset, type TrustLevel, type UnknownWordsChoices, type UnknownWordsConfiguration, type Version, type VersionLatest, type VersionLegacy, type WorkspaceTrustSettings, defaultCSpellSettings, defineConfig, mergeConfig, unknownWordsChoices };
|
|
1969
2007
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/configFields.ts
|
|
3
3
|
const ConfigFields = {
|
|
4
4
|
allowCompoundWords: "allowCompoundWords",
|
|
@@ -45,6 +45,8 @@ const ConfigFields = {
|
|
|
45
45
|
reporters: "reporters",
|
|
46
46
|
showStatus: "showStatus",
|
|
47
47
|
spellCheckDelayMs: "spellCheckDelayMs",
|
|
48
|
+
substitutionDefinitions: "substitutionDefinitions",
|
|
49
|
+
substitutions: "substitutions",
|
|
48
50
|
suggestionNumChanges: "suggestionNumChanges",
|
|
49
51
|
suggestionsTimeout: "suggestionsTimeout",
|
|
50
52
|
suggestWords: "suggestWords",
|
|
@@ -57,7 +59,6 @@ const ConfigFields = {
|
|
|
57
59
|
words: "words",
|
|
58
60
|
parser: "parser"
|
|
59
61
|
};
|
|
60
|
-
|
|
61
62
|
//#endregion
|
|
62
63
|
//#region src/CSpellReporter.ts
|
|
63
64
|
let IssueType = /* @__PURE__ */ function(IssueType) {
|
|
@@ -76,25 +77,136 @@ const unknownWordsChoices = {
|
|
|
76
77
|
ReportCommonTypos: "report-common-typos",
|
|
77
78
|
ReportFlagged: "report-flagged"
|
|
78
79
|
};
|
|
79
|
-
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/defaultConfigSettings.ts
|
|
82
82
|
const defaultCSpellSettings = {
|
|
83
83
|
ignoreRandomStrings: true,
|
|
84
84
|
minRandomLength: 40
|
|
85
85
|
};
|
|
86
|
-
|
|
87
86
|
//#endregion
|
|
88
87
|
//#region src/defineConfig.ts
|
|
89
88
|
function defineConfig(config) {
|
|
90
89
|
return config;
|
|
91
90
|
}
|
|
92
|
-
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/merge.ts
|
|
93
|
+
const mArr = mergeAppendArrays;
|
|
94
|
+
const mRec = mergeRecords;
|
|
95
|
+
const exKV = extractKeyValues;
|
|
96
|
+
const mergeDefinitionFunctions = {
|
|
97
|
+
$schema: (key) => recKV(key, void 0),
|
|
98
|
+
allowCompoundWords: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
99
|
+
cache: (key, settings) => recKV(key, mRec(exKV(key, settings))),
|
|
100
|
+
caseSensitive: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
101
|
+
description: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
102
|
+
dictionaries: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
103
|
+
dictionaryDefinitions: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
104
|
+
enabled: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
105
|
+
enabledFileTypes: (key, settings) => recKV(key, mRec(exKV(key, settings))),
|
|
106
|
+
enabledLanguageIds: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
107
|
+
enableFiletypes: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
108
|
+
enableGlobDot: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
109
|
+
engines: (key, settings) => recKV(key, mRec(exKV(key, settings))),
|
|
110
|
+
failFast: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
111
|
+
features: (key, settings) => recKV(key, mRec(exKV(key, settings))),
|
|
112
|
+
files: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
113
|
+
flagWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
114
|
+
gitignoreRoot: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
115
|
+
globRoot: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
116
|
+
id: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
117
|
+
ignorePaths: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
118
|
+
ignoreRandomStrings: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
119
|
+
ignoreRegExpList: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
120
|
+
ignoreWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
121
|
+
import: (key, settings) => recKV(key, mArr(exKV(key, settings).map(strArrToArr))),
|
|
122
|
+
includeRegExpList: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
123
|
+
language: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
124
|
+
languageId: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
125
|
+
languageSettings: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
126
|
+
loadDefaultConfiguration: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
127
|
+
maxDuplicateProblems: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
128
|
+
maxFileSize: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
129
|
+
maxNumberOfProblems: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
130
|
+
minRandomLength: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
131
|
+
minWordLength: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
132
|
+
name: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
133
|
+
noConfigSearch: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
134
|
+
noSuggestDictionaries: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
135
|
+
numSuggestions: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
136
|
+
overrides: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
137
|
+
parser: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
138
|
+
patterns: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
139
|
+
pnpFiles: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
140
|
+
readonly: (key, settings) => recKV(key, orValue(exKV(key, settings))),
|
|
141
|
+
reporters: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
142
|
+
showStatus: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
143
|
+
spellCheckDelayMs: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
144
|
+
substitutionDefinitions: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
145
|
+
substitutions: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
146
|
+
suggestionNumChanges: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
147
|
+
suggestionsTimeout: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
148
|
+
suggestWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
149
|
+
unknownWords: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
150
|
+
useGitignore: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
151
|
+
usePnP: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
152
|
+
userWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
|
|
153
|
+
validateDirectives: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
154
|
+
version: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
|
|
155
|
+
vfs: (key, settings) => recKV(key, mRec(exKV(key, settings))),
|
|
156
|
+
words: (key, settings) => recKV(key, mArr(exKV(key, settings)))
|
|
157
|
+
};
|
|
158
|
+
function makeMergeFn(key) {
|
|
159
|
+
const fn = mergeDefinitionFunctions[key];
|
|
160
|
+
return (settings) => fn(key, settings);
|
|
161
|
+
}
|
|
162
|
+
const mergeIndividualSettingsFns = Object.keys(mergeDefinitionFunctions).map((k) => makeMergeFn(k));
|
|
163
|
+
function mergeConfig(first, ...configs) {
|
|
164
|
+
const settings = [first, ...configs].flat();
|
|
165
|
+
if (settings.length === 1) return settings[0];
|
|
166
|
+
const result = Object.assign(Object.create(null), ...settings);
|
|
167
|
+
Object.assign(result, ...mergeIndividualSettingsFns.map((fn) => fn(settings)));
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
170
|
+
function orValue(values) {
|
|
171
|
+
let v = void 0;
|
|
172
|
+
for (const value of values) v ||= value;
|
|
173
|
+
return v;
|
|
174
|
+
}
|
|
175
|
+
function lastValue(values) {
|
|
176
|
+
for (let i = values.length - 1; i >= 0; i--) {
|
|
177
|
+
const value = values[i];
|
|
178
|
+
if (value !== void 0) return value;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function strArrToArr(value) {
|
|
182
|
+
return Array.isArray(value) ? value : [value];
|
|
183
|
+
}
|
|
184
|
+
function mergeAppendArrays(arrays) {
|
|
185
|
+
const values = arrays.filter((a) => !!a);
|
|
186
|
+
if (values.length === 1) return values[0];
|
|
187
|
+
const merged = values.flat();
|
|
188
|
+
return merged.length ? merged : void 0;
|
|
189
|
+
}
|
|
190
|
+
function mergeRecords(records) {
|
|
191
|
+
const values = records.filter((r) => !!r);
|
|
192
|
+
if (!values.length) return void 0;
|
|
193
|
+
if (values.length === 1) return values[0];
|
|
194
|
+
return Object.assign(Object.create(null), ...values);
|
|
195
|
+
}
|
|
196
|
+
function extractKeyValues(key, records) {
|
|
197
|
+
return records.filter((r) => !!r).map((r) => r[key]).filter((v) => v !== void 0);
|
|
198
|
+
}
|
|
199
|
+
function recKV(key, value) {
|
|
200
|
+
if (value === void 0) return void 0;
|
|
201
|
+
return { [key]: value };
|
|
202
|
+
}
|
|
93
203
|
//#endregion
|
|
94
204
|
exports.ConfigFields = ConfigFields;
|
|
95
205
|
exports.IssueType = IssueType;
|
|
96
206
|
exports.MessageTypes = MessageTypes;
|
|
97
207
|
exports.defaultCSpellSettings = defaultCSpellSettings;
|
|
98
208
|
exports.defineConfig = defineConfig;
|
|
209
|
+
exports.mergeConfig = mergeConfig;
|
|
99
210
|
exports.unknownWordsChoices = unknownWordsChoices;
|
|
211
|
+
|
|
100
212
|
//# sourceMappingURL=index.js.map
|