Merge pull request #12858 from kyazdani42/fix/no-ts-hl-without-query-value

treesitter: check hl group exists before passing it in nvim_get_hl_id_by_name
This commit is contained in:
Thomas Vigouroux 2020-09-06 17:18:47 +02:00 committed by GitHub
commit c3e6b6119c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,7 +98,8 @@ function TSHighlighter:get_hl_from_capture(capture)
return vim.split(name, '.', true)[1]
else
-- Default to false to avoid recomputing
return a.nvim_get_hl_id_by_name(TSHighlighter.hl_map[name])
local hl = TSHighlighter.hl_map[name]
return hl and a.nvim_get_hl_id_by_name(hl) or 0
end
end