more more more
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user