type Command … type Field … // Load returns a description of the workspace/executeCommand commands // supported by gopls based on static analysis of the command.Interface type. func Load() ([]*Command, error) { … } type fieldLoader … var universeError … func (l *fieldLoader) loadMethod(pkg *packages.Package, m *types.Func) (*Command, error) { … } func (l *fieldLoader) loadField(pkg *packages.Package, obj *types.Var, doc, tag string) (*Field, error) { … } // splitDoc parses a command doc string to separate the title from normal // documentation. // // The doc comment should be of the form: "MethodName: Title\nDocumentation" func splitDoc(text string) (title, doc string) { … } // lspName returns the normalized command name to use in the LSP. func lspName(methodName string) string { … } // splitCamel splits s into words, according to camel-case word boundaries. // Initialisms are grouped as a single word. // // For example: // // "RunTests" -> []string{"Run", "Tests"} // "GCDetails" -> []string{"GC", "Details"} func splitCamel(s string) []string { … } // findField finds the struct field or interface method positioned at pos, // within the AST. func findField(pkg *packages.Package, pos token.Pos) (*ast.Field, error) { … }