๐Ÿ’ YAML toolkit for Neovim users

Adds empty value to sample YAML

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