syntaxapi

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

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 Progress added in v0.0.99

type Progress interface {
	Report(msg string, found int, step, total int64)
}

Progress reports incremental progress while resolving a symbol.

type ProgressFunc added in v0.0.99

type ProgressFunc func(msg string, found int, step, total int64)

ProgressFunc adapts a function to the Progress interface.

func (ProgressFunc) Report added in v0.0.99

func (f ProgressFunc) Report(msg string, found int, step, total int64)

Report implements Progress.

type Result

type Result struct {
	File        workspaceapi.URI
	Text        string
	From        term.Coordinates
	To          term.Coordinates
	CaptureName string
}

Result represents a single search match.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL