folke/dot

Using `opts` with `nvim-treesitter/nvim-treesitter`

0xcharly opened this issue · 4 comments

Hi,

Your dots have been a massive source of inspiration, a curated list of awesome plugins, and a great example of Lazy setup. Thanks for publishing them! (and awesome work on Lazy, btw!).

I'm hoping that you can help me understand something in your config of tree-sitter:

I've noticed that you're using opts to configure nvim-treesitter/nvim-treesitter (https://github.com/folke/dot/blob/master/config/nvim/lua/plugins/treesitter.lua#L23).

My understanding is that opts calls <module-name>.setup {opts}.

However, nvim-treesitter configuration is passed to nvim-treesitter.configs (https://github.com/nvim-treesitter/nvim-treesitter#modules).

On my end, I cannot seem to make opts={…} work, and need to instead use config = function() … end:

{
    "nvim-treesitter/nvim-treesitter",
    require 'nvim-treesitter.configs'.setup {
        ...opts
    },
}

It's totally possible I'm missing an obvious feature that would make this work (or maybe a future feature of Lazy that currently only exists in your dev environment?), but I just can't seem to find it if that's the case.

Thanks in advance!

because the author is using LazyVim, which has a config function for nvim-treesitter.

I'm using Lazy.nvim as well, and the same configuration doesn't work.

The default config function calls setup(…) for "nvim-treesitter", not for "nvim-treesitter.configs", AFAICT

Gotcha, I wasn't aware of LazyVim. Thanks.