Skip to content

Commit

Permalink
LSP Protocol: Suppress obsoletion propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutch committed Jun 17, 2024
1 parent 1b41857 commit 85029e6
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/LanguageServer/Protocol/Protocol/DocumentSymbolParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ namespace Roslyn.LanguageServer.Protocol;
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#documentSymbolParams">Language Server Protocol specification</see> for additional information.
/// </para>
/// </summary>
internal class DocumentSymbolParams : ITextDocumentParams, IWorkDoneProgressParams, IPartialResultParams<SumType<SymbolInformation[], DocumentSymbol[]>>
internal class DocumentSymbolParams
: ITextDocumentParams, IWorkDoneProgressParams,
#pragma warning disable CS0618 // SymbolInformation is obsolete but this class is not
IPartialResultParams<SumType<SymbolInformation[], DocumentSymbol[]>>
#pragma warning restore CS0618
{
/// <summary>
/// Gets or sets the text document.
Expand All @@ -32,5 +36,7 @@ public TextDocumentIdentifier TextDocument
/// <inheritdoc/>
[JsonPropertyName(Methods.PartialResultTokenName)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
#pragma warning disable CS0618 // SymbolInformation is obsolete but this property is not
public IProgress<SumType<SymbolInformation[], DocumentSymbol[]>>? PartialResultToken { get; set; }
#pragma warning restore CS0618
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ private static void AddConverters(IList<JsonConverter> converters)
TryAddConverter<Diagnostic, VSDiagnostic>();
TryAddConverter<Location, VSLocation>();
TryAddConverter<ServerCapabilities, VSServerCapabilities>();
#pragma warning disable CS0618 // SymbolInformation is obsolete but we need the converter regardless
TryAddConverter<SymbolInformation, VSSymbolInformation>();
#pragma warning restore CS0618
TryAddConverter<TextDocumentIdentifier, VSTextDocumentIdentifier>();

void TryAddConverter<TBase, TExtension>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ namespace Roslyn.LanguageServer.Protocol
/// <summary>
/// <see cref="VSSymbolInformation"/> extends <see cref="SymbolInformation"/> providing additional properties used by Visual Studio.
/// </summary>
internal class VSSymbolInformation : SymbolInformation
internal class VSSymbolInformation
#pragma warning disable CS0618 // SymbolInformation is obsolete but this class is not (yet)
: SymbolInformation
#pragma warning restore
{
/// <summary>
/// Gets or sets the icon associated with the symbol. If specified, this icon is used instead of <see cref="SymbolKind" />.
Expand Down
2 changes: 2 additions & 0 deletions src/LanguageServer/Protocol/Protocol/Hover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ internal class Hover
/// </summary>
[JsonPropertyName("contents")]
[JsonRequired]
#pragma warning disable CS0618 // MarkedString is obsolete but this property is not
public SumType<string, MarkedString, SumType<string, MarkedString>[], MarkupContent> Contents { get; set; }
#pragma warning restore CS0618

/// <summary>
/// An optional range inside a text document that is used to visualize the applicable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ private static void AddConverters(IList<JsonConverter> converters)
AddOrReplaceConverter<Location, VSInternalLocation>();
AddOrReplaceConverter<VSProjectContext, VSInternalProjectContext>();
AddOrReplaceConverter<ServerCapabilities, VSInternalServerCapabilities>();
#pragma warning disable CS0618 // SymbolInformation is obsolete but we need the converter regardless
AddOrReplaceConverter<SymbolInformation, VSInternalSymbolInformation>();
#pragma warning restore CS0618
AddOrReplaceConverter<ReferenceParams, VSInternalReferenceParams>();
AddOrReplaceConverter<SignatureInformation, VSInternalSignatureInformation>();
AddOrReplaceConverter<TextDocumentClientCapabilities, VSInternalTextDocumentClientCapabilities>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ internal class VSInternalHover : Hover
/// </remarks>
[JsonPropertyName("contents")]
[JsonRequired]
#pragma warning disable CS0618 // MarkedString is obsolete but this property is not
public new SumType<SumType<string, MarkedString>, SumType<string, MarkedString>[], MarkupContent>? Contents { get; set; }
#pragma warning restore CS0618
}
}
2 changes: 2 additions & 0 deletions src/LanguageServer/Protocol/Protocol/Methods.Document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ partial class Methods
/// <summary>
/// Strongly typed message object for 'textDocument/documentSymbol'.
/// </summary>
#pragma warning disable CS0618 // SymbolInformation is obsolete but this property is not
public static readonly LspRequest<DocumentSymbolParams, SumType<SymbolInformation[], DocumentSymbol[]>?> TextDocumentDocumentSymbol = new(TextDocumentDocumentSymbolName);
#pragma warning restore CS0618

/// <summary>
/// Method name for 'textDocument/semanticTokens'.
Expand Down
2 changes: 2 additions & 0 deletions src/LanguageServer/Protocol/Protocol/Methods.Workspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ partial class Methods
/// <summary>
/// Strongly typed message object for 'workspace/symbol'.
/// </summary>
#pragma warning disable CS0618 // SymbolInformation is obsolete but this property is not
public static readonly LspRequest<WorkspaceSymbolParams, SumType<SymbolInformation[], WorkspaceSymbol[]>?> WorkspaceSymbol = new(WorkspaceSymbolName);
#pragma warning restore CS0618

/// <summary>
/// Method name for 'workspaceSymbol/resolve'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ namespace Roslyn.LanguageServer.Protocol
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspaceSymbolParams">Language Server Protocol specification</see> for additional information.
/// </para>
/// </summary>
internal class WorkspaceSymbolParams : IPartialResultParams<SumType<SymbolInformation[], WorkspaceSymbol[]>>, IWorkDoneProgressParams
internal class WorkspaceSymbolParams
#pragma warning disable CS0618 // SymbolInformation is obsolete but this class is not
: IPartialResultParams<SumType<SymbolInformation[], WorkspaceSymbol[]>>, IWorkDoneProgressParams
#pragma warning restore CS0618
{
/// <summary>
/// Gets or sets the query (a non-empty string).
Expand All @@ -25,7 +28,9 @@ internal class WorkspaceSymbolParams : IPartialResultParams<SumType<SymbolInform
/// <inheritdoc/>
[JsonPropertyName(Methods.PartialResultTokenName)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
#pragma warning disable CS0618 // SymbolInformation is obsolete but this property is not
public IProgress<SumType<SymbolInformation[], WorkspaceSymbol[]>>? PartialResultToken { get; set; }
#pragma warning restore CS0618

/// <inheritdoc/>
[JsonPropertyName(Methods.WorkDoneTokenName)]
Expand Down

0 comments on commit 85029e6

Please sign in to comment.