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

`textobjects: swap` breaks on nightly

Open
#778 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
can not use swap feature on nightly

To Reproduce
Steps to reproduce the behavior:

init.lua:

require("nvim-treesitter.configs").setup({
	textobjects = {
		swap = {
			enable = true,
			swap_next = {
				["<leader>a"] = "@parameter.inner",
			},
			swap_previous = {
				["<leader>A"] = "@parameter.inner",
			},
		},
	},
})

a.lua:

print(1, 2)
  1. run nvim a.lua
  2. move cursor to 1
  3. press <leader>a

Expected behavior
swap 1 and 2

Output of :checkhealth nvim-treesitter

============================================================================== nvim-treesitter: 1 ⚠️

Installation ~

  • ⚠️ WARNING tree-sitter executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
  • ✅ OK node found v24.1.0 (only needed for :TSInstallFromGrammar)
  • ✅ OK git executable found.
  • ✅ OK cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: cc (GCC) 15.1.1 20250425
  • ✅ OK Neovim was compiled with tree-sitter runtime ABI version 15 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
machine = "x86_64",
release = "6.14.10-arch1-1",
sysname = "Linux",
version = "#1 SMP PREEMPT_DYNAMIC Wed, 04 Jun 2025 18:52:35 +0000"
} ~

Parser/Features H L F I J

  • bash ✓ ✓ ✓ . ✓
  • c ✓ ✓ ✓ ✓ ✓
  • commonlisp ✓ ✓ ✓ . ✓
  • cpp ✓ ✓ ✓ ✓ ✓
  • css ✓ . ✓ ✓ ✓
  • csv ✓ . . . .
  • diff ✓ . ✓ . ✓
  • git_rebase ✓ . . . ✓
  • gitcommit ✓ . . . ✓
  • go ✓ ✓ ✓ ✓ ✓
  • html ✓ ✓ ✓ ✓ ✓
  • ini ✓ . ✓ . ✓
  • java . ✓ ✓ ✓ ✓
  • javascript ✓ ✓ ✓ ✓ ✓
  • json ✓ ✓ ✓ ✓ .
  • lua ✓ ✓ ✓ ✓ ✓
  • markdown . . ✓ ✓ ✓
  • markdown_inline . . . . ✓
  • python ✓ ✓ ✓ ✓ ✓
  • query ✓ ✓ ✓ ✓ ✓
  • rust ✓ ✓ ✓ ✓ ✓
  • scheme ✓ . ✓ . ✓
  • toml ✓ ✓ ✓ ✓ ✓
  • vim ✓ ✓ ✓ . ✓
  • vimdoc ✓ . . . ✓
  • xml ✓ ✓ ✓ ✓ ✓
  • yaml ✓ ✓ ✓ ✓ ✓
  • zathurarc ✓ . . . ✓

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.12.0-dev-535+g811e12cebc
Build type: RelWithDebInfo
LuaJIT 2.1.1744317938
Run "nvim -V1 -v" for more info

Additional context
works on 0.11.2

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

Reproduce the failure using the init.lua configuration and a.lua example on Neovim nightly, then compare the same steps with 0.11.2. Trace the textobjects swap entry point and verify that pressing a swaps the two parameters as expected.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.