syntaxapi

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

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 Result

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

Result represents a single search match.

type Searcher

type Searcher 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,
	)
}

Searcher provides AST-level search capabilities.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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