haydenrou/dotfiles

tsx/jsx comments

Closed this issue · 3 comments

Hey!

You can fix that issue with this plugin: [Plugin](https://github.com/JoosepAlviste/nvim-ts-context-commentstring](https://github.com/JoosepAlviste/nvim-ts-context-commentstring).

I'm using it in conjuction with

Here's a little snippet of how I'm using it in my setup:

Lazy plugin:

	{
		"nvim-treesitter/nvim-treesitter",
		build = ":TSUpdate",
		event = "VeryLazy",

		dependencies = {
			"JoosepAlviste/nvim-ts-context-commentstring",
		},

		config = function()
			require("plugins.treesitter")
		end,
	},

Config:

local commentstringOK, ts_context_commentstring = pcall(require, "ts_context_commentstring")
if not commentstringOK then
	vim.notify("ts_context_commentstring could not be loaded")
	return
end

require("ts_context_commentstring").setup({})

Hope that helps! 👍💯

This is great, thanks a lot! I added the plugin as suggested, but omitted the specific config as I don't use vim-notify. I also had to add the comment.nvim specific pre-hook for the new plugin. But now it works like a charm!

You can see the attached PR for a full list of the changes. Thanks for the suggestion :)