From 1f801810fd56851a0454d6f709c7d9fcf2aeaf70 Mon Sep 17 00:00:00 2001 From: Mikayla Hutchinson Date: Sat, 17 Aug 2024 13:19:34 -0400 Subject: [PATCH] LSP Protocol: Fix another couple serialization errors System.Text.Json doesn't respect DefaultValueAttribute --- .../DidChangeWatchedFilesRegistrationOptions.cs | 4 ++-- .../Protocol/Protocol/FileOperations/FileSystemWatcher.cs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/LanguageServer/Protocol/Protocol/FileOperations/DidChangeWatchedFilesRegistrationOptions.cs b/src/LanguageServer/Protocol/Protocol/FileOperations/DidChangeWatchedFilesRegistrationOptions.cs index 381638544a752..6747cb4a7a0f4 100644 --- a/src/LanguageServer/Protocol/Protocol/FileOperations/DidChangeWatchedFilesRegistrationOptions.cs +++ b/src/LanguageServer/Protocol/Protocol/FileOperations/DidChangeWatchedFilesRegistrationOptions.cs @@ -18,7 +18,7 @@ internal class DidChangeWatchedFilesRegistrationOptions : DynamicRegistrationSet /// The watchers to register. /// /// Since LSP 3.17 - [JsonPropertyName("relativePatternSupport")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [JsonPropertyName("watchers")] + [JsonRequired] public FileSystemWatcher[] Watchers { get; init; } } diff --git a/src/LanguageServer/Protocol/Protocol/FileOperations/FileSystemWatcher.cs b/src/LanguageServer/Protocol/Protocol/FileOperations/FileSystemWatcher.cs index 7557bcc57097a..0fba2560eadfe 100644 --- a/src/LanguageServer/Protocol/Protocol/FileOperations/FileSystemWatcher.cs +++ b/src/LanguageServer/Protocol/Protocol/FileOperations/FileSystemWatcher.cs @@ -31,7 +31,6 @@ internal class FileSystemWatcher /// which is 7. /// [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; } }