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

Specify if query selects last line or not

Open
#620 0 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 create a query for C for inner block

Query

(compound_statement
  .
  "{"
  .
  (_) @_start @_end
  (_)? @_end
  .
  "}"
  (#make-range! "block.inner" @_start @_end))

I have
Capture d'écran 2024-05-18 102507
I want
Capture d'écran 2024-05-18 102515

If the block is a function it works though
Capture d'écran 2024-05-18 102621

Describe the solution you'd like
I do not know if it's treesitter the problem or this package. I don't know the intricacies of treesitter so I'm unsure where to post or what the solution should be.

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 by reproducing the C inner-block query from the issue and compare its behavior with the function-block case. Read the Tree-sitter query and nvim-treesitter-textobjects behavior to determine whether selecting the last line belongs to Tree-sitter or this package; done means the ownership and expected selection semantics are established.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.