Skip to content

getNodeAtLocation replacement #129

Closed

Description

@chfritz

I'm using this extension as a dependency in sane-indentation where I'm heavily relying on the now deprecated getNodeAtLocation function. Any idea on how to use createQuery to replace it?

Activity

  1. chfritz commented on Mar 26, 2026

    @chfritz
    Author

    Looks like this works, actually:

    const { getTree } = await parseTreeExtension.activate();
    const node = getTree(textEditor.document).rootNode.descendantForPosition({
      row: line,
      column: character
    });

    Might make for a nice poly-fill to avoid or undo the recent breaking change? Example

  2. AndreasArvidsson commented on Mar 26, 2026

    @AndreasArvidsson
    Member

    That was literally the implementation before. I deprecated get node at location because I didn't think anyone was using it. If it is useful I can definitely re-add it.

  3. AndreasArvidsson commented on Mar 26, 2026

    @AndreasArvidsson
    Member

    getNodeAtLocation Re-added. Enjoy! :)
    #130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions