Proposal for JSX/TSX support
Hello,
I was wondering if I could attempt to implement a working commenting system for inline jsx/tsx. I wanted to add this first because it's explicitly stated in the readme that this was difficult to implement, and I wanted to make sure this kind of contribution is welcome.
Thanks!
I just started looking into this as well. I found this reddit comment with a solution that uses nvim-ts-context-commentstring which I removed a while ago since Comment.nvim already supports injected languages:
treesitter.setup({
context_commentstring = {
config = {
javascript = {
__default = '// %s',
jsx_element = '{/* %s */}',
jsx_fragment = '{/* %s */}',
jsx_attribute = '// %s',
comment = '// %s',
},
typescript = { __default = '// %s', __multiline = '/* %s */' },
},
-- ...
comment.setup({
pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(),
-- ...
I think the problem is that jsx/tsx elements aren't an injected language in treesitter.
Not sure if that's of any help.
@herloncosta That is VimScript my friend
yes!