Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoDot = errors.New("name does not contain a qualifier separator")
ErrNoDot is returned by ResolveSymbol when the name does not contain a "." separating the qualifier (package or module) from the symbol, regardless of language, and therefore cannot be resolved to a qualified symbol.
Functions ¶
This section is empty.
Types ¶
type Match ¶ added in v0.0.99
type Match struct {
URI string
Pos term.Coordinates
Display string
ImportPath string
}
Match represents a resolved symbol location.
type NodeCaptureName ¶ added in v0.0.14
type NodeCaptureName uint32
NodeCaptureName represents a known node capture name on an IDE provided query. Values can be combined using bitwise OR to search for multiple node types.
const ( NodeCaptureScope NodeCaptureName = 1 << iota NodeCaptureDefinitionNamespace NodeCaptureReference NodeCaptureDefinitionFunc NodeCaptureDefinitionVar NodeCaptureDefinitionMethod NodeCaptureDefinitionType NodeCaptureNameAll = NodeCaptureScope | NodeCaptureDefinitionNamespace | NodeCaptureReference | NodeCaptureDefinitionFunc | NodeCaptureDefinitionVar | NodeCaptureDefinitionMethod | NodeCaptureDefinitionType )
type Parser ¶ added in v0.0.24
type Parser interface {
// Search searches for matches in the workspace using the given tree-sitter literal query
// and a list of capture names that should be returned. An optional set of language names
// (e.g. "go", "python") restricts the search to files of those languages.
Search(query string, captureNames []string, languages ...string) (iterator.Iterator[Result], error)
// SearchNode is implemented with Search by using an internally provided
// query that is able to capture a known set of tree nodes across programming
// languages. Multiple node types can be combined using bitwise OR. An
// optional set of language names (e.g. "go", "python") restricts the search
// to files of those languages.
SearchNode(nodeTypes NodeCaptureName, languages ...string) (iterator.Iterator[Result], error)
// Query searches for matches in a specific file using the given tree-sitter
// literal query and a list of capture names that should be returned.
Query(file workspaceapi.URI, query string, captureNames []string) (
iterator.Iterator[Result], error,
)
// QueryNode is implemented with Query by using an internally provided
// query that is able to capture a known set of tree nodes across
// programming languages. Multiple node types can be combined using bitwise OR.
QueryNode(file workspaceapi.URI, nodeTypes NodeCaptureName) (
iterator.Iterator[Result], error,
)
// Highlight returns syntax highlighting locations for the given content,
// interpreted as belonging to the file identified by uri.
Highlight(uri workspaceapi.URI, content string) (
iterator.Iterator[textapi.Location], error,
)
// ResolveSymbol resolves a dotted symbol name (e.g. "pkg.Symbol") to the
// locations that define or reference it across the workspace.
// Progress, if non-nil, receives incremental updates. ResolveSymbol returns
// ErrNoDot when the name is not a fully qualified symbol name.
ResolveSymbol(ctx context.Context, name string, progress Progress) (
iterator.Iterator[Match], error,
)
// ListReferencedSymbols streams the fully qualified names (e.g.
// "pkg.Symbol") of every package/module-qualified symbol referenced or
// defined across the workspace, deduplicated by the caller.
ListReferencedSymbols(ctx context.Context) (iterator.Iterator[string], error)
}
Parser provides workspace-wide AST-level search and parsing capabilities.
type ProgressFunc ¶ added in v0.0.99
ProgressFunc adapts a function to the Progress interface.
type Result ¶
type Result struct {
File workspaceapi.URI
Text string
From term.Coordinates
To term.Coordinates
CaptureName string
}
Result represents a single search match.
Click to show internal directories.
Click to hide internal directories.