forked from msironi/expr-eval
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlanguage-service.types.ts
More file actions
76 lines (65 loc) · 2.35 KB
/
Copy pathlanguage-service.types.ts
File metadata and controls
76 lines (65 loc) · 2.35 KB
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
76
import type { Values } from '../types';
import type { Position, Hover, CompletionItem, MarkupContent, Diagnostic } from 'vscode-languageserver-types';
import type { TextDocument } from 'vscode-languageserver-textdocument';
/**
* Public API for the language service
*/
export interface LanguageServiceApi {
/**
* Returns a list of possible completions for the given position in the document.
* @param params - Parameters for the completion request
*/
getCompletions(params: GetCompletionsParams): CompletionItem[];
/**
* Returns a hover message for the given position in the document.
* @param params - Parameters for the hover request
*/
getHover(params: GetHoverParams): HoverV2;
/**
* Returns a list of syntax highlighting tokens for the given text document.
* @param textDocument - The text document to analyze
*/
getHighlighting(textDocument: TextDocument): HighlightToken[];
/**
* Returns a list of diagnostics for the given text document.
* This includes errors like incorrect number of function arguments.
* @param params - Parameters for the diagnostics request
*/
getDiagnostics(params: GetDiagnosticsParams): Diagnostic[];
}
export interface HighlightToken {
type: 'number' | 'string' | 'name' | 'keyword' | 'operator' | 'function' | 'punctuation' | 'constant';
start: number;
end: number;
value?: string | number | boolean | undefined;
}
export interface LanguageServiceOptions {
// A map of operator names to booleans indicating whether they are
// allowed in the expression.
operators?: Record<string, boolean>;
}
export interface GetCompletionsParams {
textDocument: TextDocument;
position: Position;
variables?: Values;
}
export interface GetHoverParams {
textDocument: TextDocument;
position: Position;
variables?: Values;
}
export interface HoverV2 extends Hover {
contents: MarkupContent; // Type narrowing since we know we are not going to return deprecated content
}
export interface GetDiagnosticsParams {
textDocument: TextDocument;
}
/**
* Describes the arity (expected number of arguments) for a function.
*/
export interface ArityInfo {
/** Minimum number of required arguments */
min: number;
/** Maximum number of arguments, or undefined if variadic (unlimited) */
max: number | undefined;
}