-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
returns.ts
75 lines (70 loc) · 1.77 KB
/
returns.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import type { CompilerOptions } from 'typescript'
import type { NodeCompletion, NodeError, NodeHighlight, NodeHover, NodeQuery, NodeTag, Range, TwoslashGenericResult } from 'twoslash-protocol'
import type { HandbookOptions } from './handbook-options'
export interface TwoslashReturn extends TwoslashGenericResult {
/**
* The meta information the twoslash run
*/
meta: TwoslashReturnMeta
get queries(): NodeQuery[]
get completions(): NodeCompletion[]
get errors(): NodeError[]
get highlights(): NodeHighlight[]
get hovers(): NodeHover[]
get tags(): NodeTag[]
}
export interface TwoslashReturnMeta {
/**
* The new extension type for the code, potentially changed if they've requested emitted results
*/
extension: string
/**
* Ranges of text which should be removed from the output
*/
removals: Range[]
/**
* Resolved compiler options
*/
compilerOptions: CompilerOptions
/**
* Resolved handbook options
*/
handbookOptions: HandbookOptions
/**
* Flags which were parsed from the code
*/
flagNotations: ParsedFlagNotation[]
/**
* The virtual files which were created
*/
virtualFiles: VirtualFile[]
/**
* Positions of queries in the code
*/
positionQueries: number[]
/**
* Positions of completions in the code
*/
positionCompletions: number[]
/**
* Positions of errors in the code
*/
positionHighlights: [start: number, end: number, text?: string][]
}
export interface ParsedFlagNotation {
type: 'compilerOptions' | 'handbookOptions' | 'tag' | 'unknown'
name: string
value: any
start: number
end: number
}
export interface VirtualFile {
offset: number
filename: string
filepath: string
content: string
extension: string
supportLsp?: boolean
prepend?: string
append?: string
}