Skip to content

Commit

Permalink
fix(utils): parse "boolean_scalar" fields when decoding yaml (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
S1M0N38 authored Jan 11, 2025
1 parent 220ede7 commit 3bf8cac
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lua/codecompanion/utils/yaml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ local function decode(source, node)
return text:sub(2, text:len() - 1)
elseif nt == "integer_scalar" or nt == "float_scalar" then
return tonumber(vim.treesitter.get_node_text(node, source))
elseif nt == "boolean_scalar" then
local text = vim.treesitter.get_node_text(node, source)
if text == "true" then
return true
elseif text == "false" then
return false
else
error("Invalid boolean scalar")
end
elseif nt == "null_scalar" then
return nil
elseif nt == "ERROR" then
Expand Down

0 comments on commit 3bf8cac

Please sign in to comment.