VSCodeVim / VSCodeVim/Vim

'J' when joining two comment lines does not strip the leading comment indicator

Open
#9,416 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug
When executing J in normal mode to join lines, vim strips leading comment indicators if we are joining a comment line to another comment line.

To Reproduce
Steps to reproduce the behavior:

Execute normal J on any of the following lines in a TOML file. The # should be stripped when joining.

# XXX: load-bearing unused dependency.
#
# `rustyline` improperly declares its minimum version on `log` as `0.4` despite
# requiring `>=0.4.5` to compile. Link in at least the minimum version here so
# cargo pulls in at least 0.4.5, e.g. when using `-Zminimal-versions`.
#
# Upstream has not been willing to merge a patch to fix this, so hack around it
# here.
#
# See: https://github.com/kkawakam/rustyline/pull/583

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.
If remapping-related, please attach log output: https://github.com/VSCodeVim/Vim#debugging-remappings.

neovim behavior:

https://github.com/user-attachments/assets/8d0caec7-ff9a-418e-a5b0-0b7a95008cac

VSCodeVim behavior:

https://github.com/user-attachments/assets/fbc0bce5-9eb0-4539-94a1-800587cf6931

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.29.0
  • VSCode version: 1.96.2
  • OS: macOS Sequoia 15.2

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

Start by reproducing normal-mode J on the provided TOML comment block and compare the expected joined text with the current behavior. Trace the normal-mode join entry point and identify the existing coverage for comment joining, then add a regression check ensuring the leading # is removed when two comment lines are joined.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.