mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 20:10:10 -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
|
|
@ -45,4 +45,21 @@ function M.get_cache_dir()
|
|||
return nil, 'Invalid cache rights, $XDG_CACHE_HOME or /tmp should be read/write'
|
||||
end
|
||||
|
||||
--- Gets a property at path
|
||||
-- @param tbl the table to access
|
||||
-- @param path the '.' seperated path
|
||||
-- @returns the value at path or nil
|
||||
function M.get_at_path(tbl, path)
|
||||
local segments = vim.split(path, '.', true)
|
||||
local result = tbl
|
||||
|
||||
for _, segment in ipairs(segments) do
|
||||
if type(result) == 'table' then
|
||||
result = result[segment]
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue