JoosepAlviste / nvim-ts-context-commentstring

Neovim treesitter plugin for setting the commentstring based on the cursor location in a file.
MIT License
1.13k stars 34 forks source link

always use line-wise C commentstring #85

Closed mortezadadgar closed 1 month ago

mortezadadgar commented 9 months ago

separated this from the #84 as I think this require some discussions. this change has been made to follow default behavior of vim ftplugin which is always to use /* %s */ not matter it's block or line-wise commenting. and besides that plugins like vim-commentray and mini.comment doesn't even support block commenting and therefore this come to surprising new users as their C commentstring has changed from this plugin

JoosepAlviste commented 9 months ago

This is an interesting case and I can see the reasoning of keeping the defaults from Vim. I also saw that support for single-line comments was added in C99, so it hasn't always been a part of the language.

However, this seems like a pretty subjective change and could be easily configured by the user. Also, this change would technically be a breaking change, so I'm quite hesitant to accept this.

Could we somehow ask for more opinions about this, from people who write C?

mortezadadgar commented 9 months ago

plugins like Comment.nvim already change the commentstring based on line or block wise mappings i don't see the rational of being in business of changing commentstring, after #86 get merged I don't think there's any reason to change commentstring where it's not needed, anything I am missing?

zyriab commented 2 months ago

I think it should be configurable by the user. I personally prefer C++ style (//) but had a job interview on a codebase not using C99, therefore requiring /* */. Some major OSS projects like Wine require that type of comments, for example. If there must be a default, I think for C it should be /* */, especially if it's Vim's default.

JoosepAlviste commented 1 month ago

Thanks for the input @zyriab! Let's merge this, then. I suppose we can follow the Vim defaults without worrying about things too much. It's a bit of a breaking change though, so I'll add a comment to the breaking changes issue about it.