Skip to content

tell server to support textDocument/diagnostic #2147

@Sysix

Description

@Sysix

Background

As a server, I want to support all possible clients. Some will support textDocument/publishDiagnostics, some will textDocument/diagnostic. And some will support both.
I do not want to prepare a textDocument/publishDiagnostics object when the client can support textDocument/diagnostic.

To minimize the communication between server and client, the server wants to know if the client supports pull diagnostics.

Problem 1

The server is currently implemented in this way:
-> is sending to the server, <- is sending from the server.

-> initialize
-> initialized
-> textDocument/didOpen
<- textDocument/publishDiagnostics

When telling client (found it in VSCode) that we have some ClientCapabilities.DiagnosticProvider. The flow looks like this:

-> initialize
-> initialized
-> textDocument/didOpen
<- textDocument/publishDiagnostics
-> textDocument/diagnostic

I found no way to detect if the client supports textDocument/diagnostic before sending textDocument/publishDiagnostics.
Sending 2 times the same diagnostics is an overhead in my mind.

Problem 2

Probably an own issue, but this is related a bit.
The server does not need to support the new way textDocument/diagnostic. It wants to support workspace/diagnostic. Setting ClientCapabilities.DiagnosticProvider to tell the client that the server support workspace/diagnostic, will automatically enable textDocument/diagnostic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions