Skip to content

JSONPath Tools / @jsonpath-tools/jsonpath / EditorService

Class: EditorService

Provides services for JSONPath editors.

Constructors

new EditorService()

ts
new EditorService(): EditorService

Returns

EditorService

Methods

getCompletions()

ts
getCompletions(position): CompletionItem[]

Provides completion items at the given caret position in the query text.

Parameters

position

number

Caret position in the query text (starts with 0).

Returns

CompletionItem[]


getDiagnostics()

ts
getDiagnostics(): Diagnostics[]

Provides the query errors and warnings.

Returns

Diagnostics[]


getDocumentHighlights()

ts
getDocumentHighlights(position): DocumentHighlight[]

Provides document highlights at the given caret position in the query text.

Parameters

position

number

Caret position in the query text (starts with 0).

Returns

DocumentHighlight[]


getFormattingEdits()

ts
getFormattingEdits(): TextChange[]

Provides text changes that can be used to format the query text.

Returns

TextChange[]


getResult()

ts
getResult(): NodeList

Returns the query result (selected nodes).

Returns

NodeList


getSignature()

ts
getSignature(position): null | Signature

Provides a signature at the given caret position in the query text. When no signature is available it returns null.

Parameters

position

number

Caret position in the query text (starts with 0).

Returns

null | Signature


getTooltip()

ts
getTooltip(position): null | Tooltip

Provides a tooltip at the given position in the query text.

Parameters

position

number

Position in the query text (character index).

Returns

null | Tooltip


updateQuery()

ts
updateQuery(newQuery): void

Updates edited query text.

Parameters

newQuery

string

New text of the edited query.

Returns

void

See

updateQueryPartial for partial update.


updateQueryArgument()

ts
updateQueryArgument(newQueryArgument): void

Updates query argument.

Parameters

newQueryArgument

New query argument.

undefined | JSONValue

Returns

void


updateQueryArgumentType()

ts
updateQueryArgumentType(newQueryArgumentType): void

Updates query argument type.

Parameters

newQueryArgumentType

DataType

New query argument type.

Returns

void


updateQueryOptions()

ts
updateQueryOptions(newQueryOptions): void

Updates query options.

Parameters

newQueryOptions

QueryOptions

New query options.

Returns

void


updateQueryPartial()

ts
updateQueryPartial(queryTextChanges): void

Updates part of edited query text.

Parameters

queryTextChanges

readonly TextChange[]

Text changes that should be applied to the edited query text.

Returns

void

See

updateQuery for full update.