Skip to content

plugin for IntelliJ Platform to auto generate comment for golang.

License

Notifications You must be signed in to change notification settings

0x00b/golandanno

 
 

Repository files navigation

GoComment (Goland Comment)

GoComment is a plugin for goland, auto generate for golang function, variable, struct comments. 使用默认模版可以生成满足golint要求的注释。可在goland扩展插件中搜索 GoComment。 本仓库是goland版本,对应的vscode版本地址 https://github.com/0x00b/vscode-go-comment

How to use

  • control + command + / (For windows: control + alt + /)
  • 2.Right click -> Generate -> GoComment
  • 3.Edit comment template

config template

  • 1.Select "Tools - GoComment Setting"
  • 2.Edit template

推荐使用默认注释,满足Golang godoc注释规范,满足golint默认扫描规则。

点击查看使用介绍

使用godoc查看注释效果如下:

godoc -http=localhost:6060

Fork from IntelliJ Platform Plugin Template . IntelliJ Platform Plugin Template is a repository that provides a pure boilerplate template to make it easier to create a new plugin project (check the [Creating a repository from a template][gh:template] article).

Getting started

How to install

1.goland plugins marketplace(search GoComment)

special tag, represent beginning of a special line.

  • @receiver : golang function receiver
  • @param : golang function parameter
  • @return : golang function return parameter
  • @update : update tag, when update annotation, will add one line

support variable

func (r receiver)Foo(i interface{}) (e error)
  • ${func_name} : function name is "Foo".
  • ${receiver_name} : will be replaced by "r".
  • ${receiver_type} : will be replaced by "receiver".
  • ${receiver_name_type} : will be replaced by "r receiver".
  • ${param_name} : "i"
  • ${param_type} : "interface{}"
  • ${param_name_type} : "i interface{}"
  • ${return_name} : "e"
  • ${return_type} : "error"
  • ${return_name_type} : "e error"
  • ${package_name} : package name
  • ${type_name} : type Int int64, ${type_name} is "Int"
  • ${var_name} : var n int, ${var_name} is "n"
  • ${var_type} : var n int, ${var_type} is "int"
  • ${date} : date
  • ${git_name}: git config name

About

plugin for IntelliJ Platform to auto generate comment for golang.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 93.9%
  • Kotlin 6.1%