Commenting JSX makes line JavaScript instead of JSX breaking context aware commenting
Opened this issue ยท 1 comments
In the following code:
const React = require("react");
export default () => (
<div>
{/* <h1>Hello World!</h1> */}
</div>
);
When testing with mxw/vim-jsx
and pangloss/vim-javascript
the line with the jsx comment is labelled a jsxChild
. Combined with othree/yajs.vim
(which has way nicer highlighting ๐ ) the line becomes javaScriptBraces
. This means my context aware commenting plugin adds {/* */}
, but upon requesting to uncomment does nothing, or worse, when requesting to toggle the comment, comments again, making it // {/* */}
as it 'correctly' recognized the JavaScript syntax was not yet commented as {/* */}
is only a comment in JSX.
Related issue tomtom/tcomment_vim#248 in tcomment that has some screenshots.
I know parsing JSX is a pain in the butt, let me know if there's anything else I can do to help. Commenting I'm noticing is quite frequently used in UI work.
Thanks for an awesome plugin ๐ .
Hi @alextes, try to replace mxw/jsx
with vim-jsx-pretty
. It works well with the test case you provided if you use the tpope/vim-commentary
plugin.
I will try to find a way to fix the problem with tcomment.