mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-04 04:20:09 -04:00
feat(refactor): highlight usages module
This commit is contained in:
parent
180ad9a1a8
commit
058e8d2296
8 changed files with 275 additions and 37 deletions
|
|
@ -13,6 +13,12 @@ local function read_query_files(filenames)
|
|||
return table.concat(contents, '\n')
|
||||
end
|
||||
|
||||
local function get_query_gaurd(query)
|
||||
return function(lang)
|
||||
return M.get_query(lang, query) ~= nil
|
||||
end
|
||||
end
|
||||
|
||||
-- Some treesitter grammars extend others.
|
||||
-- We can use that to import the queries of the base language
|
||||
M.base_language_map = {
|
||||
|
|
@ -21,6 +27,9 @@ M.base_language_map = {
|
|||
tsx = {'typescript', 'javascript'},
|
||||
}
|
||||
|
||||
M.has_locals = get_query_gaurd('locals')
|
||||
M.has_highlights = get_query_gaurd('highlights')
|
||||
|
||||
function M.get_query(lang, query_name)
|
||||
local query_files = api.nvim_get_runtime_file(string.format('queries/%s/%s.scm', lang, query_name), true)
|
||||
local query_string = ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue