mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-16 02:10:15 -04:00
fix(indent): don't skip parsing for yaml
This commit is contained in:
parent
44bb06bc12
commit
11736494df
1 changed files with 2 additions and 12 deletions
|
|
@ -2,10 +2,6 @@ local ts = vim.treesitter
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.avoid_force_reparsing = {
|
|
||||||
yaml = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
M.comment_parsers = {
|
M.comment_parsers = {
|
||||||
comment = true,
|
comment = true,
|
||||||
jsdoc = true,
|
jsdoc = true,
|
||||||
|
|
@ -125,14 +121,8 @@ function M.get_indent(lnum)
|
||||||
return -1
|
return -1
|
||||||
end
|
end
|
||||||
|
|
||||||
local ft = vim.bo[bufnr].filetype
|
-- Reparse in case we got triggered by ":h indentkeys"
|
||||||
local root_lang = vim.treesitter.language.get_lang(ft) or ft
|
parser:parse({ vim.fn.line('w0') - 1, vim.fn.line('w$') })
|
||||||
|
|
||||||
-- some languages like Python will actually have worse results when re-parsing at opened new line
|
|
||||||
if not M.avoid_force_reparsing[root_lang] then
|
|
||||||
-- Reparse in case we got triggered by ":h indentkeys"
|
|
||||||
parser:parse({ vim.fn.line('w0') - 1, vim.fn.line('w$') })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get language tree with smallest range around node that's not a comment parser
|
-- Get language tree with smallest range around node that's not a comment parser
|
||||||
local root, lang_tree ---@type TSNode, vim.treesitter.LanguageTree
|
local root, lang_tree ---@type TSNode, vim.treesitter.LanguageTree
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue