// FormatType returns the detail and kind for a types.Type. func FormatType(typ types.Type, qf types.Qualifier) (detail string, kind protocol.CompletionItemKind) { … } type signature … func (s *signature) Format() string { … } func (s *signature) TypeParams() []string { … } func (s *signature) Params() []string { … } // NewBuiltinSignature returns signature for the builtin object with a given // name, if a builtin object with the name exists. func NewBuiltinSignature(ctx context.Context, s *cache.Snapshot, name string) (*signature, error) { … } var replacer … func formatFieldList(ctx context.Context, fset *token.FileSet, list *ast.FieldList, variadic bool) ([]string, bool) { … } // NewSignature returns formatted signature for a types.Signature struct. func NewSignature(ctx context.Context, s *cache.Snapshot, pkg *cache.Package, sig *types.Signature, comment *ast.CommentGroup, qf types.Qualifier, mq MetadataQualifier) (*signature, error) { … } var invalidTypeString … // FormatVarType formats a *types.Var, accounting for type aliases. // To do this, it looks in the AST of the file in which the object is declared. // On any errors, it always falls back to types.TypeString. // // TODO(rfindley): this function could return the actual name used in syntax, // for better parameter names. func FormatVarType(ctx context.Context, snapshot *cache.Snapshot, srcpkg *cache.Package, obj *types.Var, qf types.Qualifier, mq MetadataQualifier) (string, error) { … } // qualifyTypeExpr clones the type expression expr after re-qualifying type // names using the given function, which accepts the current syntactic // qualifier (possibly "" for unqualified idents), and returns a new qualifier // (again, possibly "" if the identifier should be unqualified). // // The resulting expression may be inaccurate: without type-checking we don't // properly account for "." imported identifiers or builtins. // // TODO(rfindley): add many more tests for this function. func qualifyTypeExpr(expr ast.Expr, qf func(string) string) ast.Expr { … } func qualifyFieldList(fl *ast.FieldList, qf func(string) string) *ast.FieldList { … }