Skip to content

[F] getNodeAtPosition

getNodeAtPosition(script, position, filter)

function getNodeAtPosition(
script,
position,
filter?): Node | undefined

Resolve the node in the syntax tree that that is at the given position.

Parameters

ParameterTypeDescription
scriptTypeSpecScriptNodeTypeSpec Script node
positionnumberPosition
filter?(node) => booleanFilter if wanting to return a parent containing node early.

Returns

Node | undefined

getNodeAtPosition(script, position, filter)

function getNodeAtPosition<T>(
script,
position,
filter): T | undefined

Type Parameters

Type Parameter
T extends Node

Parameters

ParameterType
scriptTypeSpecScriptNode
positionnumber
filter(node) => node is T

Returns

T | undefined