mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 20:10:10 -04:00
Use stylua for autoformat code (#1480)
This commit is contained in:
parent
90f15d9bf7
commit
be8f656087
32 changed files with 1181 additions and 979 deletions
|
|
@ -1,11 +1,10 @@
|
|||
local api = vim.api
|
||||
local ts = vim.treesitter
|
||||
|
||||
local parsers = require'nvim-treesitter.parsers'
|
||||
local configs = require'nvim-treesitter.configs'
|
||||
local parsers = require "nvim-treesitter.parsers"
|
||||
local configs = require "nvim-treesitter.configs"
|
||||
|
||||
local M = {
|
||||
}
|
||||
local M = {}
|
||||
|
||||
local hlmap = vim.treesitter.highlighter.hl_map
|
||||
|
||||
|
|
@ -104,7 +103,7 @@ hlmap["variable.builtin"] = "TSVariableBuiltin"
|
|||
|
||||
function M.attach(bufnr, lang)
|
||||
local parser = parsers.get_parser(bufnr, lang)
|
||||
local config = configs.get_module('highlight')
|
||||
local config = configs.get_module "highlight"
|
||||
|
||||
for k, v in pairs(config.custom_captures) do
|
||||
hlmap[k] = v
|
||||
|
|
@ -112,9 +111,9 @@ function M.attach(bufnr, lang)
|
|||
|
||||
ts.highlighter.new(parser, {})
|
||||
|
||||
local is_table = type(config.additional_vim_regex_highlighting) == 'table'
|
||||
local is_table = type(config.additional_vim_regex_highlighting) == "table"
|
||||
if config.additional_vim_regex_highlighting and (not is_table or config.additional_vim_regex_highlighting[lang]) then
|
||||
api.nvim_buf_set_option(bufnr, 'syntax', 'ON')
|
||||
api.nvim_buf_set_option(bufnr, "syntax", "ON")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -122,7 +121,7 @@ function M.detach(bufnr)
|
|||
if ts.highlighter.active[bufnr] then
|
||||
ts.highlighter.active[bufnr]:destroy()
|
||||
end
|
||||
api.nvim_buf_set_option(bufnr, 'syntax', 'ON')
|
||||
api.nvim_buf_set_option(bufnr, "syntax", "ON")
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue