ts-comments.nvim icon indicating copy to clipboard operation
ts-comments.nvim copied to clipboard

fix(vue): different comment strings for JS and HTML sections

Open ignamartinoli opened this issue 1 year ago • 5 comments

Vue files contain also Javascript

Description

Inside Vue files you normally have

<script>
// Javasciript
</script>

<template>
<!-- HTML -->
</template>

The first time you try to comment a line inside the <script> tag, it will be properly commented with //. But when you try to uncomment it it will result in <!-- // %s -->.

By specifying the script Treesitter node, now Javascript code is always handled correcly inside Vue files.

Related Issue(s)

I didn't open one since I thought it was easier to just fix the problem

ignamartinoli avatar Jan 13 '25 06:01 ignamartinoli

This PR is stale because it has been open 30 days with no activity.

github-actions[bot] avatar Feb 13 '25 01:02 github-actions[bot]

:cry:

ignamartinoli avatar Feb 13 '25 02:02 ignamartinoli

I'm having the same issue. Would be great to see this merged

FrancoRav avatar Feb 18 '25 00:02 FrancoRav

I also ran into this problem. I've inserted the fix from @ignamartinoli manually in my config and can confirm that it works:

return {
	"folke/ts-comments.nvim",
	opts = {
		lang = {
			vue = {
				"<!-- %s -->",
				script_element = "// %s",
			},
		},
	},
	event = "VeryLazy",
	enabled = vim.fn.has("nvim-0.10.0") == 1,
}

Would be nice if this could be merged as a default

MartenBE avatar Feb 20 '25 17:02 MartenBE

This PR is stale because it has been open 30 days with no activity.

github-actions[bot] avatar Apr 04 '25 02:04 github-actions[bot]

The issue appears solved now. I suspect due to some improvement on Treesitter

ignamartinoli avatar Nov 13 '25 15:11 ignamartinoli