diff --git a/lua/neogen/configurations/cs.lua b/lua/neogen/configurations/cs.lua index b73e73b..59709df 100644 --- a/lua/neogen/configurations/cs.lua +++ b/lua/neogen/configurations/cs.lua @@ -50,7 +50,7 @@ return { { position = 1, extract = true, - as = i.Return + as = i.Return, }, } local nodes = nodes_utils:matching_nodes_from(node, tree) diff --git a/lua/neogen/configurations/java.lua b/lua/neogen/configurations/java.lua index f703bd7..f6be31c 100644 --- a/lua/neogen/configurations/java.lua +++ b/lua/neogen/configurations/java.lua @@ -20,8 +20,8 @@ local function_tree = { retrieve = "all", node_type = "throws", subtree = { - { retrieve = "all",node_type= "type_identifier", extract = true, as="throw_statement"} - } + { retrieve = "all", node_type = "type_identifier", extract = true, as = "throw_statement" }, + }, }, { retrieve = "first", diff --git a/lua/neogen/generator.lua b/lua/neogen/generator.lua index 785fe22..38891be 100644 --- a/lua/neogen/generator.lua +++ b/lua/neogen/generator.lua @@ -75,7 +75,7 @@ local function get_parent_node(filetype, node_type, language) local function get_node(type) return locator({ root = tree, - current = current_node + current = current_node, }, type) end @@ -284,13 +284,8 @@ return setmetatable({}, { local data = granulator(parent_node, language.data[node_type]) -- Will try to generate the documentation from a template and the data found from the granulator - local row, template_content, default_text = generate_content( - parent_node, - data, - template, - node_type, - annotation_convention[filetype] - ) + local row, template_content, default_text = + generate_content(parent_node, data, template, node_type, annotation_convention[filetype]) local content = {} local marks_pos = {} diff --git a/lua/neogen/init.lua b/lua/neogen/init.lua index 1e86a70..f6d5fa9 100644 --- a/lua/neogen/init.lua +++ b/lua/neogen/init.lua @@ -248,7 +248,7 @@ end --- - Fetch singleton methods in ruby (#121) --- ## 2.11.0~ --- - Calling `:Neogen` will try to find the best type used to generate annotations (#116) ---- It'll recursively go up the syntax tree from the cursor position. +--- It'll recursively go up the syntax tree from the cursor position. --- For example, if a function is defined inside class and the cursor is inside the function, --- the annotation will be generated for the function. --- ## 2.10.0~ diff --git a/lua/neogen/snippet.lua b/lua/neogen/snippet.lua index a64adb9..60d92c0 100644 --- a/lua/neogen/snippet.lua +++ b/lua/neogen/snippet.lua @@ -81,7 +81,7 @@ snippet.engines.luasnip = function(snip, pos) ls.snip_expand( - ls.s("", ls.parser.parse_snippet(nil, _snip,{trim_empty = false, dedent = false}), { + ls.s("", ls.parser.parse_snippet(nil, _snip, { trim_empty = false, dedent = false }), { child_ext_opts = { -- for highlighting the placeholders @@ -101,31 +101,31 @@ end ---@param snip string the snippet to expand ---@param pos table a tuple of row, col ---@private -snippet.engines.snippy = function (snip, pos) +snippet.engines.snippy = function(snip, pos) local ok, snippy = pcall(require, "snippy") if not ok then notify("Snippy not found, aborting...", vim.log.levels.ERROR) return end local row, _ = unpack(pos) - vim.api.nvim_buf_set_lines(0, row, row, true, {''}) -- snippy will change `row` - vim.api.nvim_win_set_cursor(0, {row + 1, 0}) -- `snip` already has indent so we should ignore `col` - snippy.expand_snippet({body = snip}) + vim.api.nvim_buf_set_lines(0, row, row, true, { "" }) -- snippy will change `row` + vim.api.nvim_win_set_cursor(0, { row + 1, 0 }) -- `snip` already has indent so we should ignore `col` + snippy.expand_snippet({ body = snip }) end --- Expand snippet for vsnip engine ---@param snip string the snippet to expand ---@param pos table a tuple of row, col ---@private -snippet.engines.vsnip = function (snip, pos) +snippet.engines.vsnip = function(snip, pos) local ok = vim.g.loaded_vsnip if not ok then notify("Vsnip not found, aborting...", vim.log.levels.ERROR) return end local row, _ = unpack(pos) - vim.api.nvim_buf_set_lines(0, row, row, true, {''}) -- vsnip will change `row` - vim.api.nvim_win_set_cursor(0, {row + 1, 0}) -- `snip` already has indent so we should ignore `col` + vim.api.nvim_buf_set_lines(0, row, row, true, { "" }) -- vsnip will change `row` + vim.api.nvim_win_set_cursor(0, { row + 1, 0 }) -- `snip` already has indent so we should ignore `col` snip = table.concat(snip, "\n") -- vsnip expects on string instead of a list/table of lines vim.fn["vsnip#anonymous"](snip) end