Vim-go: Idea: generate comment for func or method or type

Created on 19 May 2019  路  4Comments  路  Source: fatih/vim-go

Idea: generate comment for func or method or type

The name of the function that generated the comment

example code

package main

func Test() {
}

type A struct {
}

func (a A) MyMethod() {
}

There are several ways to trigger:

  1. Put the cursor on func to generate a comment
  2. In edit mode: Enter //f above the function, click on the tab, you should be able to implement this function with UltiSnips
package main

// Test ...
func Test() {
}

// A ...
type A struct {
}

// MyMethod ...
func (a A) MyMethod() {
}

I don't know much about vimScript, so I can't implement it, sorry.

Most helpful comment

Creating a comment with just the name of the function leaves a lot to be desired. While it would eliminate golint errors, it wouldn't do so meaningfully and would probably be used simply to silence golint without addressing the value that golint identifies as missing. Do you have any suggestions for how to implement this feature meaningfully?

All 4 comments

Creating a comment with just the name of the function leaves a lot to be desired. While it would eliminate golint errors, it wouldn't do so meaningfully and would probably be used simply to silence golint without addressing the value that golint identifies as missing. Do you have any suggestions for how to implement this feature meaningfully?

@bhcleek I mean, only used as a prefix for filling comments, the user will replace "..." with the comment content

It would be an incentive for the user to add comments. Most people would just add the name of the function in the comment to silence the linter anyways, why not make it a breeze. I think this is a necessary feature to have

I'd accept a meaningful snippet to do this if someone wants to submit it, but I'm unlikely to implement this any time soon.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jongillham picture jongillham  路  3Comments

surest picture surest  路  3Comments

mnarrell picture mnarrell  路  3Comments

andrejvanderzee picture andrejvanderzee  路  3Comments

MattFlower picture MattFlower  路  4Comments