Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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.
Search(query string, captureNames []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.
SearchNode(nodeTypes NodeCaptureName) (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,
)
}
Parser provides AST-level search and parsing capabilities.
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.