Unreviewed changes
1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: gopls/internal/filewatcher/filewatcher.go
Insertions: 2, Deletions: 0.
@@ -31,6 +31,8 @@
// 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.
+//
+// TODO(hxjiang): replace mode string to enum.
func New(mode string, interval time.Duration, logger *slog.Logger, onEvents func([]protocol.FileEvent), onError func(error)) (Watcher, error) {
switch mode {
// TODO (hxjiang): support poll watcher.
```
```
The name of the file: gopls/internal/filewatcher/fsnotify_watcher.go
Insertions: 2, Deletions: 0.
@@ -7,6 +7,7 @@
import (
"errors"
"io/fs"
+ "log"
"log/slog"
"os"
"path/filepath"
@@ -292,6 +293,7 @@
// WatchDir walks through the directory and all its subdirectories, adding
// them to the watcher.
func (w *fsnotifyWatcher) WatchDir(path string) error {
+ log.Printf("Watching %s", path)
return filepath.WalkDir(filepath.Clean(path), func(path string, d fs.DirEntry, err error) error {
if d.IsDir() {
if skipDir(d.Name()) {
```
Change information
Commit message:
gopls/internal/filewatcher: add watcher interface
This change introduces a Watcher interface to allow for alternative
file-watching implementations (e.g., a git status-like scanner).
The existing fsnotify-based implementation is renamed to fsnotifyWatcher.
For golang/go#77814 golang/go#76291
Change-Id: I73e2c2526bb8accec18caef17c051211b026830b
Files:
- M gopls/internal/cmd/mcp.go
- M gopls/internal/filewatcher/filewatcher.go
- M gopls/internal/filewatcher/filewatcher_test.go
- A gopls/internal/filewatcher/fsnotify_watcher.go
Change size: XL
Delta: 4 files changed, 566 insertions(+), 519 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Code-Review: +2 by Alan Donovan
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI