aboutsummaryrefslogtreecommitdiffstats
path: root/nvim/lua/plugins/treesitter.lua
blob: 2f0f6544f16a286a5ef61352a60d36257b6c0a89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
return {
    'nvim-treesitter/nvim-treesitter',
    lazy = false,
    build = function()
        local nvim_treesitter = require("nvim-treesitter")
        local util = require("nvim.lua.shared")

        local installed = util.to_set(nvim_treesitter.get_installed())
        local ensure_installed = util.to_set {
            "markdown", "markdown_inline",
            "vimdoc",
            "c",
            "make",
            "rust",
            "go", "gowork", "gotmpl",
            "json", "yaml", "toml",
            "python",
            "html",
            "javascript",
            "julia", "r",
            "bash",
            "latex",
            "sql",
        }

        local diff = util.set_difference(ensure_installed, installed)
        if #diff > 0 then
            -- NOTE: potential race condition because install is async
            nvim_treesitter.install(util.keys(diff))
        end

        nvim_treesitter.update({ summary = true })
    end,
}