Skip to content

x/tools/gopls: file watchers should be reevaluated after load #60340

@findleyr

Description

@findleyr

Normally I would just fix this bug, but given our proximity to the v0.12.0 release I'm filing it for later:

When state changes in gopls, we re-evaluate file watchers. Currently, this is done synchronously to the state change processing, via Server.didModifyFiles->updateWatchedDirectories.

Problems with this:

  • AFAIK there is no need to block change processing on updating watched directories. File watching is always going to be asynchronous, so I don't think we avoid any races by blocking while processing didChange notifications
  • we should generally avoid blocking on server->client calls during notification processing, as it can lead to distributed deadlocks in certain clients
  • we should awaitLoaded before re-evaluating file watches, as go list might surface new directories to watch after e.g. a go.mod change. We can't awaitLoaded during change processing.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions