Skip to content
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

Different types of comments depending on the context of the code #149

Open
MuhammadSawalhy opened this issue Aug 12, 2021 · 7 comments
Open

Comments

@MuhammadSawalhy
Copy link

MuhammadSawalhy commented Aug 12, 2021

I want to have the same experience of VSCode and some other code editors and IDEs, some examples are coming. As no plugin now solves this problem It seems difficult to apply different types of comments depending on the context of the code, or maybe some focus needs to be put to make this feature available.

JSX

simplescreenrecorder-2021-08-09_16.35.05-montage.mp4

HTML

simplescreenrecorder-2021-08-12_03.36.53-montaged.mp4
@xaizek
Copy link

xaizek commented Aug 12, 2021

As no plugin now solves this problem

Isn't that what https://github.com/suy/vim-context-commentstring is trying to do?

@MuhammadSawalhy
Copy link
Author

MuhammadSawalhy commented Aug 12, 2021

Isn't that what https://github.com/suy/vim-context-commentstring is trying to do?

This plugin solves some problems of comments, it solves problems of HTML and Lua in Vim, but I still have the same problems of JSX (HTML in Js) syntax, the same video of JSX.

@chrisbra
Copy link

I think https://github.com/tomtom/tcomment_vim that solves embedded filetypes

@SiddharthShyniben
Copy link

This plugin solves some problems of comments, it solves problems of HTML and Lua in Vim, but I still have the same problems of JSX (HTML in Js) syntax, the same video of JSX.

You could possibly add this as a feature request to https://github.com/suy/vim-context-commentstring itself

@githorse
Copy link

githorse commented Mar 3, 2023

Same problem. This Stackexchange question claims all I need to make JSX/TSX work with vim-commentary is the additional plugins vim-context-commentstring and vim-jsx-pretty, but the solution there doesn't work for me. I also have an open issue in vim-context-commentstring for this.

Would definitely be great if this plugin could handle multi-syntax files natively, or, if not, perhaps put some information in the FAQ about how to make it work with additional plugins.

@MuhammadSawalhy
Copy link
Author

preservim/nerdcommenter#298 (comment)

A tree-sitter-based plugin did awesome work to support jsx and I'm now happy with it:

nvim-ts-context-commentstring & Comment.nvim

@ghost
Copy link

ghost commented Jan 21, 2024

This post has made me curious ever since I looked at it, but I tried VScode, it's default behavior seems to be based on file extension alone. For example, i made a file with an .html label, then i entered some java script code, and when i highlighted the line and hit Ctrl + /, it surrounded it with the html comments which is the type of thing you are talking about.

Did you install some plugin/extension for VScode that changes that behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants