-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inbuilt comment feature not working properly for JSX files #28830
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
vi-mode on zed works well with |
Oops, I was wrong. https://github.com/tree-sitter/tree-sitter-javascript does support .jsx files, but it seems that the comment string may change even though the filetype doesn't change. From numToStr/Comment.nvim#133 it seems that this is quite a complicated problem. |
@zeertzjq Would you be opposed to a PR that sets the |
Yes, that would be out of scope. React files are such a mess, you need a dedicated plugin to make sense of it. We shouldn't add one-off hacks for individual languages. |
Problem: it's difficult for users to customize the inbuilt commenting behavior (changing or extending) Solution: expose a hook that can override the selected commentstring, to allow for finer control Closes neovim#28830
This is a work-around I use in LazyVim to use nvim-ts-context-commentstring together with native comments: local get_option = vim.filetype.get_option
vim.filetype.get_option = function(filetype, option)
return option == "commentstring"
and require("ts_context_commentstring.internal").calculate_commentstring()
or get_option(filetype, option)
end An alternative would be to at least expose |
… support, enable `nvim-ts-context-commentstring` to work with native comments - https://neovim.io/doc/user/various.html#commenting - neovim/neovim#28830 (comment)
Just created a tiny plugin to enhance the native comments with support for custom comment strings for certain treesitter node types. It's an alternative to ts-context-commentstring. |
Problem
when i type 'gcc; this is how it gets commented in a JSX file
Steps to reproduce
Expected behavior
this is how it should be for JSX when commented.
Neovim version (nvim -v)
0.10
Vim (not Nvim) behaves the same?
no
Operating system/version
ubuntu 22.04
Terminal name/version
GNOME Terminal 3.44.0 using VTE 0.68.0 +BIDI +GNUTLS +ICU +SYSTEMD
$TERM environment variable
xterm-256color
Installation
appimage
The text was updated successfully, but these errors were encountered: