import { JSONWorkerContribution , JSONPath , Segment , CompletionsCollector } from './jsonContributions' ; import { JSONSchema } from './jsonSchema' ; import { Range , Position , DocumentUri , MarkupContent , MarkupKind , Color , ColorInformation , ColorPresentation , FoldingRange , FoldingRangeKind , SelectionRange , Diagnostic , DiagnosticSeverity , CompletionItem , CompletionItemKind , CompletionList , CompletionItemTag , InsertTextFormat , SymbolInformation , SymbolKind , DocumentSymbol , Location , Hover , MarkedString , FormattingOptions as LSPFormattingOptions , DefinitionLink , CodeActionContext , Command , CodeAction , DocumentHighlight , DocumentLink , WorkspaceEdit , TextEdit , CodeActionKind , TextDocumentEdit , VersionedTextDocumentIdentifier , DocumentHighlightKind } from 'vscode-languageserver-types' ; import { TextDocument } from 'vscode-languageserver-textdocument' ; export { TextDocument , Range , Position , DocumentUri , MarkupContent , MarkupKind , JSONSchema , JSONWorkerContribution , JSONPath , Segment , CompletionsCollector , Color , ColorInformation , ColorPresentation , FoldingRange , FoldingRangeKind , SelectionRange , Diagnostic , DiagnosticSeverity , CompletionItem , CompletionItemKind , CompletionList , CompletionItemTag , InsertTextFormat , DefinitionLink , SymbolInformation , SymbolKind , DocumentSymbol , Location , Hover , MarkedString , CodeActionContext , Command , CodeAction , DocumentHighlight , DocumentLink , WorkspaceEdit , TextEdit , CodeActionKind , TextDocumentEdit , VersionedTextDocumentIdentifier , DocumentHighlightKind } ; /**
 * Error codes used by diagnostics
 */ export enum ErrorCode { Undefined = 0 , EnumValueMismatch = 1 , Deprecated = 2 , UnexpectedEndOfComment = 0x101 , UnexpectedEndOfString = 0x102 , UnexpectedEndOfNumber = 0x103 , InvalidUnicode = 0x104 , InvalidEscapeCharacter = 0x105 , InvalidCharacter = 0x106 , PropertyExpected = 0x201 , CommaExpected = 0x202 , ColonExpected = 0x203 , ValueExpected = 0x204 , CommaOrCloseBacketExpected = 0x205 , CommaOrCloseBraceExpected = 0x206 , TrailingComma = 0x207 , DuplicateKey = 0x208 , CommentNotPermitted = 0x209 , SchemaResolveError = 0x300 } export type ASTNode = ObjectASTNode | PropertyASTNode | ArrayASTNode | StringASTNode | NumberASTNode | BooleanASTNode | NullASTNode ; export interface BaseASTNode { readonly type : 'object' | 'array' | 'property' | 'string' | 'number' | 'boolean' | 'null' ; readonly parent ? : ASTNode ; readonly offset : number ; readonly length : number ; readonly children ? : ASTNode [ ] ; readonly value ? : string | boolean | number | null ; } export interface ObjectASTNode extends BaseASTNode { readonly type : 'object' ; readonly properties : PropertyASTNode [ ] ; readonly children : ASTNode [ ] ; } export interface PropertyASTNode extends BaseASTNode { readonly type : 'property' ; readonly keyNode : StringASTNode ; readonly valueNode ? : ASTNode ; readonly colonOffset ? : number ; readonly children : ASTNode [ ] ; } export interface ArrayASTNode extends BaseASTNode { readonly type : 'array' ; readonly items : ASTNode [ ] ; readonly children : ASTNode [ ] ; } export interface StringASTNode extends BaseASTNode { readonly type : 'string' ; readonly value : string ; } export interface NumberASTNode extends BaseASTNode { readonly type : 'number' ; readonly value : number ; readonly isInteger : boolean ; } export interface BooleanASTNode extends BaseASTNode { readonly type : 'boolean' ; readonly value : boolean ; } export interface NullASTNode extends BaseASTNode { readonly type : 'null' ; readonly value : null ; } export interface MatchingSchema { node : ASTNode ; schema : JSONSchema ; } export interface JSONLanguageStatus { schemas : string [ ] ; } export interface LanguageSettings { /**
     * If set, the validator will return syntax and semantic errors.
     */ validate ? : boolean ; /**
     * Defines whether comments are allowed or not. If set to false, comments will be reported as errors.
     * DocumentLanguageSettings.allowComments will override this setting.
     */ allowComments ? : boolean ; /**
     * A list of known schemas and/or associations of schemas to file names.
     */ schemas ? : SchemaConfiguration [ ] ; } export type SeverityLevel = 'error' | 'warning' | 'ignore' ; export interface DocumentLanguageSettings { /**
     * The severity of reported comments. If not set, 'LanguageSettings.allowComments' defines whether comments are ignored or reported as errors.
     */ comments ? : SeverityLevel ; /**
     * The severity of reported trailing commas. If not set, trailing commas will be reported as errors.
     */ trailingCommas ? : SeverityLevel ; /**
     * The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used.
     */ schemaValidation ? : SeverityLevel ; /**
     * 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.
     */ schemaRequest ? : SeverityLevel ; } export interface SchemaConfiguration { /**
     * The URI of the schema, which is also the identifier of the schema.
     */ uri : string ; /**
     * A list of glob patterns that describe for which file URIs the JSON schema will be used.
     * '*' and '**' wildcards are supported. Exclusion patterns start with '!'.
     * For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'.
     * A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'.
     */ fileMatch ? : string [ ] ; /**
     * The schema for the given URI.
     * If no schema is provided, the schema will be fetched with the schema request service (if available).
     */ schema ? : JSONSchema ; } export interface WorkspaceContextService { resolveRelativePath ( relativePath , resource ) : string ; } /**
 * The schema request service is used to fetch schemas. If successful, returns a resolved promise with the content of the schema.
 * In case of an error, returns a rejected promise with a displayable error string.
 */ export interface SchemaRequestService { ( uri ) : Thenable < string > ; } export interface PromiseConstructor { param executor new < T > ( executor ) : Thenable < T | undefined > ; param values returns all < T > ( values ) : Thenable < T [ ] > ; param reason returns reject < T > ( reason ) : Thenable < T > ; param value returns resolve < T > ( value ) : Thenable < T > ; } export interface Thenable < R > { param onfulfilled param onrejected returns then < TResult > ( onfulfilled ? , onrejected ? ) : Thenable < TResult > ; then < TResult > ( onfulfilled ? , onrejected ? ) : Thenable < TResult > ; } export interface LanguageServiceParams { /**
     * The schema request service is used to fetch schemas from a URI. The provider returns the schema file content, or,
     * in case of an error, a displayable error string
     */ schemaRequestService ? : SchemaRequestService ; /**
     * The workspace context is used to resolve relative paths for relative schema references.
     */ workspaceContext ? : WorkspaceContextService ; /**
     * An optional set of completion and hover participants.
     */ contributions ? : JSONWorkerContribution [ ] ; /**
     * A promise constructor. If not set, the ES5 Promise will be used.
     */ promiseConstructor ? : PromiseConstructor ; /**
     * Describes the LSP capabilities the client supports.
     */ clientCapabilities ? : ClientCapabilities ; } /**
 * Describes what LSP capabilities the client supports
 */ export interface ClientCapabilities { /**
     * The text document client capabilities
     */ textDocument ? : { /**
         * Capabilities specific to completions.
         */ completion ? : { /**
             * The client supports the following `CompletionItem` specific
             * capabilities.
             */ completionItem ? : { /**
                 * Client supports the follow content formats for the documentation
                 * property. The order describes the preferred format of the client.
                 */ documentationFormat ? : MarkupKind [ ] ; /**
                 * The client supports commit characters on a completion item.
                 */ commitCharactersSupport ? : boolean ; } ; } ; /**
         * Capabilities specific to hovers.
         */ hover ? : { /**
             * Client supports the follow content formats for the content
             * property. The order describes the preferred format of the client.
             */ contentFormat ? : MarkupKind [ ] ; } ; } ; } export namespace ClientCapabilities { export const LATEST = { textDocument : { completion : { completionItem : { documentationFormat : [ MarkupKind . Markdown , MarkupKind . PlainText ] , commitCharactersSupport : true } } } } ; } export interface FoldingRangesContext { /**
     * The maximal number of ranges returned.
     */ rangeLimit ? : number ; /**
     * Called when the result was cropped.
     */ onRangeLimitExceeded ? : ( uri : string ) => void ; } export interface DocumentSymbolsContext { /**
     * The maximal number of document symbols returned.
     */ resultLimit ? : number ; /**
     * Called when the result was cropped.
     */ onResultLimitExceeded ? : ( uri : string ) => void ; } export interface ColorInformationContext { /**
     * The maximal number of color informations returned.
     */ resultLimit ? : number ; /**
     * Called when the result was cropped.
     */ onResultLimitExceeded ? : ( uri : string ) => void ; } export interface FormattingOptions extends LSPFormattingOptions { insertFinalNewline ? : boolean ; }