type postfixTmpl … type postfixTmplArgs … var postfixTmpls … // Cursor indicates where the client's cursor should end up after the // snippet is done. func (a *postfixTmplArgs) Cursor() string { … } // Placeholder indicate a tab stop with the placeholder string, the order // of tab stops is the same as the order of invocation func (a *postfixTmplArgs) Placeholder(placeholder string) string { … } // nextTabStop returns the next tab stop index for a new placeholder. func (a *postfixTmplArgs) nextTabStop() int { … } // SpecifiedPlaceholder indicate a specified tab stop with the placeholder string. // Sometimes the same tab stop appears in multiple places and their numbers // need to be specified. e.g. variferr func (a *postfixTmplArgs) SpecifiedPlaceholder(tabStop int, placeholder string) string { … } // Import makes sure the package corresponding to path is imported, // returning the identifier to use to refer to the package. func (a *postfixTmplArgs) Import(path string) (string, error) { … } func (a *postfixTmplArgs) EscapeQuotes(v string) string { … } // ElemType returns the Elem() type of xType, if applicable. func (a *postfixTmplArgs) ElemType() types.Type { … } // Kind returns the underlying kind of type, e.g. "slice", "struct", // etc. func (a *postfixTmplArgs) Kind() string { … } // KeyType returns the type of X's key. KeyType panics if X is not a // map. func (a *postfixTmplArgs) KeyType() types.Type { … } // Tuple returns the tuple result vars if the type of X is tuple. func (a *postfixTmplArgs) Tuple() []*types.Var { … } // TupleLast returns the last tuple result vars if the type of X is tuple. func (a *postfixTmplArgs) TupleLast() *types.Var { … } // TypeName returns the textual representation of type t. func (a *postfixTmplArgs) TypeName(t types.Type) (string, error) { … } // Zero return the zero value representation of type t func (a *postfixTmplArgs) Zero(t types.Type) string { … } func (a *postfixTmplArgs) IsIdent() bool { … } // VarName returns a suitable variable name for the type t. If t // implements the error interface, "err" is used. If t is not a named // type then nonNamedDefault is used. Otherwise a name is made by // abbreviating the type name. If the resultant name is already in // scope, an integer is appended to make a unique name. func (a *postfixTmplArgs) VarName(t types.Type, nonNamedDefault string) string { … } func (c *completer) addPostfixSnippetCandidates(ctx context.Context, sel *ast.SelectorExpr) { … } var postfixRulesOnce … func initPostfixRules() { … } func inc(i int) int { … } // importIfNeeded returns the package identifier and any necessary // edits to import package pkgPath. func (c *completer) importIfNeeded(pkgPath string, scope *types.Scope) (string, []protocol.TextEdit, error) { … }