Skip to content

Commit

Permalink
LSP Protocol: Fix some serialization errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutch committed Aug 15, 2024
1 parent c52c154 commit 70ede42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,8 @@ public override void Write(Utf8JsonWriter writer, OptimizedVSCompletionList valu
JsonSerializer.Serialize(writer, completionList.CommitCharacters, options);
}

if (completionList.IsIncomplete)
{
writer.WriteBoolean("isIncomplete", completionList.IsIncomplete);
}
else
{
// Default is "false" so no need to serialize
}
// this is a required property per the LSP spec
writer.WriteBoolean("isIncomplete", completionList.IsIncomplete);

writer.WritePropertyName("items");
if (completionList.Items == null || completionList.Items.Length == 0)
Expand Down Expand Up @@ -153,11 +147,8 @@ private static void WriteCompletionItem(Utf8JsonWriter writer, CompletionItem co
}
}

var label = completionItem.Label;
if (label != null)
{
writer.WriteString("label", label);
}
// label is required per the LSP spec
writer.WriteString("label", completionItem.Label);

if (completionItem.LabelDetails != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ internal class UnchangedDocumentDiagnosticReport
/// Gets the kind of this report.
/// </summary>
[JsonPropertyName("kind")]
[JsonRequired]
#pragma warning disable CA1822 // Mark members as static
public string Kind => DocumentDiagnosticReportKind.Unchanged;
#pragma warning restore CA1822 // Mark members as static
Expand Down

0 comments on commit 70ede42

Please sign in to comment.