@cspell/cspell-types 9.6.3 → 9.7.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/TextMap-B1Fq1qVW.d.ts +176 -0
- package/dist/TextMap-Cs2Bypvi.d.mts +176 -0
- package/dist/index.d.mts +76 -38
- package/dist/index.d.ts +76 -38
- package/dist/index.js +117 -0
- package/dist/index.mjs +116 -1
- package/package.json +2 -2
package/cspell.schema.json
CHANGED
|
@@ -1319,6 +1319,18 @@
|
|
|
1319
1319
|
"markdownDescription": "Defines a list of patterns that can be used with the {@link ignoreRegExpList } and\n {@link includeRegExpList } options.\n\nFor example:\n\n```javascript\n\"ignoreRegExpList\": [\"comments\"],\n\"patterns\": [\n {\n \"name\": \"comment-single-line\",\n \"pattern\": \"/#.*/g\"\n },\n {\n \"name\": \"comment-multi-line\",\n \"pattern\": \"/(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)/g\"\n },\n // You can also combine multiple named patterns into one single named pattern\n {\n \"name\": \"comments\",\n \"pattern\": [\"comment-single-line\", \"comment-multi-line\"]\n }\n]\n```",
|
|
1320
1320
|
"type": "array"
|
|
1321
1321
|
},
|
|
1322
|
+
"substitutionDefinitions": {
|
|
1323
|
+
"$ref": "#/definitions/SubstitutionDefinitions",
|
|
1324
|
+
"description": "The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.",
|
|
1325
|
+
"markdownDescription": "The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.",
|
|
1326
|
+
"since": "9.7.0"
|
|
1327
|
+
},
|
|
1328
|
+
"substitutions": {
|
|
1329
|
+
"$ref": "#/definitions/Substitutions",
|
|
1330
|
+
"description": "The set of substitutions to apply to a document before spell checking.",
|
|
1331
|
+
"markdownDescription": "The set of substitutions to apply to a document before spell checking.",
|
|
1332
|
+
"since": "9.7.0"
|
|
1333
|
+
},
|
|
1322
1334
|
"suggestWords": {
|
|
1323
1335
|
"description": "A list of suggested replacements for words. Suggested words provide a way to make preferred suggestions on word replacements. To hint at a preferred change, but not to require it.\n\nFormat of `suggestWords`\n- Single suggestion (possible auto fix) - `word: suggestion` - `word->suggestion`\n- Multiple suggestions (not auto fixable) - `word: first, second, third` - `word->first, second, third`",
|
|
1324
1336
|
"items": {
|
|
@@ -1587,6 +1599,18 @@
|
|
|
1587
1599
|
"markdownDescription": "The PnP files to search for. Note: `.mjs` files are not currently supported.",
|
|
1588
1600
|
"type": "array"
|
|
1589
1601
|
},
|
|
1602
|
+
"substitutionDefinitions": {
|
|
1603
|
+
"$ref": "#/definitions/SubstitutionDefinitions",
|
|
1604
|
+
"description": "The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.",
|
|
1605
|
+
"markdownDescription": "The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.",
|
|
1606
|
+
"since": "9.7.0"
|
|
1607
|
+
},
|
|
1608
|
+
"substitutions": {
|
|
1609
|
+
"$ref": "#/definitions/Substitutions",
|
|
1610
|
+
"description": "The set of substitutions to apply to a document before spell checking.",
|
|
1611
|
+
"markdownDescription": "The set of substitutions to apply to a document before spell checking.",
|
|
1612
|
+
"since": "9.7.0"
|
|
1613
|
+
},
|
|
1590
1614
|
"suggestWords": {
|
|
1591
1615
|
"description": "A list of suggested replacements for words. Suggested words provide a way to make preferred suggestions on word replacements. To hint at a preferred change, but not to require it.\n\nFormat of `suggestWords`\n- Single suggestion (possible auto fix) - `word: suggestion` - `word->suggestion`\n- Multiple suggestions (not auto fixable) - `word: first, second, third` - `word->first, second, third`",
|
|
1592
1616
|
"items": {
|
|
@@ -1845,6 +1869,84 @@
|
|
|
1845
1869
|
"markdownDescription": "Simple Glob string, the root will be globRoot.",
|
|
1846
1870
|
"type": "string"
|
|
1847
1871
|
},
|
|
1872
|
+
"SubstitutionDefinition": {
|
|
1873
|
+
"additionalProperties": false,
|
|
1874
|
+
"description": "Allows for the definition of a substitution set. A substitution set is a collection of substitution entries that can be applied to a document before spell checking. This is useful for converting html entities, url encodings, or other transformations that may be necessary to get the correct text for spell checking.\n\nSubstitutions are applied based upon the longest matching find string. If there are multiple matches of the same `find`, the last one in the list is used. This allows for the overriding of substitutions. For example, if you have a substitution for `&` to `and`, and then a substitution for `&` to `&`, the `&` substitution will be used for the string `&`, and the `&` substitution will be used for the string `&`.",
|
|
1875
|
+
"markdownDescription": "Allows for the definition of a substitution set. A substitution set is a collection of substitution\nentries that can be applied to a document before spell checking. This is useful for converting html entities, url encodings,\nor other transformations that may be necessary to get the correct text for spell checking.\n\nSubstitutions are applied based upon the longest matching find string. If there are multiple matches of the same `find`,\nthe last one in the list is used. This allows for the overriding of substitutions. For example, if you have a substitution\nfor `&` to `and`, and then a substitution for `&` to `&`, the `&` substitution will be used for the string `&`,\nand the `&` substitution will be used for the string `&`.",
|
|
1876
|
+
"properties": {
|
|
1877
|
+
"description": {
|
|
1878
|
+
"description": "An optional description of the substitution definition. This is not used for anything, but can be useful for documentation purposes.",
|
|
1879
|
+
"markdownDescription": "An optional description of the substitution definition. This is not used for anything, but can be useful for\ndocumentation purposes.",
|
|
1880
|
+
"type": "string"
|
|
1881
|
+
},
|
|
1882
|
+
"entries": {
|
|
1883
|
+
"description": "The entries for the substitution definition. This is a collection of substitution entries that can be applied to a document before spell checking.",
|
|
1884
|
+
"items": {
|
|
1885
|
+
"$ref": "#/definitions/SubstitutionEntry"
|
|
1886
|
+
},
|
|
1887
|
+
"markdownDescription": "The entries for the substitution definition. This is a collection of substitution entries that can be applied to a\ndocument before spell checking.",
|
|
1888
|
+
"type": "array"
|
|
1889
|
+
},
|
|
1890
|
+
"name": {
|
|
1891
|
+
"$ref": "#/definitions/SubstitutionID",
|
|
1892
|
+
"description": "The name of the substitution definition. This is used to reference the substitution definition in the substitutions array.",
|
|
1893
|
+
"markdownDescription": "The name of the substitution definition. This is used to reference the substitution definition in the substitutions array."
|
|
1894
|
+
}
|
|
1895
|
+
},
|
|
1896
|
+
"required": [
|
|
1897
|
+
"name",
|
|
1898
|
+
"entries"
|
|
1899
|
+
],
|
|
1900
|
+
"since": "9.7.0",
|
|
1901
|
+
"type": "object"
|
|
1902
|
+
},
|
|
1903
|
+
"SubstitutionDefinitions": {
|
|
1904
|
+
"description": "The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.",
|
|
1905
|
+
"items": {
|
|
1906
|
+
"$ref": "#/definitions/SubstitutionDefinition"
|
|
1907
|
+
},
|
|
1908
|
+
"markdownDescription": "The set of available substitutions. This is a collection of substitution definitions that can be applied to a document\nbefore spell checking.",
|
|
1909
|
+
"type": "array"
|
|
1910
|
+
},
|
|
1911
|
+
"SubstitutionEntry": {
|
|
1912
|
+
"description": "A substitution entry is a tuple of the form `[find, replacement]`. The find string is the string to find, and the replacement string is the string to replace it with.\n\n- `find` - The string to find. This is the string that will be replaced in the text. Only an exact match will be replaced. The find string is not treated as a regular expression.\n- `replacement` - The string to replace the `find` string with. This is the string that will be used to replace the `find` string in the text.",
|
|
1913
|
+
"items": [
|
|
1914
|
+
{
|
|
1915
|
+
"title": "find",
|
|
1916
|
+
"type": "string"
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
"title": "replacement",
|
|
1920
|
+
"type": "string"
|
|
1921
|
+
}
|
|
1922
|
+
],
|
|
1923
|
+
"markdownDescription": "A substitution entry is a tuple of the form `[find, replacement]`. The find string is the string to find,\nand the replacement string is the string to replace it with.\n\n- `find` - The string to find. This is the string that will be replaced in the text. Only an exact match will be replaced.\n The find string is not treated as a regular expression.\n- `replacement` - The string to replace the `find` string with. This is the string that will be used to replace the `find`\n string in the text.",
|
|
1924
|
+
"maxItems": 2,
|
|
1925
|
+
"minItems": 2,
|
|
1926
|
+
"since": "9.7.0",
|
|
1927
|
+
"type": "array"
|
|
1928
|
+
},
|
|
1929
|
+
"SubstitutionID": {
|
|
1930
|
+
"description": "The ID for a substitution definition. This is used to reference the substitution definition in the substitutions array.",
|
|
1931
|
+
"markdownDescription": "The ID for a substitution definition. This is used to reference the substitution definition in the substitutions array.",
|
|
1932
|
+
"since": "9.7.0",
|
|
1933
|
+
"type": "string"
|
|
1934
|
+
},
|
|
1935
|
+
"Substitutions": {
|
|
1936
|
+
"description": "The set of substitutions to apply to a document before spell checking. This is a collection of substitution entries that can be applied to a document before spell checking.",
|
|
1937
|
+
"items": {
|
|
1938
|
+
"anyOf": [
|
|
1939
|
+
{
|
|
1940
|
+
"$ref": "#/definitions/SubstitutionEntry"
|
|
1941
|
+
},
|
|
1942
|
+
{
|
|
1943
|
+
"$ref": "#/definitions/SubstitutionID"
|
|
1944
|
+
}
|
|
1945
|
+
]
|
|
1946
|
+
},
|
|
1947
|
+
"markdownDescription": "The set of substitutions to apply to a document before spell checking.\nThis is a collection of substitution entries that can be applied to a document before spell checking.",
|
|
1948
|
+
"type": "array"
|
|
1949
|
+
},
|
|
1848
1950
|
"SuggestionCostMapDef": {
|
|
1849
1951
|
"anyOf": [
|
|
1850
1952
|
{
|
|
@@ -2236,6 +2338,18 @@
|
|
|
2236
2338
|
"markdownDescription": "Delay in ms after a document has changed before checking it for spelling errors.",
|
|
2237
2339
|
"type": "number"
|
|
2238
2340
|
},
|
|
2341
|
+
"substitutionDefinitions": {
|
|
2342
|
+
"$ref": "#/definitions/SubstitutionDefinitions",
|
|
2343
|
+
"description": "The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.",
|
|
2344
|
+
"markdownDescription": "The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.",
|
|
2345
|
+
"since": "9.7.0"
|
|
2346
|
+
},
|
|
2347
|
+
"substitutions": {
|
|
2348
|
+
"$ref": "#/definitions/Substitutions",
|
|
2349
|
+
"description": "The set of substitutions to apply to a document before spell checking.",
|
|
2350
|
+
"markdownDescription": "The set of substitutions to apply to a document before spell checking.",
|
|
2351
|
+
"since": "9.7.0"
|
|
2352
|
+
},
|
|
2239
2353
|
"suggestWords": {
|
|
2240
2354
|
"description": "A list of suggested replacements for words. Suggested words provide a way to make preferred suggestions on word replacements. To hint at a preferred change, but not to require it.\n\nFormat of `suggestWords`\n- Single suggestion (possible auto fix) - `word: suggestion` - `word->suggestion`\n- Multiple suggestions (not auto fixable) - `word: first, second, third` - `word->first, second, third`",
|
|
2241
2355
|
"items": {
|
package/dist/Parser/index.d.mts
CHANGED
|
@@ -1,129 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
type ParserOptions
|
|
3
|
-
type ParserName = string;
|
|
4
|
-
interface Parser {
|
|
5
|
-
/** Name of parser */
|
|
6
|
-
readonly name: ParserName;
|
|
7
|
-
/**
|
|
8
|
-
* Parse Method
|
|
9
|
-
* @param content - full content of the file
|
|
10
|
-
* @param filename - filename
|
|
11
|
-
*/
|
|
12
|
-
parse(content: string, filename: string): ParseResult;
|
|
13
|
-
}
|
|
14
|
-
interface ParseResult {
|
|
15
|
-
readonly content: string;
|
|
16
|
-
readonly filename: string;
|
|
17
|
-
readonly parsedTexts: Iterable<ParsedText>;
|
|
18
|
-
}
|
|
19
|
-
interface ParsedText {
|
|
20
|
-
/**
|
|
21
|
-
* The text extracted and possibly transformed
|
|
22
|
-
*/
|
|
23
|
-
readonly text: string;
|
|
24
|
-
/**
|
|
25
|
-
* The raw text before it has been transformed
|
|
26
|
-
*/
|
|
27
|
-
readonly rawText?: string | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* start and end offsets of the text
|
|
30
|
-
*/
|
|
31
|
-
readonly range: Range;
|
|
32
|
-
/**
|
|
33
|
-
* The Scope annotation for a segment of text.
|
|
34
|
-
* Used by the spell checker to apply spell checking options
|
|
35
|
-
* based upon the value of the scope.
|
|
36
|
-
*/
|
|
37
|
-
readonly scope?: Scope | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* The source map is used to support text transformations.
|
|
40
|
-
*
|
|
41
|
-
* See: {@link SourceMap}
|
|
42
|
-
*/
|
|
43
|
-
readonly map?: SourceMap | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Used to delegate parsing the contents of `text` to another parser.
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
readonly delegate?: DelegateInfo | undefined;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* A SourceMap is used to map transform a piece of text back to its original text.
|
|
52
|
-
* This is necessary in order to report the correct location of a spelling issue.
|
|
53
|
-
* An empty source map indicates that it was a 1:1 transformation.
|
|
54
|
-
*
|
|
55
|
-
* The values in a source map are number pairs (even, odd) relative to the beginning of each
|
|
56
|
-
* string segment.
|
|
57
|
-
* - even - offset in the source text
|
|
58
|
-
* - odd - offset in the transformed text
|
|
59
|
-
*
|
|
60
|
-
* Offsets start a 0
|
|
61
|
-
*
|
|
62
|
-
* Example:
|
|
63
|
-
*
|
|
64
|
-
* - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
|
|
65
|
-
* - Transformed text: `Grand Café Bjørvika`
|
|
66
|
-
* - Map: [9, 9, 15, 10, 18, 13, 24, 14]
|
|
67
|
-
*
|
|
68
|
-
* | offset | original | offset | transformed |
|
|
69
|
-
* | ------ | ----------- | ------ | ----------- |
|
|
70
|
-
* | 0-9 | `Grand Caf` | 0-9 | `Grand Caf` |
|
|
71
|
-
* | 9-15 | `\u00e9` | 9-10 | `é` |
|
|
72
|
-
* | 15-18 | ` Bj` | 10-13 | ` Bj` |
|
|
73
|
-
* | 18-24 | `\u00f8` | 13-14 | `ø` |
|
|
74
|
-
* | 24-29 | `rvika` | 14-19 | `rvika` |
|
|
75
|
-
*
|
|
76
|
-
* <!--- cspell:ignore Bjørvika rvika --->
|
|
77
|
-
*/
|
|
78
|
-
type SourceMap = number[];
|
|
79
|
-
type Range = readonly [start: number, end: number];
|
|
80
|
-
/**
|
|
81
|
-
* DelegateInfo is used by a parser to delegate parsing a subsection of a document to
|
|
82
|
-
* another parser. The following information is used by the spell checker to match
|
|
83
|
-
* the parser.
|
|
84
|
-
*/
|
|
85
|
-
interface DelegateInfo {
|
|
86
|
-
/**
|
|
87
|
-
* Proposed virtual file name including the extension.
|
|
88
|
-
* Format: `./${source_filename}/${block_number}.${ext}
|
|
89
|
-
* Example: `./README.md/1.js`
|
|
90
|
-
*/
|
|
91
|
-
readonly filename: string;
|
|
92
|
-
/**
|
|
93
|
-
* The filename of the origin of the virtual file block.
|
|
94
|
-
* Example: `./README.md`
|
|
95
|
-
*/
|
|
96
|
-
readonly originFilename: string;
|
|
97
|
-
/**
|
|
98
|
-
* Proposed file extension
|
|
99
|
-
* Example: `.js`
|
|
100
|
-
*/
|
|
101
|
-
readonly extension: string;
|
|
102
|
-
/**
|
|
103
|
-
* Filetype to use
|
|
104
|
-
* Example: `javascript`
|
|
105
|
-
*/
|
|
106
|
-
readonly fileType?: string;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Scope - chain of scope going from local to global
|
|
110
|
-
*
|
|
111
|
-
* Example:
|
|
112
|
-
* ```
|
|
113
|
-
* `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
interface ScopeChain {
|
|
117
|
-
readonly value: string;
|
|
118
|
-
readonly parent?: ScopeChain | undefined;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* A string representing a scope chain separated by spaces
|
|
122
|
-
*
|
|
123
|
-
* Example: `comment.block.documentation.ts meta.interface.ts source.ts`
|
|
124
|
-
*/
|
|
125
|
-
type ScopeString = string;
|
|
126
|
-
type Scope = ScopeChain | ScopeString;
|
|
127
|
-
//#endregion
|
|
128
|
-
export { DelegateInfo, ParseResult, ParsedText, Parser, ParserName, ParserOptions, Range, Scope, ScopeChain, ScopeString, SourceMap };
|
|
129
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
import { a as Parser, c as Scope, d as Range, f as SourceMap, i as ParsedText, l as ScopeChain, n as DelegateInfo, o as ParserName, r as ParseResult, s as ParserOptions, t as MappedText, u as ScopeString } from "../TextMap-Cs2Bypvi.mjs";
|
|
2
|
+
export { type DelegateInfo, type MappedText, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, type Range, type Scope, type ScopeChain, type ScopeString, type SourceMap };
|
package/dist/Parser/index.d.ts
CHANGED
|
@@ -1,129 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
type ParserOptions
|
|
3
|
-
type ParserName = string;
|
|
4
|
-
interface Parser {
|
|
5
|
-
/** Name of parser */
|
|
6
|
-
readonly name: ParserName;
|
|
7
|
-
/**
|
|
8
|
-
* Parse Method
|
|
9
|
-
* @param content - full content of the file
|
|
10
|
-
* @param filename - filename
|
|
11
|
-
*/
|
|
12
|
-
parse(content: string, filename: string): ParseResult;
|
|
13
|
-
}
|
|
14
|
-
interface ParseResult {
|
|
15
|
-
readonly content: string;
|
|
16
|
-
readonly filename: string;
|
|
17
|
-
readonly parsedTexts: Iterable<ParsedText>;
|
|
18
|
-
}
|
|
19
|
-
interface ParsedText {
|
|
20
|
-
/**
|
|
21
|
-
* The text extracted and possibly transformed
|
|
22
|
-
*/
|
|
23
|
-
readonly text: string;
|
|
24
|
-
/**
|
|
25
|
-
* The raw text before it has been transformed
|
|
26
|
-
*/
|
|
27
|
-
readonly rawText?: string | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* start and end offsets of the text
|
|
30
|
-
*/
|
|
31
|
-
readonly range: Range;
|
|
32
|
-
/**
|
|
33
|
-
* The Scope annotation for a segment of text.
|
|
34
|
-
* Used by the spell checker to apply spell checking options
|
|
35
|
-
* based upon the value of the scope.
|
|
36
|
-
*/
|
|
37
|
-
readonly scope?: Scope | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* The source map is used to support text transformations.
|
|
40
|
-
*
|
|
41
|
-
* See: {@link SourceMap}
|
|
42
|
-
*/
|
|
43
|
-
readonly map?: SourceMap | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Used to delegate parsing the contents of `text` to another parser.
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
readonly delegate?: DelegateInfo | undefined;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* A SourceMap is used to map transform a piece of text back to its original text.
|
|
52
|
-
* This is necessary in order to report the correct location of a spelling issue.
|
|
53
|
-
* An empty source map indicates that it was a 1:1 transformation.
|
|
54
|
-
*
|
|
55
|
-
* The values in a source map are number pairs (even, odd) relative to the beginning of each
|
|
56
|
-
* string segment.
|
|
57
|
-
* - even - offset in the source text
|
|
58
|
-
* - odd - offset in the transformed text
|
|
59
|
-
*
|
|
60
|
-
* Offsets start a 0
|
|
61
|
-
*
|
|
62
|
-
* Example:
|
|
63
|
-
*
|
|
64
|
-
* - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
|
|
65
|
-
* - Transformed text: `Grand Café Bjørvika`
|
|
66
|
-
* - Map: [9, 9, 15, 10, 18, 13, 24, 14]
|
|
67
|
-
*
|
|
68
|
-
* | offset | original | offset | transformed |
|
|
69
|
-
* | ------ | ----------- | ------ | ----------- |
|
|
70
|
-
* | 0-9 | `Grand Caf` | 0-9 | `Grand Caf` |
|
|
71
|
-
* | 9-15 | `\u00e9` | 9-10 | `é` |
|
|
72
|
-
* | 15-18 | ` Bj` | 10-13 | ` Bj` |
|
|
73
|
-
* | 18-24 | `\u00f8` | 13-14 | `ø` |
|
|
74
|
-
* | 24-29 | `rvika` | 14-19 | `rvika` |
|
|
75
|
-
*
|
|
76
|
-
* <!--- cspell:ignore Bjørvika rvika --->
|
|
77
|
-
*/
|
|
78
|
-
type SourceMap = number[];
|
|
79
|
-
type Range = readonly [start: number, end: number];
|
|
80
|
-
/**
|
|
81
|
-
* DelegateInfo is used by a parser to delegate parsing a subsection of a document to
|
|
82
|
-
* another parser. The following information is used by the spell checker to match
|
|
83
|
-
* the parser.
|
|
84
|
-
*/
|
|
85
|
-
interface DelegateInfo {
|
|
86
|
-
/**
|
|
87
|
-
* Proposed virtual file name including the extension.
|
|
88
|
-
* Format: `./${source_filename}/${block_number}.${ext}
|
|
89
|
-
* Example: `./README.md/1.js`
|
|
90
|
-
*/
|
|
91
|
-
readonly filename: string;
|
|
92
|
-
/**
|
|
93
|
-
* The filename of the origin of the virtual file block.
|
|
94
|
-
* Example: `./README.md`
|
|
95
|
-
*/
|
|
96
|
-
readonly originFilename: string;
|
|
97
|
-
/**
|
|
98
|
-
* Proposed file extension
|
|
99
|
-
* Example: `.js`
|
|
100
|
-
*/
|
|
101
|
-
readonly extension: string;
|
|
102
|
-
/**
|
|
103
|
-
* Filetype to use
|
|
104
|
-
* Example: `javascript`
|
|
105
|
-
*/
|
|
106
|
-
readonly fileType?: string;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Scope - chain of scope going from local to global
|
|
110
|
-
*
|
|
111
|
-
* Example:
|
|
112
|
-
* ```
|
|
113
|
-
* `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
interface ScopeChain {
|
|
117
|
-
readonly value: string;
|
|
118
|
-
readonly parent?: ScopeChain | undefined;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* A string representing a scope chain separated by spaces
|
|
122
|
-
*
|
|
123
|
-
* Example: `comment.block.documentation.ts meta.interface.ts source.ts`
|
|
124
|
-
*/
|
|
125
|
-
type ScopeString = string;
|
|
126
|
-
type Scope = ScopeChain | ScopeString;
|
|
127
|
-
//#endregion
|
|
128
|
-
export { DelegateInfo, ParseResult, ParsedText, Parser, ParserName, ParserOptions, Range, Scope, ScopeChain, ScopeString, SourceMap };
|
|
129
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { a as Parser, c as Scope, d as Range, f as SourceMap, i as ParsedText, l as ScopeChain, n as DelegateInfo, o as ParserName, r as ParseResult, s as ParserOptions, t as MappedText, u as ScopeString } from "../TextMap-B1Fq1qVW.js";
|
|
2
|
+
export { type DelegateInfo, type MappedText, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, type Range, type Scope, type ScopeChain, type ScopeString, type SourceMap };
|
|
@@ -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=TextMap-B1Fq1qVW.d.ts.map
|