Skip to content

Commit df7c77b

Browse files
author
Maria José Solano
authored
Specification for MarkupContent support in diagnostic messages (#1905)
* add markup diagnostic message spec * Update metamodel
1 parent 16210fb commit df7c77b

File tree

5 files changed

+100
-5
lines changed

5 files changed

+100
-5
lines changed

_specifications/lsp/3.18/general/initialize.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,28 @@ interface ServerCapabilities {
885885
*/
886886
inlineCompletionProvider?: boolean | InlineCompletionOptions;
887887

888+
/**
889+
* Text document specific server capabilities.
890+
*
891+
* @since 3.18.0
892+
*/
893+
textDocument?: {
894+
/**
895+
* Capabilities specific to the diagnostic pull model.
896+
*
897+
* @since 3.18.0
898+
*/
899+
diagnostic?: {
900+
/**
901+
* Whether the server supports `MarkupContent` in diagnostic messages.
902+
*
903+
* @since 3.18.0
904+
* @proposed
905+
*/
906+
markupMessageSupport?: boolean;
907+
};
908+
};
909+
888910
/**
889911
* Workspace specific server capabilities
890912
*/

_specifications/lsp/3.18/language/codeAction.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ export interface CodeActionContext {
361361
* for the given range. There is no guarantee that these accurately reflect
362362
* the error state of the resource. The primary parameter
363363
* to compute code actions is the provided range.
364+
*
365+
* Note that the client should check the `textDocument.diagnostic.markupMessageSupport`
366+
* server capability before sending diagnostics with markup messages to a server.
364367
*/
365368
diagnostics: Diagnostic[];
366369

_specifications/lsp/3.18/language/pullDiagnostics.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ export interface DiagnosticClientCapabilities {
3030
* pulls.
3131
*/
3232
relatedDocumentSupport?: boolean;
33+
34+
/**
35+
* Whether the client supports `MarkupContent` in diagnostic messages.
36+
*
37+
* @since 3.18.0
38+
* @proposed
39+
*/
40+
markupMessageSupport?: boolean;
3341
}
3442
```
3543

_specifications/lsp/3.18/metaModel/metaModel.json

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8736,6 +8736,41 @@
87368736
"since": "3.18.0",
87378737
"proposed": true
87388738
},
8739+
{
8740+
"name": "textDocument",
8741+
"type": {
8742+
"kind": "literal",
8743+
"value": {
8744+
"properties": [
8745+
{
8746+
"name": "diagnostic",
8747+
"type": {
8748+
"kind": "literal",
8749+
"properties": [
8750+
{
8751+
"name": "markupMessageSupport",
8752+
"type": {
8753+
"kind": "base",
8754+
"name": "boolean"
8755+
},
8756+
"optional": true,
8757+
"documentation": "Whether the server supports `MarkupContent` in diagnostic messages.",
8758+
"since": "3.18.0",
8759+
"proposed": true
8760+
}
8761+
]
8762+
},
8763+
"optional": true,
8764+
"documentation": "Capabilities specific to the diagnostic pull model.\n\n@since 3.18.0",
8765+
"since": "3.18.0"
8766+
}
8767+
]
8768+
}
8769+
},
8770+
"optional": true,
8771+
"documentation": "Text document specific server capabilities.\n\n@since 3.18.0\n@proposed",
8772+
"since": "3.18.0"
8773+
},
87398774
{
87408775
"name": "workspace",
87418776
"type": {
@@ -8920,10 +8955,19 @@
89208955
{
89218956
"name": "message",
89228957
"type": {
8923-
"kind": "base",
8924-
"name": "string"
8958+
"kind": "or",
8959+
"items": [
8960+
{
8961+
"kind": "base",
8962+
"name": "string"
8963+
},
8964+
{
8965+
"kind": "reference",
8966+
"name": "MarkupContent"
8967+
}
8968+
]
89258969
},
8926-
"documentation": "The diagnostic's message. It usually appears in the user interface"
8970+
"documentation": "The diagnostic's message. It usually appears in the user interface.\n\n@since 3.18.0 - support for `MarkupContent`. This is guarded by the client capability `textDocument.diagnostic.markupMessageSupport`."
89278971
},
89288972
{
89298973
"name": "tags",
@@ -9388,7 +9432,7 @@
93889432
"name": "Diagnostic"
93899433
}
93909434
},
9391-
"documentation": "An array of diagnostics known on the client side overlapping the range provided to the\n`textDocument/codeAction` request. They are provided so that the server knows which\nerrors are currently presented to the user for the given range. There is no guarantee\nthat these accurately reflect the error state of the resource. The primary parameter\nto compute code actions is the provided range."
9435+
"documentation": "An array of diagnostics known on the client side overlapping the range provided to the\n`textDocument/codeAction` request. They are provided so that the server knows which\nerrors are currently presented to the user for the given range. There is no guarantee\nthat these accurately reflect the error state of the resource. The primary parameter\nto compute code actions is the provided range.\n\nNote that the client should check the `textDocument.diagnostic.markupMessageSupport` server capability before sending diagnostics with markup messages to a server."
93929436
},
93939437
{
93949438
"name": "only",
@@ -12870,6 +12914,17 @@
1287012914
},
1287112915
"optional": true,
1287212916
"documentation": "Whether the clients supports related documents for document diagnostic pulls."
12917+
},
12918+
{
12919+
"name": "markupMessageSupport",
12920+
"type": {
12921+
"kind": "base",
12922+
"name": "boolean"
12923+
},
12924+
"optional": true,
12925+
"documentation": "Whether the client supports `MarkupContent` in diagnostic messages.",
12926+
"since": "3.18.0",
12927+
"proposed": true
1287312928
}
1287412929
],
1287512930
"documentation": "Client capabilities specific to diagnostic pull requests.\n\n@since 3.17.0",

_specifications/lsp/3.18/types/diagnostic.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#### <a href="#diagnostic" name="diagnostic" class="anchor"> Diagnostic </a>
22

3+
- New in version 3.18: support for markup content in diagnostic messages. The support is guarded by the
4+
client capability `textDocument.diagnostic.markupMessageSupport`. If a client doesn't signal the capability,
5+
servers shouldn't send `MarkupContent` diagnostic messages back to the client.
6+
37
Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only valid in the scope of a resource.
48

59
```typescript
@@ -35,8 +39,11 @@ export interface Diagnostic {
3539

3640
/**
3741
* The diagnostic's message.
42+
*
43+
* @since 3.18.0 - support for MarkupContent. This is guarded by the client
44+
* capability `textDocument.diagnostic.markupMessageSupport`.
3845
*/
39-
message: string;
46+
message: string | MarkupContent;
4047

4148
/**
4249
* Additional metadata about the diagnostic.

0 commit comments

Comments
 (0)