Open yuukibarns opened 9 hours ago
Cannot reproduce it here, either. I expect you are testing with nvim --clean -u test.lua
(if not, do that). What does :set ft?
show in each instance? What does :InspectTree
show (press I
to toggle language display)?
Also, your comment string looks off: the HTML comment should include spaces. Can you please test the latest Nvim nightly?
use nvim --clean -u test.lua
the weird commenting behavior persists...
Now it stably comments like this:
# This is a test
:set ft
shows filetype=markdown
:InspectTree
and press I
show:
:set commentstring
shows commentstring=<!--%s-->
use nightly the only difference is the output of :set commentstring
. it shows commentstring=<!-- %s -->
now.
Sorry, I cannot reproduce this, and I have no explanation for what you observe.
I installed nvim-treesitter
using lazy.nvim
with an empty ensure_install
list and then moved it to a different directory (~/nvim-treesitter/
). I suspect that the issue might be related to lazy.nvim
. Is there an alternative method to install nvim-treesitter
neatly?
Just clone the directory and add it to your runtimepath, as in your minimal config (which is what I assumed you did). I strongly suspect that you're seeing -- for some reason I can't fathom -- a different mapping than the builtin commenting (which would use gcc
for un/commenting a single line, mind you).
The same result... :confused:, this time i directly git clone the repo, but there is no difference...
i find that without any further configuration, just include nvim-treesitter
into path will cause problem.
Is there anyone who can reproduce it? Just include nvim-treesitter in path and try several times.
Is there anyone who can reproduce it?
I'm also having this issue, though I haven't found a consistent way of reproducing
try several times
It happens fairly often with me, I'd say around half the time.
nvim version is the lastest commit from main, NVIM v0.11.0-dev-840+gf2fa4ca97e, and I'm on Linux
Needs details: installation, minimal config, exact reproduction steps. A simple "Me too" does not help in any way whatsoever.
And don't use main.
Describe the bug
When opening a Markdown file in Neovim and attempting to comment a line using the
gc
command, the commenting behavior appears to be inconsistent and changeable. Specifically, the comment format alternates between the expected HTML comment (<!--%s-->
) and a hash-style comment (# %s
), even though thecommentstring
is consistently set to the default<!--%s-->
.https://github.com/user-attachments/assets/db5ca765-6bb0-44a5-83fe-49d5401acad4
Here is my minimal configuration:
To Reproduce
gc
to comment a line, for example:gc
command on the same line.Expected behavior
The line should always be commented using the
commentstring
specified in Neovim, which is<!--%s-->
for Markdown files. Therefore, the line should consistently be commented as:Output of
:checkhealth nvim-treesitter
Output of
nvim --version
Additional context
Comes from neovim/neovim#30522