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

Operator pending linewise mode override not observed for motions

Open
#592 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

With the default bindings for move text object motions.
Opening a buffer with the below text:

/* comment before function */
int
main (void)
{

 ;
 return 0;
}

Positioning cursor just after comment in the comment.
Use dV]m.
Observe that buffer now contains the below:

/* commentnt
main (void)
{

 ;
 return 0;
}

This indicates that the override requesting "linewise" selection for this
operation has not been observed.

TBH not sure if this is a feature request or a bug report.

As per the bug format ...
:checkhealth nvim-treesitter

nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only
needed for :TSInstallFromGrammar, not required for :TSInstall)
- WARNING `node` executable not found (only needed for
:TSInstallFromGrammar, not required for :TSInstall)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc",
"clang", "cl", "zig" }
 Version: cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
- OK Neovim was compiled with tree-sitter runtime ABI version 14
(required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
 machine = "x86_64",
 release = "5.15.0-101-generic",
 sysname = "Linux",
 version = "#111-Ubuntu SMP Tue Mar 5 20:16:58 UTC 2024"
} ~

Parser/Features         H L F I J
 - bash                ✓ ✓ ✓ . ✓
 - c                   ✓ ✓ ✓ ✓ ✓
 - cpp                 ✓ ✓ ✓ ✓ ✓
 - lua                 ✓ ✓ ✓ ✓ ✓
 - markdown            ✓ . ✓ ✓ ✓
 - markdown_inline     ✓ . . . ✓
 - python              ✓ ✓ ✓ ✓ ✓
 - query               ✓ ✓ ✓ ✓ ✓
 - vim                 ✓ ✓ ✓ . ✓
 - vimdoc              ✓ . . . ✓

 Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
        +) multiple parsers found, only one will be used
        x) errors found in the query, try to run :TSUpdate {lang} ~

And Just in case it matters ...
:checkhealth vim.treesitter

vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14
- OK Parser: c          ABI: 14, path:
/home/matmal01/.config/nvim/bundle/nvim-treesitter/parser/c.so
- OK Parser: cpp        ABI: 14, path:
/home/matmal01/.config/nvim/bundle/nvim-treesitter/parser/cpp.so
- OK Parser: lua        ABI: 14, path:
/home/matmal01/.config/nvim/bundle/nvim-treesitter/parser/lua.so
- OK Parser: python     ABI: 14, path:
/home/matmal01/.config/nvim/bundle/nvim-treesitter/parser/python.so
- OK Parser: query      ABI: 14, path:
/home/matmal01/.config/nvim/bundle/nvim-treesitter/parser/query.so
- OK Parser: vim        ABI: 14, path:
/home/matmal01/.config/nvim/bundle/nvim-treesitter/parser/vim.so
- OK Parser: vimdoc     ABI: 14, path:
/home/matmal01/.config/nvim/bundle/nvim-treesitter/parser/vimdoc.so
- OK Parser: bash       ABI: 14, path:
/home/matmal01/bin/neovim/lib/nvim/parser/bash.so
- OK Parser: c          ABI: 14, path:
/home/matmal01/bin/neovim/lib/nvim/parser/c.so
- OK Parser: lua        ABI: 14, path:
/home/matmal01/bin/neovim/lib/nvim/parser/lua.so
- OK Parser: markdown   ABI: 14, path:
/home/matmal01/bin/neovim/lib/nvim/parser/markdown.so
- OK Parser: markdown_inline ABI: 14, path:
/home/matmal01/bin/neovim/lib/nvim/parser/markdown_inline.so
- OK Parser: python     ABI: 14, path:
/home/matmal01/bin/neovim/lib/nvim/parser/python.so
- OK Parser: query      ABI: 14, path:
/home/matmal01/bin/neovim/lib/nvim/parser/query.so
- OK Parser: vim        ABI: 14, path:
/home/matmal01/bin/neovim/lib/nvim/parser/vim.so
- OK Parser: vimdoc     ABI: 14, path:
/home/matmal01/bin/neovim/lib/nvim/parser/vimdoc.so

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

First reproduce the issue in Neovim with the shown C buffer and the dV]m motion, then inspect the nvim-treesitter-textobjects motion and selection handling involved in the default move bindings. Done means the operation honors the linewise override and produces the expected deletion rather than leaving commentnt and the following lines.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, vim
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.