filewatcher

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

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

Watcher collects events from a fsnotify.Watcher and converts them into batched LSP [protocol.FileEvent]s.

func New

func New(delay time.Duration, logger *slog.Logger, handler func([]protocol.FileEvent, error)) (*Watcher, error)

New creates a new file watcher and starts its event-handling loop. The Watcher.Close method must be called to clean up resources.

The provided handler is called sequentially with either a batch of file events or an error. Events and errors may be interleaved. The watcher blocks until the handler returns, so the handler should be fast and non-blocking.

func (*Watcher) Close

func (w *Watcher) Close() error

Close shuts down the watcher, waits for the internal goroutine to terminate, and returns any final error.

func (*Watcher) WatchDir

func (w *Watcher) WatchDir(path string) error

WatchDir walks through the directory and all its subdirectories, adding them to the watcher.

Jump to

Keyboard shortcuts

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