forked from MeanderingProgrammer/treesitter-modules.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
41 lines (36 loc) · 1.32 KB
/
init.lua
File metadata and controls
41 lines (36 loc) · 1.32 KB
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
35
36
37
38
39
40
41
---@class ts.mod.Init
local M = {}
---@class (exact) ts.mod.Config: ts.mod.manager.Config, ts.mod.ts.Config
---@field fold ts.mod.fold.Config
---@field highlight ts.mod.hl.Config
---@field incremental_selection ts.mod.inc.Config
---@field indent ts.mod.indent.Config
---@private
---@type boolean
M.initialized = false
---@type ts.mod.Config
M.default = {
-- list of parser names, or 'all', that must be installed
ensure_installed = {},
-- list of parser names, or 'all', to ignore installing
ignore_install = {},
-- install parsers in ensure_installed synchronously
sync_install = false,
-- automatically install missing parsers when entering buffer
auto_install = false,
fold = require('treesitter-modules.mods.fold').default,
highlight = require('treesitter-modules.mods.highlight').default,
incremental_selection = require('treesitter-modules.mods.incremental').default,
indent = require('treesitter-modules.mods.indent').default,
}
---@param opts? ts.mod.UserConfig
function M.setup(opts)
-- skip initialization if already done and input is empty
if M.initialized and vim.tbl_count(opts or {}) == 0 then
return
end
M.initialized = true
local config = vim.tbl_deep_extend('force', M.default, opts or {})
require('treesitter-modules.state').setup(config)
end
return M