textsearch

package
v0.1.0-rc.8 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package textsearch shares find/replace semantics between the editor and server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Match

type Match struct {
	Start, End int
	// contains filtered or unexported fields
}

type Options

type Options struct {
	CaseSensitive, WholeWord, Regex, PreserveCase bool
}

type Pattern

type Pattern struct {
	// contains filtered or unexported fields
}

func Compile

func Compile(query string, options Options) (*Pattern, error)

func (*Pattern) FindAll

func (p *Pattern) FindAll[T string | []byte](content T, dst []Match, limit int) []Match

FindAll reuses caller-owned storage. A negative limit retains every match.

func (*Pattern) FindRange

func (p *Pattern) FindRange[T string | []byte](content T, dst []Match, start, end, limit int, countAll bool) ([]Match, int)

FindRange keeps document-relative offsets and word/regexp boundary semantics. countAll counts matches beyond the storage limit without retaining them.

func (*Pattern) FindSnapshot

func (p *Pattern) FindSnapshot(content piecetree.Snapshot, dst []Match, start, end, limit int) []Match

FindSnapshot searches immutable pieces without materializing the document. Regexp readers preserve whole-document assertion and submatch semantics.

func (*Pattern) Replace

func (p *Pattern) Replace(content, replacement string, matches []Match) string

Replace applies the original ranges once, so inserted matches are never visited.

func (*Pattern) Replacement

func (p *Pattern) Replacement(content string, match Match, replacement string) string

Jump to

Keyboard shortcuts

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