massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-json / node_modules / vscode-json-languageservice / lib / esm / jsonLanguageTypes.d.ts
1 import { JSONWorkerContribution, JSONPath, Segment, CompletionsCollector } from './jsonContributions';
2 import { JSONSchema } from './jsonSchema';
3 import { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, MarkupKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, FormattingOptions as LSPFormattingOptions, DefinitionLink } from 'vscode-languageserver-types';
4 import { TextDocument } from 'vscode-languageserver-textdocument';
5 export { TextDocument, Range, TextEdit, JSONSchema, JSONWorkerContribution, JSONPath, Segment, CompletionsCollector, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, MarkupKind, DefinitionLink, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString };
6 /**
7  * Error codes used by diagnostics
8  */
9 export declare enum ErrorCode {
10     Undefined = 0,
11     EnumValueMismatch = 1,
12     Deprecated = 2,
13     UnexpectedEndOfComment = 257,
14     UnexpectedEndOfString = 258,
15     UnexpectedEndOfNumber = 259,
16     InvalidUnicode = 260,
17     InvalidEscapeCharacter = 261,
18     InvalidCharacter = 262,
19     PropertyExpected = 513,
20     CommaExpected = 514,
21     ColonExpected = 515,
22     ValueExpected = 516,
23     CommaOrCloseBacketExpected = 517,
24     CommaOrCloseBraceExpected = 518,
25     TrailingComma = 519,
26     DuplicateKey = 520,
27     CommentNotPermitted = 521,
28     SchemaResolveError = 768
29 }
30 export declare type ASTNode = ObjectASTNode | PropertyASTNode | ArrayASTNode | StringASTNode | NumberASTNode | BooleanASTNode | NullASTNode;
31 export interface BaseASTNode {
32     readonly type: 'object' | 'array' | 'property' | 'string' | 'number' | 'boolean' | 'null';
33     readonly parent?: ASTNode;
34     readonly offset: number;
35     readonly length: number;
36     readonly children?: ASTNode[];
37     readonly value?: string | boolean | number | null;
38 }
39 export interface ObjectASTNode extends BaseASTNode {
40     readonly type: 'object';
41     readonly properties: PropertyASTNode[];
42     readonly children: ASTNode[];
43 }
44 export interface PropertyASTNode extends BaseASTNode {
45     readonly type: 'property';
46     readonly keyNode: StringASTNode;
47     readonly valueNode?: ASTNode;
48     readonly colonOffset?: number;
49     readonly children: ASTNode[];
50 }
51 export interface ArrayASTNode extends BaseASTNode {
52     readonly type: 'array';
53     readonly items: ASTNode[];
54     readonly children: ASTNode[];
55 }
56 export interface StringASTNode extends BaseASTNode {
57     readonly type: 'string';
58     readonly value: string;
59 }
60 export interface NumberASTNode extends BaseASTNode {
61     readonly type: 'number';
62     readonly value: number;
63     readonly isInteger: boolean;
64 }
65 export interface BooleanASTNode extends BaseASTNode {
66     readonly type: 'boolean';
67     readonly value: boolean;
68 }
69 export interface NullASTNode extends BaseASTNode {
70     readonly type: 'null';
71     readonly value: null;
72 }
73 export interface MatchingSchema {
74     node: ASTNode;
75     schema: JSONSchema;
76 }
77 export interface LanguageSettings {
78     /**
79      * If set, the validator will return syntax and semantic errors.
80      */
81     validate?: boolean;
82     /**
83      * Defines whether comments are allowed or not. If set to false, comments will be reported as errors.
84      * DocumentLanguageSettings.allowComments will override this setting.
85      */
86     allowComments?: boolean;
87     /**
88      * A list of known schemas and/or associations of schemas to file names.
89      */
90     schemas?: SchemaConfiguration[];
91 }
92 export declare type SeverityLevel = 'error' | 'warning' | 'ignore';
93 export interface DocumentLanguageSettings {
94     /**
95      * The severity of reported comments. If not set, 'LanguageSettings.allowComments' defines whether comments are ignored or reported as errors.
96      */
97     comments?: SeverityLevel;
98     /**
99      * The severity of reported trailing commas. If not set, trailing commas will be reported as errors.
100      */
101     trailingCommas?: SeverityLevel;
102     /**
103      * The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used.
104      */
105     schemaValidation?: SeverityLevel;
106     /**
107      * The severity of problems that occurred when resolving and loading schemas. If set to 'ignore', schema resolving problems are not reported. If not set, 'warning' is used.
108      */
109     schemaRequest?: SeverityLevel;
110 }
111 export interface SchemaConfiguration {
112     /**
113      * The URI of the schema, which is also the identifier of the schema.
114      */
115     uri: string;
116     /**
117      * A list of file path glob patterns that are associated to the schema. The '*' and '**' wildcards can be used.
118      * Exclusion patterns starting with '!'.
119      * For example: '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'.
120      * A match succeeds when there is at least one pattern matching and last matching patter`n does not start with '!'.
121      */
122     fileMatch?: string[];
123     /**
124      * The schema for the given URI.
125      * If no schema is provided, the schema will be fetched with the schema request service (if available).
126      */
127     schema?: JSONSchema;
128 }
129 export interface WorkspaceContextService {
130     resolveRelativePath(relativePath: string, resource: string): string;
131 }
132 /**
133  * The schema request service is used to fetch schemas. If successful, returns a resolved promise with the content of the schema.
134  * In case of an error, returns a rejected promise with a displayable error string.
135  */
136 export interface SchemaRequestService {
137     (uri: string): Thenable<string>;
138 }
139 export interface PromiseConstructor {
140     /**
141      * Creates a new Promise.
142      * @param executor A callback used to initialize the promise. This callback is passed two arguments:
143      * a resolve callback used resolve the promise with a value or the result of another promise,
144      * and a reject callback used to reject the promise with a provided reason or error.
145      */
146     new <T>(executor: (resolve: (value?: T | Thenable<T | undefined>) => void, reject: (reason?: any) => void) => void): Thenable<T | undefined>;
147     /**
148      * Creates a Promise that is resolved with an array of results when all of the provided Promises
149      * resolve, or rejected when any Promise is rejected.
150      * @param values An array of Promises.
151      * @returns A new Promise.
152      */
153     all<T>(values: Array<T | Thenable<T>>): Thenable<T[]>;
154     /**
155      * Creates a new rejected promise for the provided reason.
156      * @param reason The reason the promise was rejected.
157      * @returns A new rejected Promise.
158      */
159     reject<T>(reason: any): Thenable<T>;
160     /**
161          * Creates a new resolved promise for the provided value.
162          * @param value A promise.
163          * @returns A promise whose internal state matches the provided promise.
164          */
165     resolve<T>(value: T | Thenable<T>): Thenable<T>;
166 }
167 export interface Thenable<R> {
168     /**
169     * Attaches callbacks for the resolution and/or rejection of the Promise.
170     * @param onfulfilled The callback to execute when the Promise is resolved.
171     * @param onrejected The callback to execute when the Promise is rejected.
172     * @returns A Promise for the completion of which ever callback is executed.
173     */
174     then<TResult>(onfulfilled?: (value: R) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
175     then<TResult>(onfulfilled?: (value: R) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
176 }
177 export interface LanguageServiceParams {
178     /**
179      * The schema request service is used to fetch schemas from a URI. The provider returns the schema file content, or,
180      * in case of an error, a displayable error string
181      */
182     schemaRequestService?: SchemaRequestService;
183     /**
184      * The workspace context is used to resolve relative paths for relative schema references.
185      */
186     workspaceContext?: WorkspaceContextService;
187     /**
188      * An optional set of completion and hover participants.
189      */
190     contributions?: JSONWorkerContribution[];
191     /**
192      * A promise constructor. If not set, the ES5 Promise will be used.
193      */
194     promiseConstructor?: PromiseConstructor;
195     /**
196      * Describes the LSP capabilities the client supports.
197      */
198     clientCapabilities?: ClientCapabilities;
199 }
200 /**
201  * Describes what LSP capabilities the client supports
202  */
203 export interface ClientCapabilities {
204     /**
205      * The text document client capabilities
206      */
207     textDocument?: {
208         /**
209          * Capabilities specific to completions.
210          */
211         completion?: {
212             /**
213              * The client supports the following `CompletionItem` specific
214              * capabilities.
215              */
216             completionItem?: {
217                 /**
218                  * Client supports the follow content formats for the documentation
219                  * property. The order describes the preferred format of the client.
220                  */
221                 documentationFormat?: MarkupKind[];
222                 /**
223                  * The client supports commit characters on a completion item.
224                  */
225                 commitCharactersSupport?: boolean;
226             };
227         };
228         /**
229          * Capabilities specific to hovers.
230          */
231         hover?: {
232             /**
233              * Client supports the follow content formats for the content
234              * property. The order describes the preferred format of the client.
235              */
236             contentFormat?: MarkupKind[];
237         };
238     };
239 }
240 export declare namespace ClientCapabilities {
241     const LATEST: ClientCapabilities;
242 }
243 export interface FoldingRangesContext {
244     /**
245      * The maximal number of ranges returned.
246      */
247     rangeLimit?: number;
248     /**
249      * Called when the result was cropped.
250      */
251     onRangeLimitExceeded?: (uri: string) => void;
252 }
253 export interface DocumentSymbolsContext {
254     /**
255      * The maximal number of document symbols returned.
256      */
257     resultLimit?: number;
258     /**
259      * Called when the result was cropped.
260      */
261     onResultLimitExceeded?: (uri: string) => void;
262 }
263 export interface ColorInformationContext {
264     /**
265      * The maximal number of color informations returned.
266      */
267     resultLimit?: number;
268     /**
269      * Called when the result was cropped.
270      */
271     onResultLimitExceeded?: (uri: string) => void;
272 }
273 export interface FormattingOptions extends LSPFormattingOptions {
274     insertFinalNewline?: boolean;
275 }