package
0.18.1
Repository: https://go.googlesource.com/tools
Documentation: pkg.go.dev

# Packages

Package completion provides core functionality for code completion in Go editors and tools.
Package stubmethods provides the analysis logic for the quick fix to "Declare missing methods of TYPE" errors.

# Functions

AbbreviateVarName returns an abbreviated var name based on the given full name (which may be a type name, for example).
AddImport adds a single import statement to the given file.
AddTestForFunc adds a test for the function enclosing the given input range.
Analyze reports go/analysis-framework diagnostics in the specified package.
ApplyFix applies the specified kind of suggested fix to the given file and range, returning the resulting changes.
AssemblyHTML returns an HTML document containing an assembly listing of the selected function.
ChangeSignature computes a refactoring to update the signature according to the provided parameter transformation, for the signature definition surrounding rng.
CodeActions returns all enabled code actions (edits and other commands) available for the selected range.
CodeLensSources returns the supported sources of code lenses for Go files.
CombineDiagnostics combines and filters list/parse/type diagnostics from tdiags with the analysis adiags, returning the resulting combined set.
CompilerOptDetails invokes the Go compiler with the "-json=0,dir" flag on the packages and tests in the specified directory, parses its log of optimization decisions, and returns them as a set of diagnostics.
ComputeImportFixEdits returns text edits for a single import fix.
Definition handles the textDocument/definition request for Go files.
DiagnoseFile returns pull-based diagnostics for the given file.
DocCommentToMarkdown converts the text of a [doc comment] to Markdown.
DocFragment finds the package and (optionally) symbol identified by the current selection, and returns the package path and the optional symbol URL fragment (e.g.
No description provided by the author
ExtractToNewFile moves selected declarations into a new file.
FoldingRange gets all of the folding range for f.
Format formats a file with a given range.
FormatNode returns the "pretty-print" output for an ast node.
FormatType returns the detail and kind for a types.Type.
FormatVarType formats a *types.Var, accounting for type aliases.
FreeSymbolsHTML returns an HTML document containing the report of free symbols referenced by the selection.
No description provided by the author
Hover implements the "textDocument/hover" RPC for Go files.
HoverDocForObject returns the best doc comment for obj (for which fset provides file/line information).
Implementation returns a new sorted array of locations of declarations of types that implement (or are implemented by) the type referred to at the given position.
IncomingCalls returns an array of CallHierarchyIncomingCall for a file and the position within the file.
No description provided by the author
IsGenerated gets and reads the file denoted by uri and reports whether it contains a "generated file" comment as described at https://golang.org/s/generatedcode.
KnownPackagePaths returns a new list of package paths of all known packages in the package graph that could potentially be imported by the given file.
MetadataQualifierForFile returns a metadata qualifier that chooses the best qualification of an imported package relative to the file f in package with metadata m.
NarrowestMetadataForFile returns metadata for the narrowest package (the one with the fewest files) that encloses the specified file.
NarrowestPackageForFile is a convenience function that selects the narrowest non-ITV package to which this file belongs, type-checks it in the requested mode (full or workspace), and returns it, along with the parse tree of that file.
NewBuiltinSignature returns signature for the builtin object with a given name, if a builtin object with the name exists.
NewSignature returns formatted signature for a types.Signature struct.
OutgoingCalls returns an array of CallHierarchyOutgoingCall for a file and the position within the file.
PackageDocHTML formats the package documentation page.
PackageSymbols returns a list of symbols in the narrowest package for the given file (specified by its URI).
PrepareCallHierarchy returns an array of CallHierarchyItem for a file and the position within the file.
PrepareRename searches for a valid renaming at position pp.
References returns a list of all references (sorted with definitions before uses) to the object denoted by the identifier at the given file/position, searching the entire workspace.
Rename returns a map of TextEdits for each file modified when renaming a given identifier within a package and a boolean value of true for renaming package and false otherwise.
No description provided by the author
SignatureHelp returns information about the signature of the innermost function call enclosing the position, or nil if there is none.
StdSymbolOf returns the std lib symbol information of the given obj.
TypeDefinition handles the textDocument/typeDefinition request for Go files.
WidestPackageForFile is a convenience function that selects the widest non-ITV package to which this file belongs, type-checks it in the requested mode (full or workspace), and returns it, along with the parse tree of that file.
WorkspaceSymbols matches symbols across all views using the given query, according to the match semantics parameterized by matcherType and style.

# Variables

ErrNoEmbed is returned by EmbedDefinition when no embed directive is found at a particular position.
ErrNoIdentFound is error returned when no identifier is found at a particular position.
ErrNoLinkname is returned by LinknameDefinition when no linkname directive is found at a particular position.

# Structs

A PrepareItem holds the result of a "prepare rename" operation: the source range and value of a selected identifier.

# Interfaces

Web is an abstraction of gopls' web server.

# Type aliases

An importFunc is an implementation of the single-method types.Importer interface based on a function value.
No description provided by the author
A MetadataQualifier is a function that qualifies an identifier declared in a package with the given package name, import path, and package path.
No description provided by the author
No description provided by the author
No description provided by the author