Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClosed = errors.New("file watcher: watcher already closed")
ErrClosed is used when trying to operate on a closed Watcher.
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, eventsHandler func([]protocol.FileEvent), errHandler func(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 event handler is called sequentially with a batch of file events, but the error handler is called concurrently. The watcher blocks until the handler returns, so the handlers should be fast and non-blocking.
Click to show internal directories.
Click to hide internal directories.