Function findDeclarationNodeAtOffset

  • Performs findLeafNodeAtOffset with a minor difference: When encountering a character that matches the nameRegexp argument, it will instead return the leaf node at the offset - 1 position.

    For LSP services, users expect that the declaration of an element is available if the cursor is directly after the element.

    Parameters

    • cstNode: undefined | CstNode
    • offset: number
    • nameRegexp: RegExp = DefaultNameRegexp

    Returns LeafCstNode | undefined