mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-05 21:10:15 -04:00
Fix: allow empty path in utils.get_at_path
This commit is contained in:
parent
06c9ef8104
commit
826683b1bf
2 changed files with 4 additions and 6 deletions
|
|
@ -189,14 +189,11 @@ function M.get_capture_matches(bufnr, capture_string, query_group, root, lang)
|
|||
end
|
||||
|
||||
function M.find_best_match(bufnr, capture_string, query_group, filter_predicate, scoring_function, root)
|
||||
if not string.sub(capture_string, 1,2) == '@' then
|
||||
api.nvim_err_writeln('capture_string must start with "@"')
|
||||
return
|
||||
if string.sub(capture_string, 1,2) == '@' then
|
||||
--remove leading "@"
|
||||
capture_string = string.sub(capture_string, 2)
|
||||
end
|
||||
|
||||
--remove leading "@"
|
||||
capture_string = string.sub(capture_string, 2)
|
||||
|
||||
local best
|
||||
local best_score
|
||||
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ end
|
|||
-- @param path the '.' separated path
|
||||
-- @returns the value at path or nil
|
||||
function M.get_at_path(tbl, path)
|
||||
if path == '' then return tbl end
|
||||
local segments = vim.split(path, '.', true)
|
||||
local result = tbl
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue