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

Swap doesn't work with commented code

Open
#765 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

Describe the bug
Swap doesn't work with commented code

To Reproduce
Download minimal init.lua: https://gist.github.com/kuator/10f7898c6e15c1c5edf54aba6eb9bd44.
Run:

$ mkdir ~/.config/repro
$ cd ~/.config/repro
$ wget https://gist.githubusercontent.com/kuator/10f7898c6e15c1c5edf54aba6eb9bd44/raw/fbf8f79460d870da11d2ea53b1050e07f695f476/init.lua
$ NVIM_APPNAME=repro nvim init.lua

Jump to the test_code, specifically line 118, try to do a swap, it does nothing, swap works on main though.

Expected behavior
Swap happens

Output of nvim --version
NVIM v0.12.0-dev-347+gbee45fc0e7
Build type: RelWithDebInfo
LuaJIT 2.1.1744317938
Run "nvim -V1 -v" for more info

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 issue with the linked minimal init.lua using the commands in the report, then inspect the swap behavior around line 118 and compare it with main. Done means swap works when the relevant code includes comments, while the existing non-commented behavior remains intact.

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
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.