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: - #67995 - #67529 - #52284
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 synthetic didChangeWatchedFile
notifications (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
Comment From: gabyhelp
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)