-
Notifications
You must be signed in to change notification settings - Fork 19k
x/tools/gopls: add file watcher for headless mode #74292
Copy link
Copy link
Closed
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.
Milestone
Metadata
Metadata
Assignees
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.
Type
Fields
Give feedbackNo fields configured for issues without a type.
When gopls is running in headless mode (as for its MCP server), it needs a file watcher (i.e. fsnotify).
It's OK if this file watcher is not perfectly accurate.
Related:
I think we should finally take this on. The good thing about headless mode is that it is experimental and doesn't conflict with ordinary state changes from the client. However, based on what we learn, we can consider integrating the file watcher elsewhere.
For the initial implementation, we don't need to care about the complicated algebra of glob patterns that gopls computes (largely to work around client limitations). Let's just focus on watching
*.{go,mod,sum,work}. We can then produce syntheticdidChangeWatchedFilenotifications (or equivalent).This is liable to be nontrivial and deal with the gnarly bits of the gopls session construction. For whomever takes this on (if not me): let's discuss the plan before getting hands dirty.
CC @adonovan @madelinekalil @h9jiang