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

Request: Add another query for elements?

Open
#440 9 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.
I want to have swap functionality within more than just parameter lists. I want it on array elements and object constructor listings in all languages.

Describe the solution you'd like
I've already worked out how to set the treesitter queries for this for javascript. See below the highlights correspond to the query I just wrote for @element there on the top left:

image

I'm just not sure what the procedure is to introduce another semantic query to textobjects. I originally wanted to just extend @parameter.inner to also match these, but I figured that would probably not be the right way to go about it.

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

Start with the JavaScript Tree-sitter query described in the issue and the existing textobjects query setup. Determine how semantic queries are introduced, then cover array elements and object constructor listings across the supported languages so swapping works for those elements.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, neovim
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.