Commit 0ae5973
authored
Improve LSP conformance in MS.CA.LanguageServer (#81174)
I am proposing fixes for two LSP conformance issues I discovered while
integrating Roslyn LSP with Zed:
1. The response from the `textDocument/diagnostic` request cannot be
`null`. MS.CA.LanguageServer currently returns a `null` response in the
case described here:
https://github.com/dotnet/roslyn/blob/76a39c1a97fe5c73549786fc6944dc188a7b7b3b/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSourceProviders/DiagnosticSourceManager.cs#L72-L80
Because the set of diagnostic handlers is empty, a response value is
never generated for the request, and we fall through to returning
`null`. Instead, explicitly return an empty list of diagnostics. (This
is exactly how VS Code's LSP client treats a `null` response.)
2. Methods that take no parameters (e.g. `workspace/diagnostic/refresh`)
were being sent with an empty array as the parameter value. This is
because the `InvokeWithCancellationAsync` method in StreamJsonRpc
normalizes unspecified arguments to an empty list. Use the
`InvokeParameterObjectAsync` method instead, which don't do this.1 parent 0ed9e05 commit 0ae5973
File tree
5 files changed
+32
-20
lines changed- src/LanguageServer
- ProtocolUnitTests/Diagnostics
- Protocol/Handler
- Diagnostics/Public
5 files changed
+32
-20
lines changedLines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
Lines changed: 6 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
| 274 | + | |
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
| 280 | + | |
| 281 | + | |
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
284 | 285 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 286 | + | |
291 | 287 | | |
292 | 288 | | |
293 | | - | |
| 289 | + | |
294 | 290 | | |
295 | 291 | | |
296 | 292 | | |
297 | | - | |
| 293 | + | |
298 | 294 | | |
299 | 295 | | |
300 | 296 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
54 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
55 | 68 | | |
56 | 69 | | |
57 | 70 | | |
| |||
0 commit comments