mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 11:36:54 -04:00
feat(languagetree): implement language tree
Allow the LanguageTree to be used as an option for highlighting. Co-authored-by: Santos Gallegos <stsewd@protonmail.com> Co-authored-by: Yazdani Kiyan <yazdani.kiyan@protonmail.com>
This commit is contained in:
parent
e9b6e2d311
commit
f7d92f663c
5 changed files with 193 additions and 13 deletions
|
|
@ -81,14 +81,19 @@ function M.attach(bufnr, lang)
|
|||
local parser = parsers.get_parser(bufnr, lang)
|
||||
local config = configs.get_module('highlight')
|
||||
|
||||
for k, v in pairs(config.custom_captures) do
|
||||
hlmap[k] = v
|
||||
if config.use_languagetree then
|
||||
local ltree = require'nvim-treesitter.languagetree'
|
||||
ltree.new(bufnr, lang)
|
||||
else
|
||||
for k, v in pairs(config.custom_captures) do
|
||||
hlmap[k] = v
|
||||
end
|
||||
|
||||
local query = queries.get_query(lang, "highlights")
|
||||
if not query then return end
|
||||
|
||||
M.highlighters[bufnr] = ts.highlighter.new(parser, query)
|
||||
end
|
||||
|
||||
local query = queries.get_query(lang, "highlights")
|
||||
if not query then return end
|
||||
|
||||
M.highlighters[bufnr] = ts.highlighter.new(parser, query)
|
||||
end
|
||||
|
||||
function M.detach(bufnr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue