vscode-json-languageservice
- Version 6.0.0-next.3
- Published
- 362 kB
- 5 dependencies
- MIT license
Install
npm i vscode-json-languageserviceyarn add vscode-json-languageservicepnpm add vscode-json-languageserviceOverview
Language service for JSON
Index
Functions
Interfaces
JSONSchema
- $anchor
- $comment
- $defs
- $dynamicAnchor
- $dynamicRef
- $id
- $recursiveAnchor
- $recursiveRef
- $ref
- $schema
- $vocabulary
- additionalItems
- additionalProperties
- allOf
- allowComments
- allowTrailingCommas
- anyOf
- completionDetail
- const
- contains
- default
- defaultSnippets
- definitions
- dependencies
- dependentRequired
- dependentSchemas
- deprecated
- deprecationMessage
- description
- doNotSuggest
- else
- enum
- enumDescriptions
- enumDetails
- enumSortTexts
- errorMessage
- examples
- exclusiveMaximum
- exclusiveMinimum
- format
- id
- if
- items
- markdownDescription
- markdownEnumDescriptions
- maxContains
- maximum
- maxItems
- maxLength
- maxProperties
- minContains
- minimum
- minItems
- minLength
- minProperties
- multipleOf
- not
- oneOf
- pattern
- patternErrorMessage
- patternProperties
- prefixItems
- properties
- propertyNames
- required
- suggestSortText
- then
- title
- type
- unevaluatedItems
- unevaluatedProperties
- uniqueItems
LanguageService
- configure()
- doComplete()
- doHover()
- doResolve()
- doValidation()
- findDefinition()
- findDocumentColors()
- findDocumentSymbols()
- findDocumentSymbols2()
- findLinks()
- format()
- getColorPresentations()
- getFoldingRanges()
- getLanguageStatus()
- getMatchingSchemas()
- getSelectionRanges()
- newJSONDocument()
- parseJSONDocument()
- resetSchema()
- sort()
Enums
ErrorCode
- ColonExpected
- CommaExpected
- CommaOrCloseBacketExpected
- CommaOrCloseBraceExpected
- CommentNotPermitted
- Deprecated
- DuplicateKey
- EnumValueMismatch
- InvalidCharacter
- InvalidEscapeCharacter
- InvalidUnicode
- PropertyExpected
- PropertyKeysMustBeDoublequoted
- SchemaResolveError
- SchemaUnsupportedFeature
- TrailingComma
- Undefined
- UnexpectedEndOfComment
- UnexpectedEndOfNumber
- UnexpectedEndOfString
- ValueExpected
Type Aliases
Namespaces
Functions
function getLanguageService
getLanguageService: (params: LanguageServiceParams) => LanguageService;function isSchemaResolveError
isSchemaResolveError: (code: number) => boolean;Interfaces
interface ArrayASTNode
interface ArrayASTNode extends BaseASTNode {}interface BaseASTNode
interface BaseASTNode {}property children
readonly children?: ASTNode[];property length
readonly length: number;property offset
readonly offset: number;property parent
readonly parent?: ASTNode;property type
readonly type: | 'object' | 'array' | 'property' | 'string' | 'number' | 'boolean' | 'null';property value
readonly value?: string | boolean | number | null;interface BooleanASTNode
interface BooleanASTNode extends BaseASTNode {}interface ClientCapabilities
interface ClientCapabilities {}Describes what LSP capabilities the client supports
property textDocument
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; /** * The client has support for completion item label * details (see also `CompletionItemLabelDetails`). */ labelDetailsSupport?: 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[]; };};The text document client capabilities
interface ColorInformationContext
interface ColorInformationContext {}property onResultLimitExceeded
onResultLimitExceeded?: (uri: string) => void;Called when the result was cropped.
property resultLimit
resultLimit?: number;The maximal number of color informations returned.
interface CompletionsCollector
interface CompletionsCollector {}method add
add: (suggestion: JSONCompletionItem & { insertText: string }) => void;method error
error: (message: string) => void;method getNumberOfProposals
getNumberOfProposals: () => number;method setAsIncomplete
setAsIncomplete: () => void;interface DocumentLanguageSettings
interface DocumentLanguageSettings {}property comments
comments?: SeverityLevel;The severity of reported comments. If not set, 'LanguageSettings.allowComments' defines whether comments are ignored or reported as errors.
property schemaDraft
schemaDraft?: SchemaDraft;The draft version of schema to use if the schema doesn't specify one at $schema
property schemaRequest
schemaRequest?: 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.
property schemaValidation
schemaValidation?: SeverityLevel;The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used.
property trailingCommas
trailingCommas?: SeverityLevel;The severity of reported trailing commas. If not set, trailing commas will be reported as errors.
interface DocumentSymbolsContext
interface DocumentSymbolsContext {}property onResultLimitExceeded
onResultLimitExceeded?: (uri: string) => void;Called when the result was cropped.
property resultLimit
resultLimit?: number;The maximal number of document symbols returned.
interface FoldingRangesContext
interface FoldingRangesContext {}property onRangeLimitExceeded
onRangeLimitExceeded?: (uri: string) => void;Called when the result was cropped.
property rangeLimit
rangeLimit?: number;The maximal number of ranges returned.
interface FormattingOptions
interface FormattingOptions extends LSPFormattingOptions {}property insertFinalNewline
insertFinalNewline?: boolean;property keepLines
keepLines?: boolean;interface JSONLanguageStatus
interface JSONLanguageStatus {}property schemas
schemas: string[];interface JSONSchema
interface JSONSchema {}property $anchor
$anchor?: string;property $comment
$comment?: string;property $defs
$defs?: { [name: string]: JSONSchema;};property $dynamicAnchor
$dynamicAnchor?: string;property $dynamicRef
$dynamicRef?: string;property $id
$id?: string;property $recursiveAnchor
$recursiveAnchor?: boolean;property $recursiveRef
$recursiveRef?: string;property $ref
$ref?: string;property $schema
$schema?: string;property $vocabulary
$vocabulary?: { [uri: string]: boolean;};property additionalItems
additionalItems?: JSONSchemaRef;property additionalProperties
additionalProperties?: JSONSchemaRef;property allOf
allOf?: JSONSchemaRef[];property allowComments
allowComments?: boolean;property allowTrailingCommas
allowTrailingCommas?: boolean;property anyOf
anyOf?: JSONSchemaRef[];property completionDetail
completionDetail?: string;property const
const?: any;property contains
contains?: JSONSchemaRef;property default
default?: any;property defaultSnippets
defaultSnippets?: { label?: string; description?: string; markdownDescription?: string; body?: any; bodyText?: string;}[];property definitions
definitions?: { [name: string]: JSONSchema;};property dependencies
dependencies?: | JSONSchemaMap | { [prop: string]: string[]; };property dependentRequired
dependentRequired?: { [prop: string]: string[];};property dependentSchemas
dependentSchemas?: JSONSchemaMap;property deprecated
deprecated?: boolean;property deprecationMessage
deprecationMessage?: string;property description
description?: string;property doNotSuggest
doNotSuggest?: boolean;property else
else?: JSONSchemaRef;property enum
enum?: any[];property enumDescriptions
enumDescriptions?: string[];property enumDetails
enumDetails?: string[];property enumSortTexts
enumSortTexts?: string[];property errorMessage
errorMessage?: string;property examples
examples?: any[];property exclusiveMaximum
exclusiveMaximum?: boolean | number;property exclusiveMinimum
exclusiveMinimum?: boolean | number;property format
format?: string;property id
id?: string;property if
if?: JSONSchemaRef;property items
items?: JSONSchemaRef | JSONSchemaRef[];property markdownDescription
markdownDescription?: string;property markdownEnumDescriptions
markdownEnumDescriptions?: string[];property maxContains
maxContains?: number;property maximum
maximum?: number;property maxItems
maxItems?: number;property maxLength
maxLength?: number;property maxProperties
maxProperties?: number;property minContains
minContains?: number;property minimum
minimum?: number;property minItems
minItems?: number;property minLength
minLength?: number;property minProperties
minProperties?: number;property multipleOf
multipleOf?: number;property not
not?: JSONSchemaRef;property oneOf
oneOf?: JSONSchemaRef[];property pattern
pattern?: string;property patternErrorMessage
patternErrorMessage?: string;property patternProperties
patternProperties?: JSONSchemaMap;property prefixItems
prefixItems?: JSONSchemaRef[];property properties
properties?: JSONSchemaMap;property propertyNames
propertyNames?: JSONSchemaRef;property required
required?: string[];property suggestSortText
suggestSortText?: string;property then
then?: JSONSchemaRef;property title
title?: string;property type
type?: string | string[];property unevaluatedItems
unevaluatedItems?: boolean | JSONSchemaRef;property unevaluatedProperties
unevaluatedProperties?: boolean | JSONSchemaRef;property uniqueItems
uniqueItems?: boolean;interface JSONWorkerContribution
interface JSONWorkerContribution {}method collectDefaultCompletions
collectDefaultCompletions: ( uri: string, result: CompletionsCollector) => PromiseLike<any>;method collectPropertyCompletions
collectPropertyCompletions: ( uri: string, location: JSONPath, currentWord: string, addValue: boolean, isLast: boolean, result: CompletionsCollector) => PromiseLike<any>;method collectValueCompletions
collectValueCompletions: ( uri: string, location: JSONPath, propertyKey: string, result: CompletionsCollector) => PromiseLike<any>;method getInfoContribution
getInfoContribution: ( uri: string, location: JSONPath) => PromiseLike<MarkedString[]>;method resolveCompletion
resolveCompletion: (item: CompletionItem) => PromiseLike<CompletionItem>;interface LanguageService
interface LanguageService {}method configure
configure: (settings: LanguageSettings) => void;method doComplete
doComplete: ( document: TextDocument, position: Position, doc: JSONDocument) => PromiseLike<CompletionList | null>;method doHover
doHover: ( document: TextDocument, position: Position, doc: JSONDocument) => PromiseLike<Hover | null>;method doResolve
doResolve: (item: CompletionItem) => PromiseLike<CompletionItem>;method doValidation
doValidation: ( document: TextDocument, jsonDocument: JSONDocument, documentSettings?: DocumentLanguageSettings, schema?: JSONSchema) => PromiseLike<Diagnostic[]>;method findDefinition
findDefinition: ( document: TextDocument, position: Position, doc: JSONDocument) => PromiseLike<DefinitionLink[]>;method findDocumentColors
findDocumentColors: ( document: TextDocument, doc: JSONDocument, context?: DocumentColorsContext) => PromiseLike<ColorInformation[]>;method findDocumentSymbols
findDocumentSymbols: ( document: TextDocument, doc: JSONDocument, context?: DocumentSymbolsContext) => SymbolInformation[];method findDocumentSymbols2
findDocumentSymbols2: ( document: TextDocument, doc: JSONDocument, context?: DocumentSymbolsContext) => DocumentSymbol[];method findLinks
findLinks: ( document: TextDocument, doc: JSONDocument) => PromiseLike<DocumentLink[]>;method format
format: ( document: TextDocument, range: Range | undefined, options: FormattingOptions) => TextEdit[];method getColorPresentations
getColorPresentations: ( document: TextDocument, doc: JSONDocument, color: Color, range: Range) => ColorPresentation[];method getFoldingRanges
getFoldingRanges: ( document: TextDocument, context?: FoldingRangesContext) => FoldingRange[];method getLanguageStatus
getLanguageStatus: ( document: TextDocument, jsonDocument: JSONDocument) => JSONLanguageStatus;method getMatchingSchemas
getMatchingSchemas: ( document: TextDocument, jsonDocument: JSONDocument, schema?: JSONSchema) => PromiseLike<MatchingSchema[]>;method getSelectionRanges
getSelectionRanges: ( document: TextDocument, positions: Position[], doc: JSONDocument) => SelectionRange[];method newJSONDocument
newJSONDocument: ( rootNode: ASTNode | undefined, syntaxDiagnostics?: Diagnostic[], comments?: Range[]) => JSONDocument;method parseJSONDocument
parseJSONDocument: (document: TextDocument) => JSONDocument;method resetSchema
resetSchema: (uri: string) => boolean;method sort
sort: (document: TextDocument, options: SortOptions) => TextEdit[];interface LanguageServiceParams
interface LanguageServiceParams {}property clientCapabilities
clientCapabilities?: ClientCapabilities;Describes the LSP capabilities the client supports.
property contributions
contributions?: JSONWorkerContribution[];An optional set of completion and hover participants.
property promiseConstructor
promiseConstructor?: PromiseConstructor;A promise constructor. If not set, the ES5 Promise will be used.
property schemaRequestService
schemaRequestService?: SchemaRequestService;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
property workspaceContext
workspaceContext?: WorkspaceContextService;The workspace context is used to resolve relative paths for relative schema references.
interface LanguageSettings
interface LanguageSettings {}property allowComments
allowComments?: boolean;Defines whether comments are allowed or not. If set to false, comments will be reported as errors. DocumentLanguageSettings.allowComments will override this setting.
property schemas
schemas?: SchemaConfiguration[];A list of known schemas and/or associations of schemas to file names.
property validate
validate?: boolean;If set, the validator will return syntax and semantic errors.
interface MatchingSchema
interface MatchingSchema {}interface NullASTNode
interface NullASTNode extends BaseASTNode {}interface NumberASTNode
interface NumberASTNode extends BaseASTNode {}interface ObjectASTNode
interface ObjectASTNode extends BaseASTNode {}property children
readonly children: ASTNode[];property properties
readonly properties: PropertyASTNode[];property type
readonly type: 'object';interface PromiseConstructor
interface PromiseConstructor {}method all
all: <T>(values: Array<T | PromiseLike<T>>) => PromiseLike<T[]>;Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.
Parameter values
An array of Promises.
Returns
A new Promise.
method reject
reject: <T>(reason: any) => PromiseLike<T>;Creates a new rejected promise for the provided reason.
Parameter reason
The reason the promise was rejected.
Returns
A new rejected Promise.
method resolve
resolve: <T>(value: T | PromiseLike<T>) => PromiseLike<T>;Creates a new resolved promise for the provided value.
Parameter value
A promise.
Returns
A promise whose internal state matches the provided promise.
construct signature
new <T>( executor: ( resolve: (value?: T | PromiseLike<T | undefined>) => void, reject: (reason?: any) => void ) => void): PromiseLike<T | undefined>;Creates a new Promise.
Parameter executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.
interface PropertyASTNode
interface PropertyASTNode extends BaseASTNode {}property children
readonly children: ASTNode[];property colonOffset
readonly colonOffset?: number;property keyNode
readonly keyNode: StringASTNode;property type
readonly type: 'property';property valueNode
readonly valueNode?: ASTNode;interface SchemaConfiguration
interface SchemaConfiguration {}property fileMatch
fileMatch?: 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 '!'.
property folderUri
folderUri?: string;A parent folder for folder specifc associations. An association that has a folder URI set is only used if the document that is validated has the folderUri as parent
property schema
schema?: JSONSchema;The schema for the given URI. If no schema is provided, the schema will be fetched with the schema request service (if available).
property uri
uri: string;The URI of the schema, which is also the identifier of the schema.
interface SchemaRequestService
interface SchemaRequestService {}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 an Error object. If the type is of form { message: string, code: number }, the error code will be used for diagnostics.
call signature
(uri: string): PromiseLike<string>;interface SortOptions
interface SortOptions extends LSPFormattingOptions {}property insertFinalNewline
insertFinalNewline?: boolean;interface StringASTNode
interface StringASTNode extends BaseASTNode {}interface Thenable
interface Thenable<R> extends PromiseLike<R> {}A deprecated alias of PromiseLike
Deprecated
interface WorkspaceContextService
interface WorkspaceContextService {}method resolveRelativePath
resolveRelativePath: (relativePath: string, resource: string) => string;Enums
enum ErrorCode
enum ErrorCode { Undefined = 0, EnumValueMismatch = 1, Deprecated = 2, UnexpectedEndOfComment = 257, UnexpectedEndOfString = 258, UnexpectedEndOfNumber = 259, InvalidUnicode = 260, InvalidEscapeCharacter = 261, InvalidCharacter = 262, PropertyExpected = 513, CommaExpected = 514, ColonExpected = 515, ValueExpected = 516, CommaOrCloseBacketExpected = 517, CommaOrCloseBraceExpected = 518, TrailingComma = 519, DuplicateKey = 520, CommentNotPermitted = 521, PropertyKeysMustBeDoublequoted = 528, SchemaUnsupportedFeature = 769, SchemaResolveError = 65536,}Error codes used by diagnostics
member ColonExpected
ColonExpected = 515member CommaExpected
CommaExpected = 514member CommaOrCloseBacketExpected
CommaOrCloseBacketExpected = 517member CommaOrCloseBraceExpected
CommaOrCloseBraceExpected = 518member CommentNotPermitted
CommentNotPermitted = 521member Deprecated
Deprecated = 2member DuplicateKey
DuplicateKey = 520member EnumValueMismatch
EnumValueMismatch = 1member InvalidCharacter
InvalidCharacter = 262member InvalidEscapeCharacter
InvalidEscapeCharacter = 261member InvalidUnicode
InvalidUnicode = 260member PropertyExpected
PropertyExpected = 513member PropertyKeysMustBeDoublequoted
PropertyKeysMustBeDoublequoted = 528member SchemaResolveError
SchemaResolveError = 65536member SchemaUnsupportedFeature
SchemaUnsupportedFeature = 769member TrailingComma
TrailingComma = 519member Undefined
Undefined = 0member UnexpectedEndOfComment
UnexpectedEndOfComment = 257member UnexpectedEndOfNumber
UnexpectedEndOfNumber = 259member UnexpectedEndOfString
UnexpectedEndOfString = 258member ValueExpected
ValueExpected = 516Type Aliases
type ASTNode
type ASTNode = | ObjectASTNode | PropertyASTNode | ArrayASTNode | StringASTNode | NumberASTNode | BooleanASTNode | NullASTNode;type JSONDocument
type JSONDocument = { root: ASTNode | undefined; getNodeFromOffset( offset: number, includeRightBound?: boolean ): ASTNode | undefined;};type JSONPath
type JSONPath = Segment[];type Segment
type Segment = string | number;type SeverityLevel
type SeverityLevel = 'error' | 'warning' | 'ignore';type Vocabularies
type Vocabularies = Map<string, boolean>;Represents active JSON Schema vocabularies with their required/optional status. Key = vocabulary URI, Value = true if required, false if optional. Both required and optional vocabularies are active; the boolean indicates whether the validator must understand it (true) or should understand it (false). 2019-09
Namespaces
namespace ClientCapabilities
namespace ClientCapabilities {}variable LATEST
const LATEST: ClientCapabilities;Package Files (4)
Dependencies (5)
Dev Dependencies (7)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/vscode-json-languageservice.
- Markdown[](https://www.jsdocs.io/package/vscode-json-languageservice)
- HTML<a href="https://www.jsdocs.io/package/vscode-json-languageservice"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4192 ms. - Missing or incorrect documentation? Open an issue for this package.
