๐Ÿ’ YAML toolkit for Neovim users

Adds empty value to sample YAML

+8 -7
+1 -1
Dockerfile
··· 22 22 COPY --from=tree-sitter-cli /usr/local/cargo/bin/tree-sitter /usr/local/bin/tree-sitter 23 23 24 24 RUN apt-get update && \ 25 - apt-get install -y curl g++ git && \ 25 + apt-get install -y curl fzf g++ git && \ 26 26 apt-get autoremove -y && \ 27 27 rm -rf /var/lib/apt/lists/* && \ 28 28 useradd -ms /bin/bash yaml
+4 -5
lua/yaml_nvim/pair.lua
··· 40 40 end 41 41 42 42 local function get_value(node, bufnr) 43 - if node ~= nil then 44 - local value = node:field("value")[1] 45 - return table.concat({ vim.treesitter.get_node_text(value, bufnr) }, "\n") 46 - else 43 + if node == nil then 47 44 return "" 48 45 end 46 + local value = node:field("value")[1] 47 + return table.concat({ vim.treesitter.get_node_text(value, bufnr) }, "\n") 49 48 end 50 49 51 50 local function is_sequence_block(value) ··· 110 109 local human = string.format("%s = %s", key, cleaned_value) 111 110 local start_line, start_col = node:start() 112 111 local end_line = start_line 113 - if value_node then 112 + if value_node ~= nil then 114 113 end_line, _ = value_node:end_() 115 114 end 116 115
+2
tests/sample.yaml
··· 6 6 Here comes a two lines 7 7 text. 8 8 9 + morumbi: 10 + 9 11 semifinals: 10 12 - brazil: 1 11 13 germany: 7
+1 -1
tests/yaml_nvim/functions_spec.lua
··· 4 4 describe("Lua functions with sample YAML:", function() 5 5 before_each(function() 6 6 vim.cmd(":e tests/sample.yaml") 7 - vim.cmd(":norm 10j^") 7 + vim.cmd(":norm 12j^") 8 8 end) 9 9 10 10 after_each(function()