Skip to content

x/tools/gopls: respect directoryFilters in filewatcher #81630

Open

Description

@danp

I've been using gopls.fileWatcher=fsnotify for my LSP usage of gopls since it was added.

It seems to work great. But I have had to carry a local patch that that includes node_modules in skipDir, otherwise I run out of file descriptors.

I think #76291 is related, for MCP usage.

Would be nice if gopls.directoryFilters was respected in the filewatcher machinery as it already includes -**/node_modules by default.

There is a TODO in the code for this.

Activity

  1. added
    goplsIssues related to the Go language server, gopls.
    on Sep 21, 2026
  2. danp commented on Sep 21, 2026

    @danp
    ContributorAuthor

    (maybe this is still considered to be part of #67995)

  3. changed the title [-]gopls/internal/filewatcher: respect directoryFilters[/-] [+]x/tools/gopls: respect directoryFilters in filewatcher[/+] on Sep 23, 2026
  4. added
    ToolsThis label describes issues relating to any tools in the x/tools repository.
    on Sep 23, 2026
  5. added this to the Unreleased milestone on Sep 23, 2026
  6. h9jiang commented on Sep 28, 2026

    @h9jiang
    Member

    It requires a little bit more change as the file watcher today statically determines the dir it watches, and the gopls setting can be changed after LSP session start. So we need to have the support for

    • whether a dir should be watched or not
    • unwatch a dir if configuration changes
    • watch a dir if configuration changes

    We are releasing v0.24.0 very soon so v0.25.0 will be a reasonable timeline for fix. I will let you know once finished so you can give it a try by install gopls from @master. @danp

    Thank you so much for raising this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions