Only append annotation if there's one
This commit is contained in:
@@ -44,15 +44,22 @@ neogen.generate = function(opts)
|
|||||||
|
|
||||||
if data then
|
if data then
|
||||||
-- Will try to generate the documentation from a template and the data found from the granulator
|
-- Will try to generate the documentation from a template and the data found from the granulator
|
||||||
local to_place, start_column, content = language.generator(located_parent_node, data, language.template, opts.type)
|
local to_place, start_column, content = language.generator(
|
||||||
|
located_parent_node,
|
||||||
|
data,
|
||||||
|
language.template,
|
||||||
|
opts.type
|
||||||
|
)
|
||||||
|
|
||||||
-- Append the annotation in required place
|
if #content ~= 0 then
|
||||||
vim.fn.append(to_place, content)
|
-- Append the annotation in required place
|
||||||
|
vim.fn.append(to_place, content)
|
||||||
|
|
||||||
-- Place cursor after annotations ans start editing
|
-- Place cursor after annotations and start editing
|
||||||
if neogen.configuration.input_after_comment == true then
|
if neogen.configuration.input_after_comment == true and #data ~= 0 then
|
||||||
vim.fn.cursor(to_place + 1, start_column)
|
vim.fn.cursor(to_place + 1, start_column)
|
||||||
vim.api.nvim_command("startinsert!")
|
vim.api.nvim_command("startinsert!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user