@cspell/cspell-types 6.1.2 → 6.1.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.
- package/dist/CSpellSettingsDef.d.ts +41 -2
- package/dist/Parser.d.ts +126 -0
- package/dist/Parser.js +3 -0
- package/dist/TextMap.d.ts +36 -0
- package/dist/TextMap.js +3 -0
- package/dist/TextOffset.d.ts +0 -21
- package/dist/configFields.js +3 -0
- package/dist/index.d.ts +2 -0
- package/package.json +19 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DictionaryInformation } from './DictionaryInformation';
|
|
2
2
|
import type { Features } from './features';
|
|
3
|
+
import { Parser, ParserName } from './Parser';
|
|
3
4
|
export declare type ReplaceEntry = [string, string];
|
|
4
5
|
export declare type ReplaceMap = ReplaceEntry[];
|
|
5
6
|
/**
|
|
@@ -24,7 +25,7 @@ export interface CSpellSettingsWithSourceTrace extends CSpellSettings {
|
|
|
24
25
|
__importRef?: ImportFileRef;
|
|
25
26
|
__imports?: Map<string, ImportFileRef>;
|
|
26
27
|
}
|
|
27
|
-
export interface FileSettings extends ExtendableSettings, CommandLineSettings {
|
|
28
|
+
export interface FileSettings extends ExtendableSettings, CommandLineSettings, ExperimentalFileSettings {
|
|
28
29
|
/**
|
|
29
30
|
* Configuration format version of the settings file.
|
|
30
31
|
*
|
|
@@ -347,7 +348,7 @@ export interface OverrideFilterFields {
|
|
|
347
348
|
/** Glob pattern or patterns to match against. */
|
|
348
349
|
filename: Glob | Glob[];
|
|
349
350
|
}
|
|
350
|
-
export interface BaseSetting {
|
|
351
|
+
export interface BaseSetting extends ExperimentalBaseSettings {
|
|
351
352
|
/** Optional identifier. */
|
|
352
353
|
id?: string;
|
|
353
354
|
/** Optional name of configuration. */
|
|
@@ -802,5 +803,43 @@ interface BaseSource {
|
|
|
802
803
|
* Reporter name or reporter name + reporter config.
|
|
803
804
|
*/
|
|
804
805
|
export declare type ReporterSettings = string | [string] | [string, unknown];
|
|
806
|
+
/**
|
|
807
|
+
* Experimental Configuration / Options
|
|
808
|
+
*
|
|
809
|
+
* This Configuration is subject to change without warning.
|
|
810
|
+
* @experimental
|
|
811
|
+
* @hidden
|
|
812
|
+
*/
|
|
813
|
+
export interface ExperimentalFileSettings {
|
|
814
|
+
/**
|
|
815
|
+
* Future Plugin support
|
|
816
|
+
* @experimental
|
|
817
|
+
* @version 6.2.0
|
|
818
|
+
*/
|
|
819
|
+
plugins?: Plugin[] | undefined;
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Experimental Configuration / Options
|
|
823
|
+
*
|
|
824
|
+
* This Configuration is subject to change without warning.
|
|
825
|
+
* @experimental
|
|
826
|
+
* @hidden
|
|
827
|
+
*/
|
|
828
|
+
export interface ExperimentalBaseSettings {
|
|
829
|
+
/**
|
|
830
|
+
* Parser to use for the file content
|
|
831
|
+
* @experimental
|
|
832
|
+
* @version 6.2.0
|
|
833
|
+
*/
|
|
834
|
+
parser?: ParserName | Parser | undefined;
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Plugin API
|
|
838
|
+
* @experimental
|
|
839
|
+
* @version 6.2.0
|
|
840
|
+
*/
|
|
841
|
+
export interface Plugin {
|
|
842
|
+
parsers?: Parser[] | undefined;
|
|
843
|
+
}
|
|
805
844
|
export {};
|
|
806
845
|
//# sourceMappingURL=CSpellSettingsDef.d.ts.map
|
package/dist/Parser.d.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export declare type ParserOptions = Record<string, unknown>;
|
|
2
|
+
export declare type ParserName = string;
|
|
3
|
+
export interface Parser {
|
|
4
|
+
/** Name of parser */
|
|
5
|
+
readonly name: ParserName;
|
|
6
|
+
/**
|
|
7
|
+
* Parse Method
|
|
8
|
+
* @param content - full content of the file
|
|
9
|
+
* @param filename - filename
|
|
10
|
+
*/
|
|
11
|
+
parse(content: string, filename: string): ParseResult;
|
|
12
|
+
}
|
|
13
|
+
export interface ParseResult {
|
|
14
|
+
readonly content: string;
|
|
15
|
+
readonly filename: string;
|
|
16
|
+
readonly parsedTexts: Iterable<ParsedText>;
|
|
17
|
+
}
|
|
18
|
+
export interface ParsedText {
|
|
19
|
+
/**
|
|
20
|
+
* The text extracted and possibly transformed
|
|
21
|
+
*/
|
|
22
|
+
readonly text: string;
|
|
23
|
+
/**
|
|
24
|
+
* The raw text before it has been transformed
|
|
25
|
+
*/
|
|
26
|
+
readonly rawText?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* start and end offsets of the text
|
|
29
|
+
*/
|
|
30
|
+
readonly range: Range;
|
|
31
|
+
/**
|
|
32
|
+
* The Scope annotation for a segment of text.
|
|
33
|
+
* Used by the spell checker to apply spell checking options
|
|
34
|
+
* based upon the value of the scope.
|
|
35
|
+
*/
|
|
36
|
+
readonly scope?: Scope | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The source map is used to support text transformations.
|
|
39
|
+
*
|
|
40
|
+
* See: {@link SourceMap}
|
|
41
|
+
*/
|
|
42
|
+
readonly map?: SourceMap | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Used to delegate parsing the contents of `text` to another parser.
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
readonly delegate?: DelegateInfo | undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A SourceMap is used to map transform a piece of text back to its original text.
|
|
51
|
+
* This is necessary in order to report the correct location of a spelling issue.
|
|
52
|
+
* An empty source map indicates that it was a 1:1 transformation.
|
|
53
|
+
*
|
|
54
|
+
* The values in a source map are number pairs (even, odd) relative to the beginning of each
|
|
55
|
+
* string segment.
|
|
56
|
+
* - even - offset in the source text
|
|
57
|
+
* - odd - offset in the transformed text
|
|
58
|
+
*
|
|
59
|
+
* Offsets start a 0
|
|
60
|
+
*
|
|
61
|
+
* Example:
|
|
62
|
+
*
|
|
63
|
+
* - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
|
|
64
|
+
* - Transformed text: `Grand Café Bjørvika`
|
|
65
|
+
* - Map: [9, 9, 15, 10, 18, 13, 24, 14]
|
|
66
|
+
*
|
|
67
|
+
* | offset | original | offset | transformed |
|
|
68
|
+
* | ------ | ----------- | ------ | ----------- |
|
|
69
|
+
* | 0-9 | `Grand Caf` | 0-9 | `Grand Caf` |
|
|
70
|
+
* | 9-15 | `\u00e9` | 9-10 | `é` |
|
|
71
|
+
* | 15-18 | ` Bj` | 10-13 | ` Bj` |
|
|
72
|
+
* | 18-24 | `\u00f8` | 13-14 | `ø` |
|
|
73
|
+
* | 24-29 | `rvika` | 14-19 | `rvika` |
|
|
74
|
+
*
|
|
75
|
+
* <!--- cspell:ignore Bjørvika rvika --->
|
|
76
|
+
*/
|
|
77
|
+
export declare type SourceMap = number[];
|
|
78
|
+
export declare type Range = readonly [start: number, end: number];
|
|
79
|
+
/**
|
|
80
|
+
* DelegateInfo is used by a parser to delegate parsing a subsection of a document to
|
|
81
|
+
* another parser. The following information is used by the spell checker to match
|
|
82
|
+
* the parser.
|
|
83
|
+
*/
|
|
84
|
+
export interface DelegateInfo {
|
|
85
|
+
/**
|
|
86
|
+
* Proposed virtual file name including the extension.
|
|
87
|
+
* Format: `./${source_filename}/${block_number}.${ext}
|
|
88
|
+
* Example: `./README.md/1.js`
|
|
89
|
+
*/
|
|
90
|
+
readonly filename: string;
|
|
91
|
+
/**
|
|
92
|
+
* The filename of the origin of the virtual file block.
|
|
93
|
+
* Example: `./README.md`
|
|
94
|
+
*/
|
|
95
|
+
readonly originFilename: string;
|
|
96
|
+
/**
|
|
97
|
+
* Proposed file extension
|
|
98
|
+
* Example: `.js`
|
|
99
|
+
*/
|
|
100
|
+
readonly extension: string;
|
|
101
|
+
/**
|
|
102
|
+
* Filetype to use
|
|
103
|
+
* Example: `javascript`
|
|
104
|
+
*/
|
|
105
|
+
readonly fileType?: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Scope - chain of scope going from local to global
|
|
109
|
+
*
|
|
110
|
+
* Example:
|
|
111
|
+
* ```
|
|
112
|
+
* `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export interface ScopeChain {
|
|
116
|
+
readonly value: string;
|
|
117
|
+
readonly parent?: ScopeChain | undefined;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A string representing a scope chain separated by spaces
|
|
121
|
+
*
|
|
122
|
+
* Example: `comment.block.documentation.ts meta.interface.ts source.ts`
|
|
123
|
+
*/
|
|
124
|
+
export declare type ScopeString = string;
|
|
125
|
+
export declare type Scope = ScopeChain | ScopeString;
|
|
126
|
+
//# sourceMappingURL=Parser.d.ts.map
|
package/dist/Parser.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare type MappedText = Readonly<TransformedText>;
|
|
2
|
+
export declare type Range = readonly [start: number, end: number];
|
|
3
|
+
export interface Mapped {
|
|
4
|
+
/**
|
|
5
|
+
* `(i, j)` number pairs where
|
|
6
|
+
* - `i` is the offset in the source
|
|
7
|
+
* - `j` is the offset in the destination
|
|
8
|
+
*
|
|
9
|
+
* Example:
|
|
10
|
+
* - source text = `"caf\xe9"`
|
|
11
|
+
* - mapped text = `"café"`
|
|
12
|
+
* - map = `[3, 3, 7, 4]`, which is equivalent to `[0, 0, 3, 3, 7, 4]`
|
|
13
|
+
* where the `[0, 0]` is unnecessary.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
map: number[];
|
|
17
|
+
}
|
|
18
|
+
interface TransformedText extends PartialOrUndefined<Mapped> {
|
|
19
|
+
/**
|
|
20
|
+
* Transformed text with an optional map.
|
|
21
|
+
*/
|
|
22
|
+
text: string;
|
|
23
|
+
/**
|
|
24
|
+
* The original text
|
|
25
|
+
*/
|
|
26
|
+
rawText?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The start and end offset of the text in the document.
|
|
29
|
+
*/
|
|
30
|
+
range: Range;
|
|
31
|
+
}
|
|
32
|
+
declare type PartialOrUndefined<T> = {
|
|
33
|
+
[P in keyof T]?: T[P] | undefined;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=TextMap.d.ts.map
|
package/dist/TextMap.js
ADDED
package/dist/TextOffset.d.ts
CHANGED
|
@@ -20,25 +20,4 @@ export interface TextDocumentOffset extends TextOffset {
|
|
|
20
20
|
col: number;
|
|
21
21
|
line: TextOffset;
|
|
22
22
|
}
|
|
23
|
-
export interface Mapped {
|
|
24
|
-
/**
|
|
25
|
-
* `(i, j)` number pairs where
|
|
26
|
-
* - `i` is the offset in the source
|
|
27
|
-
* - `j` is the offset in the destination
|
|
28
|
-
*
|
|
29
|
-
* Example:
|
|
30
|
-
* - source text = `"caf\xe9"`
|
|
31
|
-
* - mapped text = `"café"`
|
|
32
|
-
* - map = `[3, 3, 7, 4]`, which is equivalent to `[0, 0, 3, 3, 7, 4]`
|
|
33
|
-
* where the `[0, 0]` is unnecessary.
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
map: number[];
|
|
37
|
-
}
|
|
38
|
-
export interface TransformedText extends Partial<Mapped> {
|
|
39
|
-
/**
|
|
40
|
-
* Transformed text with an optional map.
|
|
41
|
-
*/
|
|
42
|
-
text: string;
|
|
43
|
-
}
|
|
44
23
|
//# sourceMappingURL=TextOffset.d.ts.map
|
package/dist/configFields.js
CHANGED
|
@@ -47,6 +47,9 @@ exports.ConfigFields = {
|
|
|
47
47
|
usePnP: 'usePnP',
|
|
48
48
|
userWords: 'userWords',
|
|
49
49
|
words: 'words',
|
|
50
|
+
// Experimental
|
|
51
|
+
parser: 'parser',
|
|
52
|
+
plugins: 'plugins',
|
|
50
53
|
};
|
|
51
54
|
// export const ConfigKeysNames = Object.values(ConfigKeysByField);
|
|
52
55
|
//# sourceMappingURL=configFields.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export * from './CSpellReporter';
|
|
|
4
4
|
export * from './CSpellSettingsDef';
|
|
5
5
|
export type { CharacterSet, CharacterSetCosts, DictionaryInformation, EditCosts } from './DictionaryInformation';
|
|
6
6
|
export type { Feature, Features } from './features';
|
|
7
|
+
export type { ParsedText, Parser, ParseResult, ParserName, ParserOptions } from './Parser';
|
|
7
8
|
export type { SuggestionCostMapDef, SuggestionCostsDefs } from './suggestionCostsDef';
|
|
9
|
+
export type { MappedText } from './TextMap';
|
|
8
10
|
export type { TextDocumentOffset, TextOffset } from './TextOffset';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -3,12 +3,28 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "6.1.
|
|
6
|
+
"version": "6.1.3",
|
|
7
7
|
"description": "Types for cspell and cspell-lib",
|
|
8
|
+
"type": "commonjs",
|
|
8
9
|
"main": "dist/index.js",
|
|
9
10
|
"typings": "dist/index.d.ts",
|
|
11
|
+
"typesVersions": {
|
|
12
|
+
"*": {
|
|
13
|
+
"*": [
|
|
14
|
+
"dist/*"
|
|
15
|
+
],
|
|
16
|
+
"dist/index.d.ts": [
|
|
17
|
+
"dist/index.d.ts"
|
|
18
|
+
],
|
|
19
|
+
"index.d.ts": [
|
|
20
|
+
"dist/index.d.ts"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
10
24
|
"exports": {
|
|
11
25
|
".": "./dist/index.js",
|
|
26
|
+
"./Parser": "./dist/Parser.js",
|
|
27
|
+
"./Parser.js": "./dist/Parser.js",
|
|
12
28
|
"./cspell.schema.json": "./cspell.schema.json",
|
|
13
29
|
"./ajv.config": "./ajv.config.js",
|
|
14
30
|
"./ajv.config.js": "./ajv.config.js"
|
|
@@ -51,7 +67,7 @@
|
|
|
51
67
|
"jest": "^28.1.1",
|
|
52
68
|
"rimraf": "^3.0.2",
|
|
53
69
|
"ts-json-schema-generator": "^1.0.0",
|
|
54
|
-
"typescript": "^4.7.
|
|
70
|
+
"typescript": "^4.7.4"
|
|
55
71
|
},
|
|
56
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "e96b313542f2ec0a38ac04d1422d97e724ded3a6"
|
|
57
73
|
}
|