diff options
| author | Steven Sojka <Steven.Sojka@tdameritrade.com> | 2020-06-25 13:26:31 -0500 |
|---|---|---|
| committer | Kiyan Yazdani <yazdani.kiyan@protonmail.com> | 2020-06-30 08:21:01 +0200 |
| commit | 058e8d2296515041be982c6f23c119ec6b6d1ba9 (patch) | |
| tree | d4d7b1d05b3b1d420d41a468460336d3d3ec3971 /lua/nvim-treesitter/query.lua | |
| parent | 180ad9a1a8c1212d9839bdbe97c11137b48a7064 (diff) | |
feat(refactor): highlight usages module
Diffstat (limited to 'lua/nvim-treesitter/query.lua')
| -rw-r--r-- | lua/nvim-treesitter/query.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/query.lua b/lua/nvim-treesitter/query.lua index 42e83582..d04e368a 100644 --- a/lua/nvim-treesitter/query.lua +++ b/lua/nvim-treesitter/query.lua @@ -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 = '' |
