From 3bf8cacd5298dfa1b103c52d8fd460b0be3b2d08 Mon Sep 17 00:00:00 2001 From: S1M0N38 Date: Sat, 11 Jan 2025 17:34:28 +0100 Subject: [PATCH] fix(utils): parse "boolean_scalar" fields when decoding yaml (#635) --- lua/codecompanion/utils/yaml.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/codecompanion/utils/yaml.lua b/lua/codecompanion/utils/yaml.lua index 6587fa26..0e3566b5 100644 --- a/lua/codecompanion/utils/yaml.lua +++ b/lua/codecompanion/utils/yaml.lua @@ -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