I try to request diagnostics from my LSP using the following code
var report = await client.RequestDocumentDiagnostic(new DocumentDiagnosticParams()
{
TextDocument = textDocument,
Identifier = "luau"
});
Console.WriteLine(report);
Where client is my LanguageClient that I've initialized. Other methods like RequestCompletion
and RequestHover
work as expected.
However, when I try to call the RequestDocumentDiagnostic
method, it gives me the following error:
Unhandled exception. System.NotImplementedException: The method or operation is not implemented.
at OmniSharp.Extensions.LanguageServer.Protocol.Models.RelatedDocumentDiagnosticReport.Converter.ReadJson(JsonReader reader, Type objectType, RelatedDocumentDiagnosticReport existingValue, Boolean hasExistingValue, JsonSerializer serializer)
at Newtonsoft.Json.JsonConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
at Newtonsoft.Json.Linq.JToken.ToObject[T](JsonSerializer jsonSerializer)
at OmniSharp.Extensions.JsonRpc.ResponseRouter.ResponseRouterReturnsImpl.Returning[TResponse](CancellationToken cancellationToken)
at OmniSharp.Extensions.LanguageServer.Protocol.Progress.ProgressManager.<>c__DisplayClass26_0`1.<<MakeRequest>b__0>d.MoveNext()
There is little documentation on the language client package from Omnisharp and I don't know why I'm getting this error.
I tried different methods of getting the diagnostics from the LSP like directly using client.SendRequest
but I couldn't get that to work.
Figured it out.
var report = Client.SendRequest("textDocument/diagnostic", new DocumentDiagnosticParams
{
TextDocument = document,
});
var item = await report.Returning<DiagnosticItem>(CancellationToken.None);
return item;