Skip to content

Commit

Permalink
LSP Protocol: Fix another couple serialization errors
Browse files Browse the repository at this point in the history
System.Text.Json doesn't respect DefaultValueAttribute
  • Loading branch information
mhutch committed Aug 18, 2024
1 parent 1b59c82 commit 1f80181
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal class DidChangeWatchedFilesRegistrationOptions : DynamicRegistrationSet
/// The watchers to register.
/// </summary>
/// <remarks>Since LSP 3.17</remarks>
[JsonPropertyName("relativePatternSupport")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonPropertyName("watchers")]
[JsonRequired]
public FileSystemWatcher[] Watchers { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ internal class FileSystemWatcher
/// which is <c>7</c>.
/// </summary>
[JsonPropertyName("kind")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[DefaultValue(WatchKind.Create | WatchKind.Change | WatchKind.Delete)]
public WatchKind Kind { get; init; } = WatchKind.Create | WatchKind.Change | WatchKind.Delete;
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public WatchKind? Kind { get; init; }
}

0 comments on commit 1f80181

Please sign in to comment.