mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-05 21:10:15 -04:00
feat(refactor): add smart rename module
This commit is contained in:
parent
058e8d2296
commit
64838e51c0
5 changed files with 115 additions and 24 deletions
|
|
@ -13,7 +13,9 @@ local function read_query_files(filenames)
|
|||
return table.concat(contents, '\n')
|
||||
end
|
||||
|
||||
local function get_query_gaurd(query)
|
||||
-- Creates a function that checks whether a certain query exists
|
||||
-- for a specific language.
|
||||
local function get_query_guard(query)
|
||||
return function(lang)
|
||||
return M.get_query(lang, query) ~= nil
|
||||
end
|
||||
|
|
@ -27,8 +29,8 @@ M.base_language_map = {
|
|||
tsx = {'typescript', 'javascript'},
|
||||
}
|
||||
|
||||
M.has_locals = get_query_gaurd('locals')
|
||||
M.has_highlights = get_query_gaurd('highlights')
|
||||
M.has_locals = get_query_guard('locals')
|
||||
M.has_highlights = get_query_guard('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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue