more more more

This commit is contained in:
2025-07-13 18:58:27 -04:00
parent 101bc55f15
commit cace587a09
36 changed files with 610 additions and 1251 deletions

View File

@ -14,16 +14,20 @@ local function parse_line(linenr)
return nil
end
-- get a parser TODO: remove the pcall once nvim 0.12 hits and the function no
-- longer raises an error
local ok, parser = pcall(vim.treesitter.get_parser, bufnr)
if not ok then
if not ok or not parser then
return nil
end
-- get a query from the parser
local query = vim.treesitter.query.get(parser:lang(), "highlights")
if not query then
return nil
end
-- parse the current line
local tree = parser:parse({ linenr - 1, linenr })[1]
local result = {}
local line_pos = 0