nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects

Suggestion: Node Text Object

Open
#333 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Tree-sitter Query
Stars
2.8k
Forks
271
Avg merge
8d 8h
Merged PRs (30d)
1

Description

Is your feature request related to a problem? Please describe.
Rather generic text objects also seem to be useful, I use statement or block surprisingly often. I was thinking, that a simply text object "node" might be a nice addition to those.

Describe the solution you'd like
A node text object, which is the "smallest" node treesitter can recognize. For example, inner node would be a string without quotation marks, and outer node would be a node with quotation marks.

Describe alternatives you've considered
Creating a custom text object with a plugin like mini.ai, but that does not achieve the level of genericness required for this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by locating the existing statement and block text objects and their Tree-sitter query entry points. Clarify how inner and outer node boundaries should work across node types, then add coverage showing the proposed node text object selects the intended ranges.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.