Method

LspClientpublish_diagnostics_async

Declaration

void
lsp_client_publish_diagnostics_async (
  LspClient* self,
  GUri* uri,
  LspDiagnostic** diagnostics,
  gint diagnostics_length1,
  gint64* version,
  GAsyncReadyCallback _callback_,
  void* _callback__target
)

Description

Diagnostics notifications are sent from the server to the client to signal results of validation runs.

Diagnostics are “owned” by the server so it is the server’s responsibility to clear them if necessary. The following rule is used for VS Code servers that generate diagnostics:

  • if a language is single file only (for example HTML) then diagnostics are cleared by the server when the file is closed. Please note that open / close events don’t necessarily reflect what the user sees in the user interface. These events are ownership events. So with the current version of the specification it is possible that problems are not cleared although the file is not visible in the user interface since the client has not closed the file yet.

  • if a language has a project system (for example C#) diagnostics are not cleared when a file closes. When a project is opened all diagnostics for all files are recomputed (or read from a cache).

When a file changes it is the server’s responsibility to re-compute diagnostics and push them to the client. If the computed set is empty it has to push the empty array to clear former diagnostics. Newly pushed diagnostics always replace previously pushed diagnostics. There is no merging that happens on the client side.

Parameters

uri

Type: GUri

The URI for which diagnostic information is reported.

The data is owned by the caller of the method.
diagnostics

Type: An array of LspDiagnostic*

An array of diagnostic information. Pass in null to clear diagnostics.

The argument can be NULL.
The length of the array is specified in the diagnostics_length1 argument.
The data is owned by the caller of the method.
diagnostics_length1

Type: gint

No description available.

version

Type: gint64*

The version number of the document the diagnostics are published for.

The argument can be NULL.
The data is owned by the caller of the method.
_callback_

Type: GAsyncReadyCallback

No description available.

The argument can be NULL.
_callback__target

Type: void*

No description available.

The argument can be NULL.
The data is owned by the caller of the method.