watcher

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitignoreMatcher added in v0.0.2

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

GitignoreMatcher provides a simple wrapper around the go-gitignore package

func NewGitignoreMatcher added in v0.0.2

func NewGitignoreMatcher(workspacePath string) (*GitignoreMatcher, error)

NewGitignoreMatcher creates a new gitignore matcher for a workspace

func (*GitignoreMatcher) ShouldIgnore added in v0.0.2

func (g *GitignoreMatcher) ShouldIgnore(path string, isDir bool) bool

ShouldIgnore checks if a file or directory should be ignored based on gitignore patterns

type LSPClient added in v0.0.2

type LSPClient interface {
	// IsFileOpen checks if a file is already open in the editor
	IsFileOpen(path string) bool

	// OpenFile opens a file in the editor
	OpenFile(ctx context.Context, path string) error

	// NotifyChange notifies the server of a file change
	NotifyChange(ctx context.Context, path string) error

	// DidChangeWatchedFiles sends watched file events to the server
	DidChangeWatchedFiles(ctx context.Context, params protocol.DidChangeWatchedFilesParams) error
}

LSPClient defines the minimal interface needed by the watcher

type WatcherConfig added in v0.0.2

type WatcherConfig struct {
	// DebounceTime is the duration to wait before sending file change events
	DebounceTime time.Duration

	// ExcludedDirs are directory names that should be excluded from watching
	ExcludedDirs map[string]bool

	// ExcludedFileExtensions are file extensions that should be excluded from watching
	ExcludedFileExtensions map[string]bool

	// LargeBinaryExtensions are file extensions for large binary files that shouldn't be opened
	LargeBinaryExtensions map[string]bool

	// MaxFileSize is the maximum size of a file to open
	MaxFileSize int64
}

WatcherConfig holds basic configuration for the watcher

func DefaultWatcherConfig added in v0.0.2

func DefaultWatcherConfig() *WatcherConfig

DefaultWatcherConfig returns a configuration with sensible defaults

type WorkspaceWatcher

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

WorkspaceWatcher manages LSP file watching

func NewWorkspaceWatcher

func NewWorkspaceWatcher(client LSPClient) *WorkspaceWatcher

NewWorkspaceWatcher creates a new workspace watcher with default configuration

func NewWorkspaceWatcherWithConfig added in v0.0.2

func NewWorkspaceWatcherWithConfig(client LSPClient, config *WatcherConfig) *WorkspaceWatcher

NewWorkspaceWatcherWithConfig creates a new workspace watcher with custom configuration

func (*WorkspaceWatcher) AddRegistrations added in v0.0.2

func (w *WorkspaceWatcher) AddRegistrations(ctx context.Context, id string, watchers []protocol.FileSystemWatcher)

AddRegistrations adds file watchers to track

func (*WorkspaceWatcher) WatchWorkspace

func (w *WorkspaceWatcher) WatchWorkspace(ctx context.Context, workspacePath string)

WatchWorkspace sets up file watching for a workspace

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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