syntaxapi

package
v0.0.57 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 4 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 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.
	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 workspace-wide 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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