Skip to content

Commit

Permalink
perf: vim.fn.json_decode -> vim.json.decode (#249)
Browse files Browse the repository at this point in the history
Use the faster lua implementation, without the overhead of the vimscript
wrapper.

Co-authored-by: Bruno Mazzo <[email protected]>
  • Loading branch information
fredrikaverpil and BrunoMazzo authored Jan 2, 2025
1 parent 770dd49 commit e4b0770
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/neotest-golang/lib/json.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function M.decode_from_table(tbl, construct_invalid)
local jsonlines = {}
for _, line in ipairs(tbl) do
if string.match(line, "^%s*{") then -- must start with the `{` character
local status, json_data = pcall(vim.fn.json_decode, line)
local status, json_data = pcall(vim.json.decode, line)
if status then
table.insert(jsonlines, json_data)
else
Expand Down

0 comments on commit e4b0770

Please sign in to comment.