fix: Show nested keys

This commit is contained in:
Myzel394 2024-04-11 15:24:21 +02:00
parent 2015ac5aef
commit c6c630babe
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
2 changed files with 6 additions and 3 deletions

View File

@ -375,7 +375,7 @@ local function grok_object(self, text, start, options)
local new_val, new_i = grok_one(self, text, i, options) local new_val, new_i = grok_one(self, text, i, options)
---- Add start position so we can quickly jump to it ---- Add start position so we can quickly jump to it
VALUE[key] = {new_val, key_start = key_start, key_end = key_end, newlines = newlines, relative_start = relative_start} VALUE[key] = {value = new_val, key_start = key_start, key_end = key_end, newlines = newlines, relative_start = relative_start}
-- --
-- Expect now either '}' to end things, or a ',' to allow us to continue. -- Expect now either '}' to end things, or a ',' to allow us to continue.

View File

@ -10,7 +10,7 @@ local function get_recursive_keys(t)
for k, raw_value in pairs(t) do for k, raw_value in pairs(t) do
table.insert(keys, {key = k, entry = raw_value}) table.insert(keys, {key = k, entry = raw_value})
local v = raw_value[0] local v = raw_value.value
if type(v) == "table" then if type(v) == "table" then
local sub_keys = get_recursive_keys(v) local sub_keys = get_recursive_keys(v)
@ -37,7 +37,7 @@ return require"telescope".register_extension {
local parsed = json:decode(content) local parsed = json:decode(content)
local keys = get_recursive_keys(parsed) local keys = get_recursive_keys(parsed)
print(vim.inspect(keys)) -- print(vim.inspect(keys))
pickers.new(opts, { pickers.new(opts, {
prompt_title = "colors", prompt_title = "colors",
@ -52,6 +52,9 @@ return require"telescope".register_extension {
bufnr = current_buf, bufnr = current_buf,
filename = filename, filename = filename,
lnum = entry.entry.newlines + 1, lnum = entry.entry.newlines + 1,
col = 2,
start = 2,
finish = 8,
indicator = 0, indicator = 0,
extra = 0, extra = 0,