haydenrou / dotfiles

My Personalised Development Environment
39 stars 2 forks source link

tsx/jsx comments #7

Closed haydenrou closed 10 months ago

haydenrou commented 10 months ago
haydenrou commented 10 months ago

https://github.com/tjdevries/config_manager/blob/master/xdg_config%2Fnvim%2Flua%2Ftj%2Fsnips%2Fft%2Fgo.lua

jonnyjones99 commented 10 months ago

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! 👍💯

haydenrou commented 10 months ago

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 :)