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

Text object @parameter does not work after undo with `u`

Open
#498 2 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

Describe the bug
When I use dia or daa (my configured commands to delete inner parameter and outer parameter respectively), after undoing those commands with u, I cannot use ia or aa to select parameter in the current buffer anymore. I have to open a new buffer for them to work again.

To Reproduce
Steps to reproduce the behavior:

  1. Open a csharp file with configured treesitter and treesitter textobjects.
  2. Trigger command to delete inner or outer parameter using @parameter text object.
  3. Press u to undo the change.
  4. Try to select another parameter, it will not work.

Expected behavior
@parameter TextObject should work regardless of whether or not I press u.

Output of :checkhealth nvim-treesitter

Installation ~

  • WARNING tree-sitter executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
  • OK node found v18.18.0 (only needed for :TSInstallFromGrammar)
  • 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.90.1-microsoft-standard-WSL2",
sysname = "Linux",
version = "#1 SMP Fri Jan 27 02:56:13 UTC 2023"
} ~

Parser/Features H L F I J

  • c ✓ ✓ ✓ ✓ ✓
  • c_sharp ✓ ✓ ✓ . ✓
  • cpp ✓ ✓ ✓ ✓ ✓
  • go ✓ ✓ ✓ ✓ ✓
  • javascript ✓ ✓ ✓ ✓ ✓
  • lua ✓ ✓ ✓ ✓ ✓
  • luadoc ✓ . . . .
  • luap ✓ . . . .
  • markdown ✓ . ✓ ✓ ✓
  • python ✓ ✓ ✓ ✓ ✓
  • rust ✓ ✓ ✓ ✓ ✓
  • tsx ✓ ✓ ✓ ✓ ✓
  • typescript ✓ ✓ ✓ ✓ ✓
  • 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} ~

Output of nvim --version

NVIM v0.10.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Run "nvim -V1 -v" for more info

Additional context
Add any other context about the problem here.

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 report names no source file or test; begin with the reproduction entry points dia/daa, undo with u, and selection with ia/aa in a C# buffer. Confirm that @parameter selection fails only after undo, then identify the affected text-object or parser state and add coverage showing selection still works after undo.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
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.