mirror of
https://github.com/Myzel394/jsonfly.nvim.git
synced 2025-06-18 12:15:25 +02:00
feat: Add basic support for arrays
This commit is contained in:
parent
8d7bf6e2fe
commit
3b481818d8
@ -375,7 +375,13 @@ 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] = {value = 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 or 0,
|
||||||
|
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.
|
||||||
@ -417,9 +423,17 @@ local function grok_array(self, text, start, options)
|
|||||||
local text_len = text:len()
|
local text_len = text:len()
|
||||||
while i <= text_len do
|
while i <= text_len do
|
||||||
local val, new_i = grok_one(self, text, i, options)
|
local val, new_i = grok_one(self, text, i, options)
|
||||||
|
local newlines = count_newlines(text, i)
|
||||||
|
local relative_start = get_relative_i(text, i)
|
||||||
|
|
||||||
-- can't table.insert(VALUE, val) here because it's a no-op if val is nil
|
-- can't table.insert(VALUE, val) here because it's a no-op if val is nil
|
||||||
VALUE[VALUE_INDEX] = val
|
VALUE[VALUE_INDEX] = {
|
||||||
|
value = val,
|
||||||
|
key_start = new_i,
|
||||||
|
key_end = new_i,
|
||||||
|
newlines = newlines or 0,
|
||||||
|
relative_start = relative_start,
|
||||||
|
}
|
||||||
VALUE_INDEX = VALUE_INDEX + 1
|
VALUE_INDEX = VALUE_INDEX + 1
|
||||||
|
|
||||||
i = skip_whitespace(text, new_i)
|
i = skip_whitespace(text, new_i)
|
||||||
|
@ -159,6 +159,7 @@ return require"telescope".register_extension {
|
|||||||
},
|
},
|
||||||
previewer = conf.grep_previewer(opts),
|
previewer = conf.grep_previewer(opts),
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
|
sorting_strategy = "ascending",
|
||||||
}):find()
|
}):find()
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user