Make comment in after position more resilient

This commit is contained in:
Daniel Mathiot
2021-08-23 15:08:41 +02:00
parent 40616b25d7
commit 03781f23d6
3 changed files with 10 additions and 10 deletions

View File

@@ -2,7 +2,7 @@ local ts_utils = require("nvim-treesitter.ts_utils")
return {
-- Search for these nodes
parent = { "function_definition" },
parent = { "function_definition", "class_definition" },
-- Traverse down these nodes and extract the information as necessary
data = {
@@ -28,11 +28,11 @@ return {
template = {
annotation_convention = "google_docstrings", -- required: Which annotation convention to use (default_generator)
append = { position = "after", offset = 4 }, -- optional: where to append the text (default_generator)
append = { position = "after", child_number = 3 }, -- optional: where to append the text (default_generator)
use_default_comment = false, -- If you want to prefix the template with the default comment for the language (default_generator)
google_docstrings = {
{ nil, '"""' },
{ "parameters", "\t%s: ", { before_first_item = "Args: " } },
{ "parameters", "\t%s: ", { before_first_item = "Args: " } }, -- FIXME when no parameter is set
{ nil, '"""' },
},
},