From ba98b965e6c84c9b0c851dc2148e4621e42d7243 Mon Sep 17 00:00:00 2001 From: Daniel Mathiot Date: Sun, 12 Sep 2021 19:42:29 +0200 Subject: [PATCH] (go) Add support for godoc --- README.md | 2 ++ lua/neogen.lua | 1 + lua/neogen/configurations/go.lua | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 lua/neogen/configurations/go.lua diff --git a/README.md b/README.md index 6632e4c..c39e50e 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,8 @@ There is a list of supported languages and fields, with their annotation style | | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `@param`, `@returns`, `@class`, `@classdesc` | | c | | | | | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `@param`, `@returns` | +| go | | | +| | [Godoc](https://go.dev/blog/godoc) (`"godoc"`) | | ## Adding Languages diff --git a/lua/neogen.lua b/lua/neogen.lua index f6482dd..17ff96b 100644 --- a/lua/neogen.lua +++ b/lua/neogen.lua @@ -128,6 +128,7 @@ neogen.setup = function(opts) python = require("neogen.configurations.python"), javascript = require("neogen.configurations.javascript"), c = require("neogen.configurations.c"), + go = require("neogen.configurations.go"), }, }) diff --git a/lua/neogen/configurations/go.lua b/lua/neogen/configurations/go.lua new file mode 100644 index 0000000..f4972a3 --- /dev/null +++ b/lua/neogen/configurations/go.lua @@ -0,0 +1,24 @@ +return { + parent = { + func = { "function_declaration" }, + }, + + data = { + func = { + ["function_declaration"] = { + ["0"] = { + extract = function() + return {} + end, + }, + }, + }, + }, + + template = { + annotation_convention = "godoc", + godoc = { + { nil, " $1", { no_results = true } }, + }, + }, +}