Skip to content

x/tools/gopls: support textDocument/diagnostic #60122

Description

@findleyr

gopls commands use a gopls/diagnoseFiles "non standard request" to implement file diagnostics for commands and testing. Unfortunately, this still publishes diagnostics asynchronously, and so suffers from syncronization problems (e.g. #59475).

There is now a textDocument/diagnostic LSP method that does exactly what we want: return diagnostics for a requested file. We should implement this method and use it instead.

Furthermore, we should remove support for non-standard requests. workspace/executeCommand is a better extensibility mechanism.

Implementing textDocument/diagnostic should be done with some care: if we advertise this capability, some clients may start requesting diagnostics rather than letting gopls compute them asynchronously. This may have lifecycle and performance implications.

CC @adonovan

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions