-
How do I go about adding documentation that shows up in the editor? (to replace below) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I've prepared an example for this, turned out there was some issues with the documentation generation that I've resolved and I've also added support for methods. https://github.com/grow-graphics/eg/blob/master/1d/documentation/documentation.go package main
import (
"graphics.gd/classdb"
"graphics.gd/startup"
"graphics.gd/variant/Object"
)
type ClassWithDocumentation struct {
classdb.Extension[ClassWithDocumentation, Object.Instance] `gd:"ClassWithDocumentation"
serves as an example of how to document a class in Go code.`
MyField int `gd:"my_field"
can store an integer value.`
}
func (c *ClassWithDocumentation) MyMethod() {}
func main() {
classdb.Register[ClassWithDocumentation](
map[string]any{ // method renames
"ignore_this_method": (*ClassWithDocumentation).MyMethod,
},
map[string]string{ // symbol documentation
"ignore_this_method": `
does not do anything.`,
},
)
startup.Scene()
} This is the result: If you run into issues with your IDE with using struct tags this way, you can either move it into the map[string]string, or VS Code + gopls "go.vetFlags": [
"-structtag=false"
],
"gopls": {
"analyses": {
"structtag": false
},
}, Zed: "lsp": {
"gopls": {
"initialization_options": {
"analyses": {
"structtag": false
}
}
}
} |
Beta Was this translation helpful? Give feedback.
I've prepared an example for this, turned out there was some issues with the documentation generation that I've resolved and I've also added support for methods.
https://github.com/grow-graphics/eg/blob/master/1d/documentation/documentation.go