You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Visually selecting lines 1 through 5 and commenting produces an unwanted mess:
<!-- <html> --><!-- <body> --><!-- <script> --><!-- let name = "Raafat" --><!-- function print_name(name) { -->
console.log(name)
}
</script></body></html>
My aim is to calculate the commentstring at the start and end of the visual selection and only comment if they match.
I've found out that returning %s in the pre_hook results in "aborting" (is there a proper way to do this?).
Let me know what you think.
Hmmmm I am not sure as I don't use ts-context-commenstring. Maybe ask the plugin author for help. I guess it would be pretty similar to what I suggested earlier; calculate the commenstring twice, first for the starting range and other for the ending range then compare them.
Repository owner locked and limited conversation to collaborators on Aug 8, 2022
Activity
numToStr commentedon Aug 4, 2022
Very interesting use case. I tried and the following seems to work
FYI, you don't need https://github.com/JoosepAlviste/nvim-ts-context-commentstring unless you need
jsx(which might also get integrated in future #133)RaafatTurki commentedon Aug 5, 2022
Great snippet, it works nicely!
The reaon I use
nvim_ts_ctx_csis not jsx, it's embedded js in html:Here's a minimal testing snippet
Which after a while of linewise commenting turns into:
The same happens with
js/tsinsveltefiles, Is this a known issue or should I debug my nvim setup?numToStr commentedon Aug 5, 2022
You must be hitting this issue #62 (comment), which will, sadly, always remain a limitation
RaafatTurki commentedon Aug 5, 2022
I see.
How do you reckon a
nvim_ts_ctx_csbased version of the snippet you've provided would look like?numToStr commentedon Aug 6, 2022
Hmmmm I am not sure as I don't use
ts-context-commenstring. Maybe ask the plugin author for help. I guess it would be pretty similar to what I suggested earlier; calculate the commenstring twice, first for the starting range and other for the ending range then compare them.