diff --git a/eng/Versions.props b/eng/Versions.props
index bba99f1fb9478..6e814ebc0eb8c 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -29,7 +29,6 @@
6.0.0-rtm.21518.126.0.0-rtm.21518.1217.7.4-preview
- 17.8.9-preview17.8.3671117.3.2
@@ -169,9 +168,6 @@
15.8.27812-alpha$(VisualStudioEditorPackagesVersion)$(VisualStudioEditorPackagesVersion)
- $(MicrosoftVisualStudioLanguageServerProtocolPackagesVersion)
- $(MicrosoftVisualStudioLanguageServerProtocolPackagesVersion)
- $(MicrosoftVisualStudioLanguageServerProtocolPackagesVersion)$(MicrosoftVisualStudioLanguageServerClientPackagesVersion)$(MicrosoftVisualStudioLanguageServerClientPackagesVersion)$(VisualStudioEditorPackagesVersion)
diff --git a/src/EditorFeatures/Core/Classification/Syntactic/SyntacticClassificationTaggerProvider.TagComputer.cs b/src/EditorFeatures/Core/Classification/Syntactic/SyntacticClassificationTaggerProvider.TagComputer.cs
index 93af689fab9e5..096f0e2bfaecb 100644
--- a/src/EditorFeatures/Core/Classification/Syntactic/SyntacticClassificationTaggerProvider.TagComputer.cs
+++ b/src/EditorFeatures/Core/Classification/Syntactic/SyntacticClassificationTaggerProvider.TagComputer.cs
@@ -15,9 +15,9 @@
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Tagging;
+using Roslyn.LanguageServer.Protocol;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Classification;
diff --git a/src/EditorFeatures/Core/Extensions/LSPExtensions.cs b/src/EditorFeatures/Core/Extensions/LSPExtensions.cs
new file mode 100644
index 0000000000000..84e3e448d5b73
--- /dev/null
+++ b/src/EditorFeatures/Core/Extensions/LSPExtensions.cs
@@ -0,0 +1,36 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Linq;
+
+namespace Microsoft.CodeAnalysis.Extensions;
+
+internal static class VSEditorLSPExtensions
+{
+ public static Roslyn.Core.Imaging.ImageId ToLSPImageId(this VisualStudio.Core.Imaging.ImageId imageId)
+ => new(imageId.Guid, imageId.Id);
+
+ public static Roslyn.Text.Adornments.ImageElement ToLSPImageElement(this VisualStudio.Text.Adornments.ImageElement imageElement)
+ => new(imageElement.ImageId.ToLSPImageId(), imageElement.AutomationName);
+
+ public static Roslyn.Text.Adornments.ClassifiedTextRun ToLSPRun(this VisualStudio.Text.Adornments.ClassifiedTextRun run)
+ => new(run.ClassificationTypeName, run.Text, (Roslyn.Text.Adornments.ClassifiedTextRunStyle)run.Style, run.MarkerTagType, run.NavigationAction, run.Tooltip);
+
+ public static Roslyn.Text.Adornments.ClassifiedTextElement ToLSPElement(this VisualStudio.Text.Adornments.ClassifiedTextElement element)
+ => new(element.Runs.Select(r => r.ToLSPRun()));
+
+ public static Roslyn.Text.Adornments.ContainerElement ToLSPElement(this VisualStudio.Text.Adornments.ContainerElement element)
+ => new((Roslyn.Text.Adornments.ContainerElementStyle)element.Style, element.Elements.Select(ToLSPElement));
+
+ private static object? ToLSPElement(object? value)
+ => value switch
+ {
+ VisualStudio.Core.Imaging.ImageId imageId => ToLSPImageId(imageId),
+ VisualStudio.Text.Adornments.ImageElement element => ToLSPImageElement(element),
+ VisualStudio.Text.Adornments.ContainerElement element => ToLSPElement(element),
+ VisualStudio.Text.Adornments.ClassifiedTextElement element => ToLSPElement(element),
+ VisualStudio.Text.Adornments.ClassifiedTextRun run => ToLSPRun(run),
+ _ => value,
+ };
+}
diff --git a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstractVSTypeScriptRequestHandler.cs b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstractVSTypeScriptRequestHandler.cs
index f2df904d91bce..bb128f92430dd 100644
--- a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstractVSTypeScriptRequestHandler.cs
+++ b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstractVSTypeScriptRequestHandler.cs
@@ -8,7 +8,7 @@
using Microsoft.CodeAnalysis.LanguageServer;
using Microsoft.CodeAnalysis.LanguageServer.Handler;
using Microsoft.CommonLanguageServerProtocol.Framework;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api;
diff --git a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptCapabilitiesProvider.cs b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptCapabilitiesProvider.cs
index a563d7bb42ade..f3f046f811b1b 100644
--- a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptCapabilitiesProvider.cs
+++ b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptCapabilitiesProvider.cs
@@ -2,9 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api;
+
internal interface IVSTypeScriptCapabilitiesProvider
{
///
diff --git a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs
index 130dbfeb3afb7..912bb62d9e082 100644
--- a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs
+++ b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs
@@ -13,12 +13,11 @@
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServer;
using Microsoft.CodeAnalysis.Options;
-using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServer.Client;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.Utilities;
using Newtonsoft.Json;
+using Roslyn.LanguageServer.Protocol;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript
diff --git a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs
index b22dfda918ede..59deff7f61645 100644
--- a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs
+++ b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs
@@ -17,9 +17,9 @@
using Microsoft.CommonLanguageServerProtocol.Framework;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServer.Client;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
+using Roslyn.LanguageServer.Protocol;
using StreamJsonRpc;
namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient
diff --git a/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs
index 2c0d9a3415051..bea2259bffb48 100644
--- a/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs
+++ b/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs
@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
-using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.Composition;
@@ -15,11 +14,10 @@
using Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics;
using Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens;
using Microsoft.CodeAnalysis.Options;
-using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServer.Client;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.Utilities;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient
{
diff --git a/src/EditorFeatures/Core/LanguageServer/EditorHoverCreationService.cs b/src/EditorFeatures/Core/LanguageServer/EditorHoverCreationService.cs
index e25ad717f4bff..70029355e3faf 100644
--- a/src/EditorFeatures/Core/LanguageServer/EditorHoverCreationService.cs
+++ b/src/EditorFeatures/Core/LanguageServer/EditorHoverCreationService.cs
@@ -8,12 +8,13 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Classification;
using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo;
+using Microsoft.CodeAnalysis.Extensions;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServer.Handler;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.QuickInfo;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer
{
@@ -50,6 +51,7 @@ await document.GetLineFormattingOptionsAsync(_globalOptions, cancellationToken).
asynchronousOperationListener: null,
streamingPresenter: null);
+ var element = await IntellisenseQuickInfoBuilder.BuildContentWithoutNavigationActionsAsync(info, context, cancellationToken).ConfigureAwait(false);
return new VSInternalHover
{
Range = ProtocolConversions.TextSpanToRange(info.Span, text),
@@ -57,7 +59,7 @@ await document.GetLineFormattingOptionsAsync(_globalOptions, cancellationToken).
// Build the classified text without navigation actions - they are not serializable.
// TODO - Switch to markup content once it supports classifications.
// https://devdiv.visualstudio.com/DevDiv/_workitems/edit/918138
- RawContent = await IntellisenseQuickInfoBuilder.BuildContentWithoutNavigationActionsAsync(info, context, cancellationToken).ConfigureAwait(false)
+ RawContent = element.ToLSPElement(),
};
}
}
diff --git a/src/EditorFeatures/Core/LanguageServer/EditorLspCompletionResultCreationService.cs b/src/EditorFeatures/Core/LanguageServer/EditorLspCompletionResultCreationService.cs
index 24dcd042d685e..e79d0c7744cdb 100644
--- a/src/EditorFeatures/Core/LanguageServer/EditorLspCompletionResultCreationService.cs
+++ b/src/EditorFeatures/Core/LanguageServer/EditorLspCompletionResultCreationService.cs
@@ -9,13 +9,14 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
+using Microsoft.CodeAnalysis.Extensions;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServer.Handler.Completion;
using Microsoft.CodeAnalysis.LanguageService;
using Microsoft.CodeAnalysis.Text;
-using Microsoft.VisualStudio.Text.Adornments;
+using Roslyn.Text.Adornments;
using Roslyn.Utilities;
-using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
+using LSP = Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer
{
@@ -42,7 +43,7 @@ public EditorLspCompletionResultCreationService()
var lspItem = new LSP.VSInternalCompletionItem
{
Label = item.GetEntireDisplayText(),
- Icon = new ImageElement(item.Tags.GetFirstGlyph().GetImageId())
+ Icon = new ImageElement(item.Tags.GetFirstGlyph().GetImageId().ToLSPImageId()),
};
// Complex text edits (e.g. override and partial method completions) are always populated in the
diff --git a/src/EditorFeatures/Core/LanguageServer/EditorLspReferencesResultCreationService.cs b/src/EditorFeatures/Core/LanguageServer/EditorLspReferencesResultCreationService.cs
index cd39902d5abc6..4931a55761710 100644
--- a/src/EditorFeatures/Core/LanguageServer/EditorLspReferencesResultCreationService.cs
+++ b/src/EditorFeatures/Core/LanguageServer/EditorLspReferencesResultCreationService.cs
@@ -6,12 +6,13 @@
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
+using Microsoft.CodeAnalysis.Extensions;
using Microsoft.CodeAnalysis.FindSymbols.Finders;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServer.Handler;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
-using Microsoft.VisualStudio.Text.Adornments;
-using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
+using Roslyn.Text.Adornments;
+using LSP = Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer
{
@@ -24,7 +25,7 @@ public EditorLspReferencesResultCreationService()
{
}
- public SumType? CreateReference(
+ public SumType? CreateReference(
int definitionId,
int id,
ClassifiedTextElement text,
@@ -33,15 +34,16 @@ public EditorLspReferencesResultCreationService()
ClassifiedTextElement? definitionText,
Glyph definitionGlyph,
SymbolUsageInfo? symbolUsageInfo,
- VisualStudio.LanguageServer.Protocol.Location? location)
+ Roslyn.LanguageServer.Protocol.Location? location)
{
// TO-DO: The Origin property should be added once Rich-Nav is completed.
// https://github.com/dotnet/roslyn/issues/42847
+ var imageId = definitionGlyph.GetImageId();
var result = new VSInternalReferenceItem
{
DefinitionId = definitionId,
DefinitionText = definitionText, // Only definitions should have a non-null DefinitionText
- DefinitionIcon = new ImageElement(definitionGlyph.GetImageId()),
+ DefinitionIcon = new ImageElement(imageId.ToLSPImageId()),
DisplayPath = location?.Uri.LocalPath,
Id = id,
Kind = symbolUsageInfo.HasValue ? ProtocolConversions.SymbolUsageInfoToReferenceKinds(symbolUsageInfo.Value) : Array.Empty(),
diff --git a/src/EditorFeatures/Core/LanguageServer/EditorLspSymbolInformationCreationService.cs b/src/EditorFeatures/Core/LanguageServer/EditorLspSymbolInformationCreationService.cs
index de4a1a09930a1..2359a42ccc472 100644
--- a/src/EditorFeatures/Core/LanguageServer/EditorLspSymbolInformationCreationService.cs
+++ b/src/EditorFeatures/Core/LanguageServer/EditorLspSymbolInformationCreationService.cs
@@ -7,8 +7,8 @@
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServer.Handler;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
-using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
+using LSP = Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer
{
diff --git a/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs
index 6e309a3613eb9..646d1c44a31f5 100644
--- a/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs
+++ b/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs
@@ -9,13 +9,11 @@
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServer;
-using Microsoft.CodeAnalysis.LanguageServer.Handler;
using Microsoft.CodeAnalysis.Options;
-using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServer.Client;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.Utilities;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient
{
diff --git a/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs
index 48887156637c5..be106ea02839e 100644
--- a/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs
+++ b/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs
@@ -16,8 +16,8 @@
using Microsoft.CodeAnalysis.Options;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServer.Client;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.Utilities;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient
{
diff --git a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs
index 07bee136d13a3..73429d5d17291 100644
--- a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs
+++ b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs
@@ -7,7 +7,7 @@
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.LanguageServer;
using Microsoft.CodeAnalysis.Options;
-using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
+using LSP = Roslyn.LanguageServer.Protocol;
namespace Roslyn.Test.Utilities
{
diff --git a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs
index 23f5f5a45b2ec..b906254e7a545 100644
--- a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs
+++ b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs
@@ -17,6 +17,7 @@
using Microsoft.CodeAnalysis.Editor.Test;
using Microsoft.CodeAnalysis.Editor.UnitTests;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
+using Microsoft.CodeAnalysis.Extensions;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.LanguageServer;
using Microsoft.CodeAnalysis.LanguageServer.Handler;
@@ -37,7 +38,7 @@
using StreamJsonRpc;
using Xunit;
using Xunit.Abstractions;
-using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
+using LSP = Roslyn.LanguageServer.Protocol;
namespace Roslyn.Test.Utilities
{
@@ -102,7 +103,7 @@ public Task> MapSpansAsync(Document document, I
}
}
- protected class OrderLocations : Comparer
+ private protected class OrderLocations : Comparer
{
public override int Compare(LSP.Location x, LSP.Location y) => CompareLocations(x, y);
}
@@ -112,18 +113,17 @@ protected class OrderLocations : Comparer
private protected virtual TestAnalyzerReferenceByLanguage CreateTestAnalyzersReference()
=> new(DiagnosticExtensions.GetCompilerDiagnosticAnalyzersMap());
- protected static LSP.ClientCapabilities CapabilitiesWithVSExtensions => new LSP.VSInternalClientCapabilities { SupportsVisualStudioExtensions = true };
+ private protected static LSP.ClientCapabilities CapabilitiesWithVSExtensions => new LSP.VSInternalClientCapabilities { SupportsVisualStudioExtensions = true };
- protected static LSP.ClientCapabilities GetCapabilities(bool isVS)
+ private protected static LSP.ClientCapabilities GetCapabilities(bool isVS)
=> isVS ? CapabilitiesWithVSExtensions : new LSP.ClientCapabilities();
///
/// Asserts two objects are equivalent by converting to JSON and ignoring whitespace.
///
- /// the JSON object type.
/// the expected object to be converted to JSON.
/// the actual object to be converted to JSON.
- public static void AssertJsonEquals(T expected, T actual)
+ public static void AssertJsonEquals(T1 expected, T2 actual)
{
var expectedStr = JsonConvert.SerializeObject(expected);
var actualStr = JsonConvert.SerializeObject(actual);
@@ -141,7 +141,7 @@ protected static void AssertEqualIgnoringWhitespace(string expected, string actu
/// Assert that two location lists are equivalent.
/// Locations are not always returned in a consistent order so they must be sorted.
///
- protected static void AssertLocationsEqual(IEnumerable expectedLocations, IEnumerable actualLocations)
+ private protected static void AssertLocationsEqual(IEnumerable expectedLocations, IEnumerable actualLocations)
{
var orderedActualLocations = actualLocations.OrderBy(CompareLocations);
var orderedExpectedLocations = expectedLocations.OrderBy(CompareLocations);
@@ -149,21 +149,21 @@ protected static void AssertLocationsEqual(IEnumerable expectedLoc
AssertJsonEquals(orderedExpectedLocations, orderedActualLocations);
}
- protected static int CompareLocations(LSP.Location l1, LSP.Location l2)
+ private protected static int CompareLocations(LSP.Location l1, LSP.Location l2)
{
var compareDocument = l1.Uri.AbsoluteUri.CompareTo(l2.Uri.AbsoluteUri);
var compareRange = CompareRange(l1.Range, l2.Range);
return compareDocument != 0 ? compareDocument : compareRange;
}
- protected static int CompareRange(LSP.Range r1, LSP.Range r2)
+ private protected static int CompareRange(LSP.Range r1, LSP.Range r2)
{
var compareLine = r1.Start.Line.CompareTo(r2.Start.Line);
var compareChar = r1.Start.Character.CompareTo(r2.Start.Character);
return compareLine != 0 ? compareLine : compareChar;
}
- protected static string ApplyTextEdits(LSP.TextEdit[] edits, SourceText originalMarkup)
+ private protected static string ApplyTextEdits(LSP.TextEdit[] edits, SourceText originalMarkup)
{
var text = originalMarkup;
foreach (var edit in edits)
@@ -196,7 +196,7 @@ internal static LSP.SymbolInformation CreateSymbolInformation(LSP.SymbolKind kin
return info;
}
- protected static LSP.TextDocumentIdentifier CreateTextDocumentIdentifier(Uri uri, ProjectId? projectContext = null)
+ private protected static LSP.TextDocumentIdentifier CreateTextDocumentIdentifier(Uri uri, ProjectId? projectContext = null)
{
var documentIdentifier = new LSP.VSTextDocumentIdentifier { Uri = uri };
@@ -209,21 +209,21 @@ protected static LSP.TextDocumentIdentifier CreateTextDocumentIdentifier(Uri uri
return documentIdentifier;
}
- protected static LSP.TextDocumentPositionParams CreateTextDocumentPositionParams(LSP.Location caret, ProjectId? projectContext = null)
+ private protected static LSP.TextDocumentPositionParams CreateTextDocumentPositionParams(LSP.Location caret, ProjectId? projectContext = null)
=> new LSP.TextDocumentPositionParams()
{
TextDocument = CreateTextDocumentIdentifier(caret.Uri, projectContext),
Position = caret.Range.Start
};
- protected static LSP.MarkupContent CreateMarkupContent(LSP.MarkupKind kind, string value)
+ private protected static LSP.MarkupContent CreateMarkupContent(LSP.MarkupKind kind, string value)
=> new LSP.MarkupContent()
{
Kind = kind,
Value = value
};
- protected static LSP.CompletionParams CreateCompletionParams(
+ private protected static LSP.CompletionParams CreateCompletionParams(
LSP.Location caret,
LSP.VSInternalCompletionInvokeKind invokeKind,
string triggerCharacter,
@@ -240,7 +240,7 @@ protected static LSP.CompletionParams CreateCompletionParams(
}
};
- protected static async Task CreateCompletionItemAsync(
+ private protected static async Task CreateCompletionItemAsync(
string label,
LSP.CompletionItemKind kind,
string[] tags,
@@ -280,7 +280,7 @@ protected static LSP.CompletionParams CreateCompletionParams(
};
if (tags != null)
- item.Icon = tags.ToImmutableArray().GetFirstGlyph().GetImageElement();
+ item.Icon = tags.ToImmutableArray().GetFirstGlyph().GetImageElement().ToLSPImageElement();
if (commitCharacters != null)
item.CommitCharacters = commitCharacters.Value.Select(c => c.ToString()).ToArray();
@@ -288,7 +288,7 @@ protected static LSP.CompletionParams CreateCompletionParams(
return item;
}
- protected static LSP.TextEdit GenerateTextEdit(string newText, int startLine, int startChar, int endLine, int endChar)
+ private protected static LSP.TextEdit GenerateTextEdit(string newText, int startLine, int startChar, int endLine, int endChar)
=> new LSP.TextEdit
{
NewText = newText,
@@ -441,7 +441,7 @@ protected static void AddMappedDocument(Workspace workspace, string markup)
workspace.TryApplyChanges(newSolution);
}
- public static async Task>> GetAnnotatedLocationsAsync(TestWorkspace workspace, Solution solution)
+ internal static async Task>> GetAnnotatedLocationsAsync(TestWorkspace workspace, Solution solution)
{
var locations = new Dictionary>();
foreach (var testDocument in workspace.Documents)
@@ -475,7 +475,7 @@ static LSP.Location ConvertTextSpanWithTextToLocation(TextSpan span, SourceText
}
}
- protected static LSP.Location GetLocationPlusOne(LSP.Location originalLocation)
+ private protected static LSP.Location GetLocationPlusOne(LSP.Location originalLocation)
{
var newPosition = new LSP.Position { Character = originalLocation.Range.Start.Character + 1, Line = originalLocation.Range.Start.Line };
return new LSP.Location
diff --git a/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj b/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj
index 478f9de53cc99..95e0b2c87eaef 100644
--- a/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj
+++ b/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj
@@ -93,6 +93,7 @@
+
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/LspFileChangeWatcherTests.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/LspFileChangeWatcherTests.cs
index 56b21809f6b2b..c7b1b6b940865 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/LspFileChangeWatcherTests.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/LspFileChangeWatcherTests.cs
@@ -6,12 +6,12 @@
using Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.FileWatching;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.CodeAnalysis.Test.Utilities;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using StreamJsonRpc;
using Xunit.Abstractions;
-using FileSystemWatcher = Microsoft.VisualStudio.LanguageServer.Protocol.FileSystemWatcher;
+using FileSystemWatcher = Roslyn.LanguageServer.Protocol.FileSystemWatcher;
namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests;
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/ServerInitializationTests.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/ServerInitializationTests.cs
index 68de69c6802ca..e0b3bc0a79f96 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/ServerInitializationTests.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/ServerInitializationTests.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
using Xunit.Abstractions;
namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests;
@@ -37,7 +37,7 @@ public async Task TestServerHandlesTextSyncRequestsAsync()
[
new TextDocumentContentChangeEvent
{
- Range = new VisualStudio.LanguageServer.Protocol.Range { Start = new Position(0, 0), End = new Position(0, 0) },
+ Range = new Roslyn.LanguageServer.Protocol.Range { Start = new Position(0, 0), End = new Position(0, 0) },
Text = "Console."
}
]
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerHostTests.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerHostTests.cs
index 0d0e52c99dc8e..628c98933de55 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerHostTests.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerHostTests.cs
@@ -5,9 +5,8 @@
using Microsoft.CodeAnalysis.LanguageServer.LanguageServer;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.Composition;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
using Nerdbank.Streams;
-using Roslyn.Utilities;
+using Roslyn.LanguageServer.Protocol;
using StreamJsonRpc;
using Xunit.Abstractions;
@@ -32,7 +31,7 @@ protected sealed class TestLspServer : IAsyncDisposable
private readonly Task _languageServerHostCompletionTask;
private readonly JsonRpc _clientRpc;
- public static async Task CreateAsync(ClientCapabilities clientCapabilities, TestOutputLogger logger, bool includeDevKitComponents = true)
+ internal static async Task CreateAsync(ClientCapabilities clientCapabilities, TestOutputLogger logger, bool includeDevKitComponents = true)
{
var exportProvider = await LanguageServerTestComposition.CreateExportProviderAsync(logger.Factory, includeDevKitComponents);
var testLspServer = new TestLspServer(exportProvider, logger);
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerConnectHandler.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerConnectHandler.cs
index ea8dc39c00e83..8c6d5c693539c 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerConnectHandler.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerConnectHandler.cs
@@ -2,17 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
-using System.Collections.Generic;
using System.Composition;
-using System.Linq;
using System.Runtime.Serialization;
-using System.Text;
-using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServer.Handler;
using Microsoft.CommonLanguageServerProtocol.Framework;
-using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
namespace Microsoft.CodeAnalysis.LanguageServer.BrokeredServices;
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspContractTypes.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspContractTypes.cs
index 7635ee9c55452..89a3613e08fe5 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspContractTypes.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspContractTypes.cs
@@ -5,7 +5,7 @@
using System.Runtime.Serialization;
using Newtonsoft.Json;
-namespace Microsoft.VisualStudio.LanguageServer.Protocol;
+namespace Roslyn.LanguageServer.Protocol;
[DataContract]
internal class DidChangeWatchedFilesRegistrationOptions
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspDidChangeWatchedFilesHandler.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspDidChangeWatchedFilesHandler.cs
index 04faf2d4433a3..da93cef394d36 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspDidChangeWatchedFilesHandler.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspDidChangeWatchedFilesHandler.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
@@ -6,7 +6,7 @@
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServer.Handler;
using Microsoft.CommonLanguageServerProtocol.Framework;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.FileWatching;
@@ -30,4 +30,4 @@ Task INotificationHandler.HandleNot
}
public event EventHandler? NotificationRaised;
-}
\ No newline at end of file
+}
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs
index 33e4e58dad4b5..a6e3d506bf119 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs
@@ -2,15 +2,15 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Collections.Immutable;
+using Microsoft.CodeAnalysis.LanguageServer.Handler;
using Microsoft.CodeAnalysis.LanguageServer.LanguageServer;
using Microsoft.CodeAnalysis.ProjectSystem;
using Microsoft.CodeAnalysis.Shared.TestHooks;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
-using System.Collections.Immutable;
+using Roslyn.LanguageServer.Protocol;
using Roslyn.Utilities;
-using FileSystemWatcher = Microsoft.VisualStudio.LanguageServer.Protocol.FileSystemWatcher;
-using Microsoft.CodeAnalysis.LanguageServer.Handler;
using StreamJsonRpc;
+using FileSystemWatcher = Roslyn.LanguageServer.Protocol.FileSystemWatcher;
namespace Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.FileWatching;
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs
index 488ef5e0b26fa..920570ab596fc 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs
@@ -14,7 +14,6 @@
using Microsoft.CodeAnalysis.MSBuild;
using Microsoft.CodeAnalysis.MSBuild.Logging;
using Microsoft.CodeAnalysis.Options;
-using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.ProjectSystem;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.CodeAnalysis.Workspaces.ProjectSystem;
@@ -22,7 +21,7 @@
using Microsoft.VisualStudio.Composition;
using Roslyn.Utilities;
using static Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager;
-using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
+using LSP = Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.HostWorkspace;
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerWorkspace.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerWorkspace.cs
index 9a1526d3d49fe..4d4268f4a1db0 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerWorkspace.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerWorkspace.cs
@@ -2,11 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Workspaces.ProjectSystem;
-using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
+using LSP = Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.HostWorkspace;
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/DebugConfiguration/WorkspaceDebugConfigurationParams.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/DebugConfiguration/WorkspaceDebugConfigurationParams.cs
index a286f9bdf9f4a..1d3b795be6ba1 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/DebugConfiguration/WorkspaceDebugConfigurationParams.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/DebugConfiguration/WorkspaceDebugConfigurationParams.cs
@@ -2,10 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
using System.Runtime.Serialization;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
using Newtonsoft.Json;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.DebugConfiguration;
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/Restore/RestoreParams.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/Restore/RestoreParams.cs
index 8be4c80ef0e46..44bf12762fc65 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/Restore/RestoreParams.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/Restore/RestoreParams.cs
@@ -3,8 +3,8 @@
// See the LICENSE file in the project root for more information.
using System.Runtime.Serialization;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
using Newtonsoft.Json;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.Handler;
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/ServerCapabilitiesProvider.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/ServerCapabilitiesProvider.cs
index 1b8b495b941ef..cc21693eb3c6e 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/ServerCapabilitiesProvider.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/ServerCapabilitiesProvider.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.LanguageServer;
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs
index 24437f41ce921..dbacfd7867b96 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs
@@ -2,11 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System.Composition;
using Microsoft.CodeAnalysis.LanguageServer.LanguageServer;
using Microsoft.Extensions.Logging;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
-using StreamJsonRpc;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.Logging;
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/ShowToastNotification.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/ShowToastNotification.cs
index 9690e247e0a8a..b9b7ea2f7a8b8 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/ShowToastNotification.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/ShowToastNotification.cs
@@ -5,7 +5,7 @@
using System.Runtime.Serialization;
using Microsoft.CodeAnalysis.LanguageServer.LanguageServer;
using Roslyn.Utilities;
-using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
+using LSP = Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer;
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj
index ee87a9ae047e7..57331ae211af7 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj
@@ -79,7 +79,6 @@
-
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/RunTestsHandler.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/RunTestsHandler.cs
index ea6be6641855b..59314c35dee47 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/RunTestsHandler.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/RunTestsHandler.cs
@@ -10,7 +10,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.TestPlatform.VsTestConsole.TranslationLayer;
using Roslyn.Utilities;
-using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
+using LSP = Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.Testing;
diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/TestDiscoverer.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/TestDiscoverer.cs
index 3aea99770153b..62bfe8514d51c 100644
--- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/TestDiscoverer.cs
+++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/TestDiscoverer.cs
@@ -14,7 +14,7 @@
using Microsoft.TestPlatform.VsTestConsole.TranslationLayer;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Roslyn.Utilities;
-using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
+using LSP = Roslyn.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.Testing;
diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/CapabilitiesManager.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/CapabilitiesManager.cs
index 9fa2db348e9bb..a13a2965ecfda 100644
--- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/CapabilitiesManager.cs
+++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/CapabilitiesManager.cs
@@ -3,7 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CommonLanguageServerProtocol.Framework.Example;
diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/ExampleLanguageServer.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/ExampleLanguageServer.cs
index 6b52478246d36..5c2fc79a0c3b4 100644
--- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/ExampleLanguageServer.cs
+++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/ExampleLanguageServer.cs
@@ -5,7 +5,7 @@
using System;
using Microsoft.CommonLanguageServerProtocol.Framework.Handlers;
using Microsoft.Extensions.DependencyInjection;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
using StreamJsonRpc;
namespace Microsoft.CommonLanguageServerProtocol.Framework.Example;
diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/Microsoft.CommonLanguageServerProtocol.Framework.Example.csproj b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/Microsoft.CommonLanguageServerProtocol.Framework.Example.csproj
index 611886a1afede..b4507a11df45b 100644
--- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/Microsoft.CommonLanguageServerProtocol.Framework.Example.csproj
+++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/Microsoft.CommonLanguageServerProtocol.Framework.Example.csproj
@@ -11,10 +11,10 @@
-
+
diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/MultiRegisteringHandler.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/MultiRegisteringHandler.cs
index 3cfcaf701705d..52e7823adde8e 100644
--- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/MultiRegisteringHandler.cs
+++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/MultiRegisteringHandler.cs
@@ -4,7 +4,7 @@
using System.Threading;
using System.Threading.Tasks;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
namespace Microsoft.CommonLanguageServerProtocol.Framework.Example;
@@ -16,19 +16,19 @@ public class MultiRegisteringHandler :
public bool MutatesSolutionState => throw new System.NotImplementedException();
[LanguageServerEndpoint(Methods.TextDocumentDidCloseName)]
- public Task HandleNotificationAsync(DidCloseTextDocumentParams request, ExampleRequestContext requestContext, CancellationToken cancellationToken)
+ Task INotificationHandler.HandleNotificationAsync(DidCloseTextDocumentParams request, ExampleRequestContext requestContext, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}
[LanguageServerEndpoint(Methods.TextDocumentDidOpenName)]
- public Task HandleRequestAsync(DidOpenTextDocumentParams request, ExampleRequestContext context, CancellationToken cancellationToken)
+ Task IRequestHandler.HandleRequestAsync(DidOpenTextDocumentParams request, ExampleRequestContext context, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}
[LanguageServerEndpoint(Methods.TextDocumentDidChangeName)]
- public Task HandleRequestAsync(DidChangeTextDocumentParams request, ExampleRequestContext context, CancellationToken cancellationToken)
+ Task IRequestHandler.HandleRequestAsync(DidChangeTextDocumentParams request, ExampleRequestContext context, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}
diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/ExampleTests.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/ExampleTests.cs
index 9fc80b18c4c62..844c1de5cd591 100644
--- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/ExampleTests.cs
+++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/ExampleTests.cs
@@ -4,7 +4,7 @@
using System;
using System.Threading.Tasks;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Roslyn.LanguageServer.Protocol;
using Xunit;
namespace Microsoft.CommonLanguageServerProtocol.Framework.UnitTests;
diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/TestExampleLanguageServer.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/TestExampleLanguageServer.cs
index 00812d946b36f..a5ac7d0ca75ac 100644
--- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/TestExampleLanguageServer.cs
+++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/TestExampleLanguageServer.cs
@@ -7,11 +7,10 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CommonLanguageServerProtocol.Framework.Example;
-using Microsoft.CommonLanguageServerProtocol.Framework;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
+using Microsoft.Extensions.DependencyInjection;
using Nerdbank.Streams;
+using Roslyn.LanguageServer.Protocol;
using StreamJsonRpc;
-using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.CommonLanguageServerProtocol.Framework.UnitTests;
@@ -166,7 +165,7 @@ public class ExtraDidOpenHandler :
{
public bool MutatesSolutionState => throw new System.NotImplementedException();
- public Task HandleRequestAsync(DidOpenTextDocumentParams request, ExampleRequestContext context, CancellationToken cancellationToken)
+ Task IRequestHandler.HandleRequestAsync(DidOpenTextDocumentParams request, ExampleRequestContext context, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}
diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/HandlerProvider.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/HandlerProvider.cs
index 9d79e5d74451c..5f3a335083a4f 100644
--- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/HandlerProvider.cs
+++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/HandlerProvider.cs
@@ -134,20 +134,50 @@ static string GetRequestHandlerMethod(Type handlerType, Type? requestType, Type
static LanguageServerEndpointAttribute? GetMethodAttributeFromHandlerMethod(Type handlerType, Type? requestType, Type contextType, Type? responseType)
{
- var methodInfo = (requestType != null, responseType != null) switch
+ const string handleRequestName = nameof(IRequestHandler
+
+
+
@@ -83,17 +86,18 @@
-
+
+ LanguageServerProtocolResources.resxTrueTrue
- LanguageServerResources.resx
-
+
+ Designer
+ LanguageServerProtocolResources.Designer.csResXFileCodeGenerator
- LanguageServerResources.Designer.cs
diff --git a/src/Features/LanguageServer/Protocol/Protocol/.editorconfig b/src/Features/LanguageServer/Protocol/Protocol/.editorconfig
new file mode 100644
index 0000000000000..f5785864979ea
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/.editorconfig
@@ -0,0 +1,22 @@
+[*.cs]
+
+# CS0436: Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
+dotnet_diagnostic.CS0436.severity = none
+
+# CS8618: Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
+dotnet_diagnostic.CS8618.severity = none
+
+# CS8765: Nullability of type of parameter 'other' doesn't match overridden member (possibly because of nullability attributes).
+dotnet_diagnostic.CS8765.severity = none
+
+# CS8767: Nullability of reference types in type of parameter 'other' of 'bool CodeDescription.Equals(CodeDescription other)' doesn't match implicitly implemented member 'bool IEquatable.Equals(CodeDescription? other)' (possibly because of nullability attributes).
+dotnet_diagnostic.CS8767.severity = none
+
+# CS8603: Possible null reference return.
+dotnet_diagnostic.CS8603.severity = none
+
+# CS8604: Possible null reference argument for parameter 'uriString' in 'Uri.Uri(string uriString)'.
+dotnet_diagnostic.CS8604.severity = none
+
+# RS0030: The symbol 'Uri.Uri(string)' is banned in this project
+dotnet_diagnostic.RS0030.severity = none
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ApplyWorkspaceEditParams.cs b/src/Features/LanguageServer/Protocol/Protocol/ApplyWorkspaceEditParams.cs
new file mode 100644
index 0000000000000..7e4930168f914
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ApplyWorkspaceEditParams.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the parameters sent from a server to a client for the workspace/applyEdit request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class ApplyWorkspaceEditParams
+ {
+ ///
+ /// Gets or sets the label associated with this edit.
+ ///
+ [DataMember(Name = "label")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Label
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the edit to be applied to the workspace.
+ ///
+ [DataMember(Name = "edit")]
+ public WorkspaceEdit Edit
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ApplyWorkspaceEditResponse.cs b/src/Features/LanguageServer/Protocol/Protocol/ApplyWorkspaceEditResponse.cs
new file mode 100644
index 0000000000000..080ce8850873f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ApplyWorkspaceEditResponse.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the response sent for a workspace/applyEdit request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class ApplyWorkspaceEditResponse
+ {
+ ///
+ /// Gets or sets a value indicating whether edits were applied or not.
+ ///
+ [DataMember(Name = "applied")]
+ public bool Applied
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a string with textual description for why the edit was not applied.
+ ///
+ [DataMember(Name = "failureReason")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? FailureReason
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ClientCapabilities.cs b/src/Features/LanguageServer/Protocol/Protocol/ClientCapabilities.cs
new file mode 100644
index 0000000000000..aa135aefed881
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ClientCapabilities.cs
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents client capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class ClientCapabilities
+ {
+ ///
+ /// Gets or sets the workspace capabilities.
+ ///
+ [DataMember(Name = "workspace")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public WorkspaceClientCapabilities? Workspace
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the text document capabilities.
+ ///
+ [DataMember(Name = "textDocument")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public TextDocumentClientCapabilities? TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the experimental capabilities.
+ ///
+ [DataMember(Name = "experimental")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? Experimental
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeAction.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeAction.cs
new file mode 100644
index 0000000000000..86df1605432f0
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeAction.cs
@@ -0,0 +1,85 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// A class representing a change that can be performed in code. A CodeAction must either set
+ /// or . If both are supplied,
+ /// the edit will be applied first, then the command will be executed.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeAction
+ {
+ ///
+ /// Gets or sets the human readable title for this code action.
+ ///
+ [DataMember(Name = "title")]
+ public string Title
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the kind of code action this instance represents.
+ ///
+ [DataMember(Name = "kind")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CodeActionKind? Kind
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the diagnostics that this code action resolves.
+ ///
+ [DataMember(Name = "diagnostics")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Diagnostic[]? Diagnostics
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the workspace edit that this code action performs.
+ ///
+ [DataMember(Name = "edit")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public WorkspaceEdit? Edit
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the command that this code action executes.
+ ///
+ [DataMember(Name = "command")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Command? Command
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the data that will be resend to the server if the code action is selected to be resolved.
+ ///
+ [DataMember(Name = "data")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? Data
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeActionContext.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeActionContext.cs
new file mode 100644
index 0000000000000..2ccf570a49f2d
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeActionContext.cs
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing diagnostic information about the context of a code action
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeActionContext
+ {
+ ///
+ /// Gets or sets an array of diagnostics relevant to a code action.
+ ///
+ [DataMember(Name = "diagnostics")]
+ public Diagnostic[] Diagnostics
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets an array of code action kinds to filter for.
+ ///
+ [DataMember(Name = "only")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CodeActionKind[]? Only
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the indicating how the code action was triggered..
+ ///
+ [DataMember(Name = "triggerKind")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CodeActionTriggerKind? TriggerKind
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeActionKind.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeActionKind.cs
new file mode 100644
index 0000000000000..264756a446c2c
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeActionKind.cs
@@ -0,0 +1,74 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.ComponentModel;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Value representing the kind of a code action.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ [JsonConverter(typeof(StringEnumConverter))]
+ [TypeConverter(typeof(StringEnumConverter.TypeConverter))]
+ internal readonly record struct CodeActionKind(string Value) : IStringEnum
+ {
+ ///
+ /// Empty kind.
+ ///
+ public static readonly CodeActionKind Empty = new(string.Empty);
+
+ ///
+ /// Code action is a refactor.
+ ///
+ public static readonly CodeActionKind QuickFix = new("quickfix");
+
+ ///
+ /// Base kind for refactoring actions.
+ ///
+ public static readonly CodeActionKind Refactor = new("refactor");
+
+ ///
+ /// Base kind for refactoring extraction actions, like extracting methods, functions,
+ /// variables, etc.
+ ///
+ public static readonly CodeActionKind RefactorExtract = new("refactor.extract");
+
+ ///
+ /// Base kind for refactoring inline actions, like inlining functions, variables,
+ /// constants, etc.
+ ///
+ public static readonly CodeActionKind RefactorInline = new("refactor.inline");
+
+ ///
+ /// Base kind for refactoring rewrite actions, like adding or removing a parameter,
+ /// making a method static, etc.
+ ///
+ public static readonly CodeActionKind RefactorRewrite = new("refactor.rewrite");
+
+ ///
+ /// Base kind for source actions, which apply to the entire file.
+ ///
+ public static readonly CodeActionKind Source = new("source");
+
+ ///
+ /// Base kind for an organize imports source action.
+ ///
+ public static readonly CodeActionKind SourceOrganizeImports = new("source.organizeImports");
+
+ ///
+ /// Base kind for a fix all source action, which automatically fixes errors that have a clear
+ /// fix that do not require user input.
+ ///
+ ///
+ /// They should not suppress errors or perform unsafe fixes such as generating new
+ /// types or classes.
+ ///
+ public static readonly CodeActionKind SourceFixAll = new("source.fixAll");
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeActionKindSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeActionKindSetting.cs
new file mode 100644
index 0000000000000..1ec354679a037
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeActionKindSetting.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class containing the set of code action kinds that are supported.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeActionKindSetting
+ {
+ ///
+ /// Gets or sets the code actions kinds the client supports.
+ ///
+ [DataMember(Name = "valueSet")]
+ public CodeActionKind[] ValueSet
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeActionLiteralSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeActionLiteralSetting.cs
new file mode 100644
index 0000000000000..92e1cc4a4f9b7
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeActionLiteralSetting.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing support for code action literals.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeActionLiteralSetting
+ {
+ ///
+ /// Gets or sets a value indicating what code action kinds are supported.
+ ///
+ [DataMember(Name = "codeActionKind")]
+ public CodeActionKindSetting CodeActionKind
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeActionOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeActionOptions.cs
new file mode 100644
index 0000000000000..698727c5466cc
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeActionOptions.cs
@@ -0,0 +1,56 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the registration options for code actions support.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeActionOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets the kinds of code action that this server may return.
+ ///
+ ///
+ /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
+ /// may list out every specific kind they provide.
+ ///
+ [DataMember(Name = "codeActionKinds")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CodeActionKind[]? CodeActionKinds
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server provides support to resolve
+ /// additional information for a code action.
+ ///
+ [DataMember(Name = "resolveProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool ResolveProvider
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeActionParams.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeActionParams.cs
new file mode 100644
index 0000000000000..67f546f31ba48
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeActionParams.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the parameters sent from the client to the server for the textDocument/codeAction request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeActionParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the document identifier indicating where the command was invoked.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the range in the document for which the command was invoked.
+ ///
+ [DataMember(Name = "range")]
+ public Range Range
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the additional diagnostic information about the code action context.
+ ///
+ [DataMember(Name = "context")]
+ public CodeActionContext Context
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeActionResolveSupportSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeActionResolveSupportSetting.cs
new file mode 100644
index 0000000000000..6649a9adf92c9
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeActionResolveSupportSetting.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing settings for codeAction/resolve support.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeActionResolveSupportSetting
+ {
+ ///
+ /// Gets or sets a value indicating the properties that a client can resolve lazily.
+ ///
+ [DataMember(Name = "properties")]
+ public string[] Properties
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeActionSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeActionSetting.cs
new file mode 100644
index 0000000000000..4af0f9f18dd66
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeActionSetting.cs
@@ -0,0 +1,55 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing settings for code action support.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeActionSetting : DynamicRegistrationSetting
+ {
+ ///
+ /// Gets or sets a value indicating the client supports code action literals.
+ ///
+ [DataMember(Name = "codeActionLiteralSupport")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CodeActionLiteralSetting? CodeActionLiteralSupport
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the client supports resolving
+ /// additional code action properties via a separate `codeAction/resolve`
+ /// request.
+ ///
+ [DataMember(Name = "resolveSupport")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CodeActionResolveSupportSetting? ResolveSupport
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether code action supports the `data`
+ /// property which is preserved between a `textDocument/codeAction` and a
+ /// `codeAction/resolve` request.
+ ///
+ [DataMember(Name = "dataSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool DataSupport
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeActionTriggerKind.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeActionTriggerKind.cs
new file mode 100644
index 0000000000000..14413d38f3ead
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeActionTriggerKind.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Enum which represents the various reason why code actions were requested.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal enum CodeActionTriggerKind
+ {
+ ///
+ /// Code actions were explicitly requested by the user or by an extension.
+ ///
+ Invoked = 1,
+
+ ///
+ /// Code actions were requested automatically.
+ /// This typically happens when current selection in a file changes, but can also be triggered when file content changes.
+ ///
+ Automatic = 2,
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeDescription.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeDescription.cs
new file mode 100644
index 0000000000000..b91705db37fb0
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeDescription.cs
@@ -0,0 +1,76 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a description for an error code.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeDescription : IEquatable
+ {
+ ///
+ /// Gets or sets URI to open with more information about the diagnostic error.
+ ///
+ [DataMember(Name = "href")]
+ [JsonConverter(typeof(DocumentUriConverter))]
+ public Uri Href
+ {
+ get;
+ set;
+ }
+
+ public static bool operator ==(CodeDescription? value1, CodeDescription? value2)
+ {
+ if (ReferenceEquals(value1, value2))
+ {
+ return true;
+ }
+
+ if (ReferenceEquals(null, value2))
+ {
+ return false;
+ }
+
+ return value1?.Equals(value2) ?? false;
+ }
+
+ public static bool operator !=(CodeDescription? value1, CodeDescription? value2)
+ {
+ return !(value1 == value2);
+ }
+
+ ///
+ public bool Equals(CodeDescription other)
+ {
+ return other is not null
+ && this.Href == other.Href;
+ }
+
+ ///
+ public override bool Equals(object obj)
+ {
+ if (obj is CodeDescription other)
+ {
+ return this.Equals(other);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ return this.Href == null ? 53 : this.Href.GetHashCode();
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeLens.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeLens.cs
new file mode 100644
index 0000000000000..c88d783e26953
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeLens.cs
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// A class representing a code lens command that should be shown alongside source code.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeLens
+ {
+ ///
+ /// Gets or sets the range that the code lens applies to.
+ ///
+ [DataMember(Name = "range")]
+ public Range Range
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the command associated with this code lens.
+ ///
+ [DataMember(Name = "command")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Command? Command
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the data that should be preserved between a textDocument/codeLens request and a codeLens/resolve request.
+ ///
+ [DataMember(Name = "data")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? Data
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeLensOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeLensOptions.cs
new file mode 100644
index 0000000000000..23cd60deaf41b
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeLensOptions.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the options for code lens support.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeLensOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether or not the code lens support has a resolve provider.
+ ///
+ [DataMember(Name = "resolveProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool ResolveProvider
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeLensParams.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeLensParams.cs
new file mode 100644
index 0000000000000..d58fea7b19dec
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeLensParams.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the parameters sent from the client to the server for a textDocument/codeLens request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeLensParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the document identifier to fetch code lens results for.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CodeLensWorkspaceSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/CodeLensWorkspaceSetting.cs
new file mode 100644
index 0000000000000..76543e6b1a334
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CodeLensWorkspaceSetting.cs
@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Newtonsoft.Json;
+using System.Runtime.Serialization;
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Class representing the workspace code lens client capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CodeLensWorkspaceSetting
+ {
+ ///
+ /// Gets or sets a value indicating whether the client supports a refresh request sent from the server to the client.
+ ///
+ [DataMember(Name = "refreshSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool RefreshSupport { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Color.cs b/src/Features/LanguageServer/Protocol/Protocol/Color.cs
new file mode 100644
index 0000000000000..bda5111332f02
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Color.cs
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents a color.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class Color
+ {
+ ///
+ /// Gets or sets the Red value.
+ ///
+ ///
+ /// Value should be clamped to [0,1].
+ ///
+ [DataMember(Name = "red")]
+ public decimal Red { get; set; }
+
+ ///
+ /// Gets or sets the Green value.
+ ///
+ ///
+ /// Value should be clamped to [0,1].
+ ///
+ [DataMember(Name = "green")]
+ public decimal Green { get; set; }
+
+ ///
+ /// Gets or sets the Blue value.
+ ///
+ ///
+ /// Value should be clamped to [0,1].
+ ///
+ [DataMember(Name = "blue")]
+ public decimal Blue { get; set; }
+
+ ///
+ /// Gets or sets the Alpha value.
+ ///
+ ///
+ /// Value should be clamped to [0,1].
+ ///
+ [DataMember(Name = "alpha")]
+ public decimal Alpha { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ColorInformation.cs b/src/Features/LanguageServer/Protocol/Protocol/ColorInformation.cs
new file mode 100644
index 0000000000000..e2cf2f0433fad
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ColorInformation.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents color information.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class ColorInformation
+ {
+ ///
+ /// Gets or sets the text range representing the color.
+ ///
+ [DataMember(Name = "range")]
+ public Range Range { get; set; }
+
+ ///
+ /// Gets or sets the color.
+ ///
+ [DataMember(Name = "color")]
+ public Color Color { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Command.cs b/src/Features/LanguageServer/Protocol/Protocol/Command.cs
new file mode 100644
index 0000000000000..d3effcdb1b3ae
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Command.cs
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a reference to a command
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class Command
+ {
+ ///
+ /// Gets or sets the title of the command.
+ ///
+ [DataMember(Name = "title")]
+ [JsonProperty(Required = Required.Always)]
+ public string Title
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the identifier associated with the command.
+ ///
+ [DataMember(Name = "command")]
+ [JsonProperty(Required = Required.Always)]
+ public string CommandIdentifier
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the arguments that the command should be invoked with.
+ ///
+ [DataMember(Name = "arguments")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object[]? Arguments
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionContext.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionContext.cs
new file mode 100644
index 0000000000000..609242748d6b3
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionContext.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing additional information about the content in which a completion request is triggered.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CompletionContext
+ {
+ ///
+ /// Gets or sets the indicating how the completion was triggered.
+ ///
+ [DataMember(Name = "triggerKind")]
+ public CompletionTriggerKind TriggerKind
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the character that triggered code completion.
+ ///
+ [DataMember(Name = "triggerCharacter")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? TriggerCharacter
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionItem.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionItem.cs
new file mode 100644
index 0000000000000..acd63d0657304
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionItem.cs
@@ -0,0 +1,209 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.ComponentModel;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents an IntelliSense completion item.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CompletionItem
+ {
+ ///
+ /// Gets or sets the label value, i.e. display text to users.
+ ///
+ [DataMember(Name = "label", IsRequired = true)]
+ public string Label
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets additional details for the label.
+ ///
+ [DataMember(Name = "labelDetails")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CompletionItemLabelDetails? LabelDetails
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the completion kind.
+ ///
+ [DataMember(Name = "kind")]
+ [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")]
+ [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1500:BracesForMultiLineStatementsShouldNotShareLine", Justification = "There are no issues with this code")]
+ [DefaultValue(CompletionItemKind.None)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public CompletionItemKind Kind
+ {
+ get;
+ set;
+ } = CompletionItemKind.None;
+
+ ///
+ /// Gets or sets the completion detail.
+ ///
+ [DataMember(Name = "detail")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Detail
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the documentation comment.
+ ///
+ [DataMember(Name = "documentation")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public SumType? Documentation
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether this should be the selected item when showing.
+ ///
+ [DataMember(Name = "preselect")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool Preselect
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the custom sort text.
+ ///
+ [DataMember(Name = "sortText")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? SortText
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the custom filter text.
+ ///
+ [DataMember(Name = "filterText")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? FilterText
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the insert text.
+ ///
+ [DataMember(Name = "insertText")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? InsertText
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the insert text format.
+ ///
+ [DataMember(Name = "insertTextFormat")]
+ [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")]
+ [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1500:BracesForMultiLineStatementsShouldNotShareLine", Justification = "There are no issues with this code")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [DefaultValue(InsertTextFormat.Plaintext)]
+ public InsertTextFormat InsertTextFormat
+ {
+ get;
+ set;
+ } = InsertTextFormat.Plaintext;
+
+ ///
+ /// Gets or sets the text edit.
+ ///
+ [DataMember(Name = "textEdit")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public SumType? TextEdit
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the text edit text.
+ ///
+ [DataMember(Name = "textEditText")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? TextEditText
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets any additional text edits.
+ ///
+ ///
+ /// Additional text edits must not interfere with the main text edit.
+ ///
+ [DataMember(Name = "additionalTextEdits")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public TextEdit[]? AdditionalTextEdits
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the set of characters that will commit completion when this is selected
+ /// If present, this will override .
+ /// If absent, will be used instead.
+ ///
+ [DataMember(Name = "commitCharacters")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string[]? CommitCharacters
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets any optional command that will be executed after completion item insertion.
+ ///
+ ///
+ /// This feature is not supported in VS.
+ ///
+ [DataMember(Name = "command")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Command? Command
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets any additional data that links the unresolve completion item and the resolved completion item.
+ ///
+ [DataMember(Name = "data")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? Data
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionItemKind.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemKind.cs
new file mode 100644
index 0000000000000..24a46531e3b3c
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemKind.cs
@@ -0,0 +1,208 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Enum values for completion item kinds.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ internal enum CompletionItemKind
+ {
+ ///
+ /// Value to use when no kind was provided.
+ ///
+ None = 0,
+
+ // LSP Spec v3.16:
+
+ ///
+ /// Text.
+ ///
+ Text = 1,
+
+ ///
+ /// Method.
+ ///
+ Method = 2,
+
+ ///
+ /// Function.
+ ///
+ Function = 3,
+
+ ///
+ /// Constructor.
+ ///
+ Constructor = 4,
+
+ ///
+ /// Field.
+ ///
+ Field = 5,
+
+ ///
+ /// Variable.
+ ///
+ Variable = 6,
+
+ ///
+ /// Class.
+ ///
+ Class = 7,
+
+ ///
+ /// Interface.
+ ///
+ Interface = 8,
+
+ ///
+ /// Module.
+ ///
+ Module = 9,
+
+ ///
+ /// Property.
+ ///
+ Property = 10,
+
+ ///
+ /// Unit.
+ ///
+ Unit = 11,
+
+ ///
+ /// Value.
+ ///
+ Value = 12,
+
+ ///
+ /// Enum.
+ ///
+ Enum = 13,
+
+ ///
+ /// Keyword.
+ ///
+ Keyword = 14,
+
+ ///
+ /// Snippet.
+ ///
+ Snippet = 15,
+
+ ///
+ /// Color.
+ ///
+ Color = 16,
+
+ ///
+ /// File.
+ ///
+ File = 17,
+
+ ///
+ /// Reference.
+ ///
+ Reference = 18,
+
+ ///
+ /// Folder.
+ ///
+ Folder = 19,
+
+ ///
+ /// EnumMember.
+ ///
+ EnumMember = 20,
+
+ ///
+ /// Constant.
+ ///
+ Constant = 21,
+
+ ///
+ /// Struct.
+ ///
+ Struct = 22,
+
+ ///
+ /// Event.
+ ///
+ Event = 23,
+
+ ///
+ /// Operator.
+ ///
+ Operator = 24,
+
+ ///
+ /// TypeParameter.
+ ///
+ TypeParameter = 25,
+
+ // Kinds custom to VS, starting with index 118115 to avoid collisions with other clients's custom kinds.
+
+ ///
+ /// Macro.
+ ///
+ Macro = 118115 + 0,
+
+ ///
+ /// Namespace.
+ ///
+ Namespace = 118115 + 1,
+
+ ///
+ /// Template.
+ ///
+ Template = 118115 + 2,
+
+ ///
+ /// TypeDefinition.
+ ///
+ TypeDefinition = 118115 + 3,
+
+ ///
+ /// Union.
+ ///
+ Union = 118115 + 4,
+
+ ///
+ /// Delegate.
+ ///
+ Delegate = 118115 + 5,
+
+ ///
+ /// TagHelper.
+ ///
+ TagHelper = 118115 + 6,
+
+ ///
+ /// ExtensionMethod.
+ ///
+ ExtensionMethod = 118115 + 7,
+
+ ///
+ /// Element.
+ ///
+ Element = 118115 + 8,
+
+ ///
+ /// LocalResource.
+ ///
+ LocalResource = 118115 + 9,
+
+ ///
+ /// SystemResource.
+ ///
+ SystemResource = 118115 + 10,
+
+ ///
+ /// CloseElement.
+ ///
+ CloseElement = 118115 + 11,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionItemKindSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemKindSetting.cs
new file mode 100644
index 0000000000000..2322270f54e5d
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemKindSetting.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents the initialization setting for completion item kind
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CompletionItemKindSetting
+ {
+ ///
+ /// Gets or sets the values that the client supports.
+ ///
+ [DataMember(Name = "valueSet")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CompletionItemKind[]? ValueSet
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionItemLabelDetails.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemLabelDetails.cs
new file mode 100644
index 0000000000000..43b290c77361b
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemLabelDetails.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using Newtonsoft.Json;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Additional details for a completion item label.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CompletionItemLabelDetails
+ {
+ ///
+ /// Gets or sets an optional string which is rendered less prominently directly after label, without any spacing.
+ ///
+ [DataMember(Name = "detail")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Detail
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets an optional string which is rendered less prominently after detail.
+ ///
+ [DataMember(Name = "description")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Description
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionItemOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemOptions.cs
new file mode 100644
index 0000000000000..9686561c69c7b
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents completion item capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CompletionItemOptions
+ {
+ ///
+ /// Gets or sets a value indicating The server has support for completion item label details
+ ///
+ [DataMember(Name = "labelDetailsSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool LabelDetailsSupport
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionItemSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemSetting.cs
new file mode 100644
index 0000000000000..58c655a5256c5
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemSetting.cs
@@ -0,0 +1,128 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents initialization setting for completion item.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CompletionItemSetting
+ {
+ ///
+ /// Gets or sets a value indicating whether completion items can contain snippets.
+ ///
+ [DataMember(Name = "snippetSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool SnippetSupport
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the client supports commit characters.
+ ///
+ [DataMember(Name = "commitCharactersSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool CommitCharactersSupport
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the content formats supported for documentation.
+ ///
+ [DataMember(Name = "documentationFormat")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public MarkupKind[]? DocumentationFormat
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the a value indicating whether the client supports the deprecated property on a completion item.
+ ///
+ [DataMember(Name = "deprecatedSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool DeprecatedSupport
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the a value indicating whether the client supports the preselect property on a completion item.
+ ///
+ [DataMember(Name = "preselectSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool PreselectSupport
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the a value indicating whether the client supports the tag property on a completion item.
+ ///
+ [DataMember(Name = "tagSupport")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CompletionItemTagSupportSetting? TagSupport
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the a value indicating whether the client supports insert replace edit.
+ ///
+ [DataMember(Name = "insertReplaceSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool InsertReplaceSupport
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the a value indicating which properties a client can resolve lazily on a completion item.
+ ///
+ [DataMember(Name = "resolveSupport")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public ResolveSupportSetting? ResolveSupport
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the a value indicating whether the client supports the `insertTextMode` property on a completion item to override the whitespace handling mode as defined by the client.
+ ///
+ [DataMember(Name = "insertTextModeSupport")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public InsertTextModeSupportSetting? InsertTextModeSupport
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the a value indicating whether the client supports completion item label details.
+ ///
+ [DataMember(Name = "labelDetailsSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool LabelDetailsSupport
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionItemTag.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemTag.cs
new file mode 100644
index 0000000000000..349e188ce5087
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemTag.cs
@@ -0,0 +1,19 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Completion item tags are extra annotations that tweak the rendering of a completion item.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ internal enum CompletionItemTag
+ {
+ ///
+ /// Render a completion as obsolete, usually using a strike-out.
+ ///
+ Deprecated = 1,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionItemTagSupportSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemTagSupportSetting.cs
new file mode 100644
index 0000000000000..94b64986cff53
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionItemTagSupportSetting.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents initialization setting for the tag property on a completion item.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CompletionItemTagSupportSetting
+ {
+ ///
+ /// Gets or sets a value indicating the tags supported by the client.
+ ///
+ [DataMember(Name = "valueSet", IsRequired = true)]
+ public CompletionItemTag[] ValueSet
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionList.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionList.cs
new file mode 100644
index 0000000000000..6189603e856f0
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionList.cs
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents a completion list.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CompletionList
+ {
+ ///
+ /// Gets or sets a value indicating whether Items is the complete list of items or not. If incomplete is true, then
+ /// filtering should ask the server again for completion item.
+ ///
+ [DataMember(Name = "isIncomplete")]
+ public bool IsIncomplete
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the list of completion items.
+ ///
+ [DataMember(Name = "items")]
+ public CompletionItem[] Items
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the completion list item defaults.
+ ///
+ [DataMember(Name = "itemDefaults")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CompletionListItemDefaults? ItemDefaults
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionListItemDefaults.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionListItemDefaults.cs
new file mode 100644
index 0000000000000..9c30582f3790a
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionListItemDefaults.cs
@@ -0,0 +1,71 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents default properties associated with the entire completion list.
+ ///
+ [DataContract]
+ internal class CompletionListItemDefaults
+ {
+ ///
+ /// Gets or sets the default commit character set.
+ ///
+ [DataMember(Name = "commitCharacters")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string[]? CommitCharacters
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the default edit range.
+ ///
+ [DataMember(Name = "editRange")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public SumType? EditRange
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the default .
+ ///
+ [DataMember(Name = "insertTextFormat")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public InsertTextFormat? InsertTextFormat
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the default .
+ ///
+ [DataMember(Name = "insertTextMode")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public InsertTextMode? InsertTextMode
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the default completion item data.
+ ///
+ [DataMember(Name = "data")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? Data
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionListSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionListSetting.cs
new file mode 100644
index 0000000000000..6ae332b4c314b
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionListSetting.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents capabilites for the completion list type.
+ ///
+ [DataContract]
+ internal class CompletionListSetting
+ {
+ ///
+ /// Gets or sets a value containing the supported property names of the object.
+ /// If omitted, no properties are supported.
+ ///
+ [DataMember(Name = "itemDefaults")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string[]? ItemDefaults
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionOptions.cs
new file mode 100644
index 0000000000000..2671ce6ef6959
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionOptions.cs
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents completion capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CompletionOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets the trigger characters.
+ ///
+ [DataMember(Name = "triggerCharacters")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string[]? TriggerCharacters
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating all the possible commit characters associated with the language server.
+ ///
+ [DataMember(Name = "allCommitCharacters")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string[]? AllCommitCharacters
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether server provides completion item resolve capabilities.
+ ///
+ [DataMember(Name = "resolveProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool ResolveProvider
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets completion item setting.
+ ///
+ [DataMember(Name = "completionItem")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CompletionItemOptions? CompletionItemOptions
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionParams.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionParams.cs
new file mode 100644
index 0000000000000..0756a75604049
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionParams.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the parameters for the textDocument/completion request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CompletionParams : TextDocumentPositionParams, IPartialResultParams?>
+ {
+ ///
+ /// Gets or sets the completion context.
+ ///
+ [DataMember(Name = "context")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CompletionContext? Context
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the value of the PartialResultToken instance.
+ ///
+ [DataMember(Name = Methods.PartialResultTokenName)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public IProgress?>? PartialResultToken
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionSetting.cs
new file mode 100644
index 0000000000000..d05a2bcac679e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionSetting.cs
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents initialization setting for completion.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CompletionSetting : DynamicRegistrationSetting
+ {
+ ///
+ /// Gets or sets completion item setting.
+ ///
+ [DataMember(Name = "completionItem")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CompletionItemSetting? CompletionItem
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets specific settings.
+ ///
+ [DataMember(Name = "completionItemKind")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CompletionItemKindSetting? CompletionItemKind
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the client supports sending additional context.
+ ///
+ [DataMember(Name = "contextSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool ContextSupport
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating client's default when the completion item doesn't provide an `insertTextMode` property.
+ ///
+ [DataMember(Name = "insertTextMode")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public InsertTextMode? InsertTextMode
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the client supports capabilities on the completion list.
+ ///
+ [DataMember(Name = "completionList")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CompletionListSetting? CompletionListSetting
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CompletionTriggerKind.cs b/src/Features/LanguageServer/Protocol/Protocol/CompletionTriggerKind.cs
new file mode 100644
index 0000000000000..c6e0289f2196f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CompletionTriggerKind.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Enum which represents the various ways in which completion can be triggered.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal enum CompletionTriggerKind
+ {
+ ///
+ /// Completion was triggered by typing an identifier.
+ ///
+ Invoked = 1,
+
+ ///
+ /// Completion was triggered by typing a trigger character.
+ ///
+ TriggerCharacter = 2,
+
+ ///
+ /// Completion was re-triggered as the current completion list is incomplete.
+ ///
+ TriggerForIncompleteCompletions = 3,
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ConfigurationItem.cs b/src/Features/LanguageServer/Protocol/Protocol/ConfigurationItem.cs
new file mode 100644
index 0000000000000..28bf61c08039e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ConfigurationItem.cs
@@ -0,0 +1,42 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents an configuration item.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class ConfigurationItem
+ {
+ ///
+ /// Gets or sets the scope to get the configuration section for.
+ ///
+ [DataMember(Name = "scopeUri")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ [JsonConverter(typeof(DocumentUriConverter))]
+ public Uri? ScopeUri
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the requested configuration section.
+ ///
+ [DataMember(Name = "section")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Section
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ConfigurationParams.cs b/src/Features/LanguageServer/Protocol/Protocol/ConfigurationParams.cs
new file mode 100644
index 0000000000000..c4547e2f08587
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ConfigurationParams.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the parameters for the workspace/configuration request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class ConfigurationParams
+ {
+ ///
+ /// Gets or sets the ConfigurationItems being requested.
+ ///
+ [DataMember(Name = "items")]
+ public ConfigurationItem[] Items
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Converters/DocumentUriConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Converters/DocumentUriConverter.cs
new file mode 100644
index 0000000000000..1da728f7de61d
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Converters/DocumentUriConverter.cs
@@ -0,0 +1,60 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Globalization;
+ using Microsoft.CodeAnalysis.LanguageServer;
+ using Microsoft.CommonLanguageServerProtocol.Framework;
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Linq;
+
+ ///
+ /// TODO: document.
+ ///
+ internal class DocumentUriConverter : JsonConverter
+ {
+ ///
+ public override bool CanConvert(Type objectType)
+ {
+ return true;
+ }
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ reader = reader ?? throw new ArgumentNullException(nameof(reader));
+ if (reader.TokenType == JsonToken.String)
+ {
+ var token = JToken.ReadFrom(reader);
+ var uri = new Uri(token.ToObject());
+
+ return uri;
+ }
+ else if (reader.TokenType == JsonToken.Null)
+ {
+ return null;
+ }
+
+ throw new JsonSerializationException(string.Format(CultureInfo.InvariantCulture, LanguageServerProtocolResources.DocumentUriSerializationError, reader.Value));
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ writer = writer ?? throw new ArgumentNullException(nameof(writer));
+
+ if (value is Uri uri)
+ {
+ var token = JToken.FromObject(uri.AbsoluteUri);
+ token.WriteTo(writer);
+ }
+ else
+ {
+ throw new ArgumentException($"{nameof(value)} must be of type {nameof(Uri)}");
+ }
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Converters/JsonConverterCollectionUtilities.cs b/src/Features/LanguageServer/Protocol/Protocol/Converters/JsonConverterCollectionUtilities.cs
new file mode 100644
index 0000000000000..207ed168f25e6
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Converters/JsonConverterCollectionUtilities.cs
@@ -0,0 +1,19 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using Newtonsoft.Json;
+
+ ///
+ /// Class containing extension method to thread-safely manage operations.
+ ///
+ internal static class JsonConverterCollectionUtilities
+ {
+ ///
+ /// Lock used for modifications to Converters collection.
+ ///
+ public static readonly object ConvertersLock = new object();
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Converters/KindAttribute.cs b/src/Features/LanguageServer/Protocol/Protocol/Converters/KindAttribute.cs
new file mode 100644
index 0000000000000..75dd87154b622
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Converters/KindAttribute.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+
+ ///
+ /// Attribute that defines the expected value of the JSON property when a type is
+ /// used in an .
+ ///
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
+ internal class KindAttribute : Attribute
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The expected value of the JSON property.
+ /// The name of the property that is used to identify the contained type of the .
+ /// Specifying this attribute doesn't automatically include the JSON property upon serialization.
+ ///
+ /// In the current implementation the JSON property is always considered required.
+ public KindAttribute(string kind, string kindPropertyName = "kind")
+ {
+ this.Kind = kind ?? throw new ArgumentNullException(nameof(kind));
+ this.KindPropertyName = kindPropertyName ?? throw new ArgumentNullException(nameof(kindPropertyName));
+ }
+
+ ///
+ /// Gets the expected value of the JSON property.
+ ///
+ public string Kind { get; private set; }
+
+ ///
+ /// Gets the name of the property that is used to identify the contained type of the .
+ ///
+ public string KindPropertyName { get; private set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Converters/ParameterInformationConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Converters/ParameterInformationConverter.cs
new file mode 100644
index 0000000000000..ca7ba65725eb1
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Converters/ParameterInformationConverter.cs
@@ -0,0 +1,65 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Linq;
+
+ ///
+ /// JsonConverter to correctly deserialize int arrays in the Label param of ParameterInformation.
+ ///
+ internal class ParameterInformationConverter : JsonConverter
+ {
+ ///
+ public override bool CanWrite => false;
+
+ ///
+ public override bool CanConvert(Type objectType)
+ {
+ return true;
+ }
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ var token = JToken.Load(reader);
+
+ var label = ((JObject)token).Property("label", StringComparison.Ordinal);
+ var documentation = ((JObject)token).Property("documentation", StringComparison.Ordinal);
+
+ var parameter = new ParameterInformation();
+
+ if (label != null)
+ {
+ var value = label.Value;
+ if (value is JArray arr)
+ {
+ var tuple = new Tuple(arr[0].Value(), arr[1].Value());
+ parameter.Label = tuple;
+ }
+ else
+ {
+ // If label is not an array we can serialize it normally
+ parameter.Label = value.ToObject>>();
+ }
+ }
+
+ if (documentation != null)
+ {
+ var value = documentation.Value;
+ parameter.Documentation = value.ToObject?>();
+ }
+
+ return parameter;
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Converters/StringEnumConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Converters/StringEnumConverter.cs
new file mode 100644
index 0000000000000..2e93f97371f87
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Converters/StringEnumConverter.cs
@@ -0,0 +1,103 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Linq.Expressions;
+using Microsoft.CodeAnalysis.LanguageServer;
+using Microsoft.CommonLanguageServerProtocol.Framework;
+using Newtonsoft.Json;
+
+///
+/// JsonConverter for serializing and deserializing string-based enums.
+///
+/// The actual type implementing .
+internal class StringEnumConverter
+ : JsonConverter
+ where TStringEnumType : IStringEnum
+{
+ private static readonly Func CreateEnum;
+
+ static StringEnumConverter()
+ {
+ // TODO. When C# starts supporting static methods in interfaces, add a static Create method to IStringEnum and remove CreateEnum.
+ var constructor = typeof(TStringEnumType).GetConstructor(new Type[] { typeof(string) });
+ if (constructor is null)
+ {
+ throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, LanguageServerProtocolResources.StringEnumMissingConstructor, typeof(TStringEnumType).FullName));
+ }
+
+ var param = Expression.Parameter(typeof(string), "value");
+ var body = Expression.New(constructor, param);
+ CreateEnum = Expression.Lambda>(body, param).Compile();
+ }
+
+ ///
+ public override bool CanConvert(Type objectType) => objectType == typeof(TStringEnumType);
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ reader = reader ?? throw new ArgumentNullException(nameof(reader));
+
+ if (reader.TokenType == JsonToken.String)
+ {
+ return CreateEnum((string)reader.Value!);
+ }
+ else if (reader.TokenType == JsonToken.Null)
+ {
+ return default(TStringEnumType);
+ }
+
+ throw new JsonSerializationException(string.Format(CultureInfo.InvariantCulture, LanguageServerProtocolResources.StringEnumSerializationError, reader.Value));
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ writer = writer ?? throw new ArgumentNullException(nameof(writer));
+
+ if (value is TStringEnumType kind)
+ {
+ writer.WriteValue(kind.Value);
+ }
+ else
+ {
+ throw new ArgumentException($"{nameof(value)} must be of type {typeof(TStringEnumType).FullName}");
+ }
+ }
+
+ ///
+ /// Type converter from to .
+ /// This is required to support .
+ ///
+ internal class TypeConverter
+ : System.ComponentModel.TypeConverter
+ {
+ ///
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ if (sourceType == typeof(string))
+ {
+ return true;
+ }
+
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ ///
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if (value is string stringValue)
+ {
+ return CreateEnum(stringValue);
+ }
+
+ return base.ConvertFrom(context, culture, value);
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Converters/SumConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Converters/SumConverter.cs
new file mode 100644
index 0000000000000..1ef563f3ff4d6
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Converters/SumConverter.cs
@@ -0,0 +1,270 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Collections.Concurrent;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Reflection;
+ using Microsoft.CodeAnalysis.LanguageServer;
+ using Microsoft.CommonLanguageServerProtocol.Framework;
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Linq;
+
+ ///
+ /// Converter to translate to and from SumTypes.
+ ///
+ internal class SumConverter : JsonConverter
+ {
+ private static readonly ConcurrentDictionary SumTypeCache = new ConcurrentDictionary();
+
+ ///
+ public override bool CanConvert(Type objectType)
+ {
+ return typeof(ISumType).IsAssignableFrom(objectType);
+ }
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ reader = reader ?? throw new ArgumentNullException(nameof(reader));
+ serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
+
+ // Even if CanConvert only returns true for ISumType, ReadJson is invoked for Nullable> as well
+ if (reader.TokenType == JsonToken.Null)
+ {
+ if (objectType.IsGenericType && objectType.GetGenericTypeDefinition() == typeof(Nullable<>))
+ {
+ return null;
+ }
+ else
+ {
+ // We shouldn't really ever have a non-Nullable SumType being received as null but, if we do, return an "empty" SumType
+ return Activator.CreateInstance(objectType);
+ }
+ }
+
+ // objectType will be one of the various SumType variants. In order for this converter to work with all SumTypes it has to use reflection.
+ // This method works by attempting to deserialize the json into each of the type parameters to a SumType and stops at the first success.
+ var sumTypeInfoCache = SumTypeCache.GetOrAdd(objectType, (t) => new SumTypeInfoCache(t));
+
+ JToken? token = null;
+ var applicableUnionTypeInfos = sumTypeInfoCache.GetApplicableInfos(reader.TokenType);
+
+ for (var i = 0; i < applicableUnionTypeInfos.Count; i++)
+ {
+ var unionTypeInfo = applicableUnionTypeInfos[i];
+
+ if (!IsTokenCompatibleWithType(reader, unionTypeInfo))
+ {
+ continue;
+ }
+
+ try
+ {
+ object? sumValue;
+ if (token == null && i + 1 == applicableUnionTypeInfos.Count)
+ {
+ // We're at the very last entry, we don't need to maintain the JsonReader, can read directly from the JsonReader to avoid the inbetween JObject type.
+ sumValue = serializer.Deserialize(reader, unionTypeInfo.Type);
+ }
+ else
+ {
+ if (token == null)
+ {
+ token = JToken.ReadFrom(reader);
+ }
+
+ if (unionTypeInfo.KindAttribute is not null &&
+ (token is not JObject jObject || jObject[unionTypeInfo.KindAttribute.KindPropertyName]?.ToString() != unionTypeInfo.KindAttribute.Kind))
+ {
+ continue;
+ }
+
+ sumValue = token.ToObject(unionTypeInfo.Type, serializer);
+ }
+
+ object?[] args = { sumValue };
+ var sum = unionTypeInfo.Constructor.Invoke(args);
+ return sum;
+ }
+ catch
+ {
+ continue;
+ }
+ }
+
+ throw new JsonSerializationException(LanguageServerProtocolResources.NoSumTypeMatch);
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ writer = writer ?? throw new ArgumentNullException(nameof(writer));
+
+ if (value is null)
+ {
+ writer.WriteNull();
+ }
+ else
+ {
+ writer = writer ?? throw new ArgumentNullException(nameof(writer));
+
+ var sumValue = ((ISumType)value!).Value;
+
+ if (sumValue != null)
+ {
+ var token = JToken.FromObject(sumValue);
+ token.WriteTo(writer);
+ }
+ }
+ }
+
+ private static bool IsTokenCompatibleWithType(JsonReader reader, SumTypeInfoCache.UnionTypeInfo unionTypeInfo)
+ {
+ var isCompatible = true;
+ switch (reader.TokenType)
+ {
+ case JsonToken.Float:
+ isCompatible = unionTypeInfo.Type == typeof(double) ||
+ unionTypeInfo.Type == typeof(float);
+ break;
+ case JsonToken.Boolean:
+ isCompatible = unionTypeInfo.Type == typeof(bool);
+ break;
+ case JsonToken.Integer:
+ isCompatible = unionTypeInfo.Type == typeof(int) ||
+ unionTypeInfo.Type == typeof(uint) ||
+ unionTypeInfo.Type == typeof(long) ||
+ unionTypeInfo.Type == typeof(ulong) ||
+ unionTypeInfo.Type == typeof(short) ||
+ unionTypeInfo.Type == typeof(ushort) ||
+ unionTypeInfo.Type == typeof(byte) ||
+ unionTypeInfo.Type == typeof(sbyte) ||
+ unionTypeInfo.Type == typeof(double) ||
+ unionTypeInfo.Type == typeof(float);
+ break;
+ case JsonToken.String:
+ isCompatible = unionTypeInfo.Type == typeof(string) ||
+ typeof(IStringEnum).IsAssignableFrom(unionTypeInfo.Type);
+ break;
+ }
+
+ return isCompatible;
+ }
+
+ private class SumTypeInfoCache
+ {
+ // netstandard1.0 doesn't support Array.Empty
+#pragma warning disable CA1825 // Avoid zero-length array allocations.
+ private static readonly IReadOnlyList EmptyUnionInfos = new UnionTypeInfo[0];
+#pragma warning restore CA1825 // Avoid zero-length array allocations.
+
+ private readonly IReadOnlyList allUnionTypeInfos;
+
+ private readonly IReadOnlyList primitiveUnionTypeInfos;
+
+ private readonly IReadOnlyList arrayUnionTypeInfos;
+
+ private readonly IReadOnlyList objectUnionTypeInfos;
+
+ public SumTypeInfoCache(Type sumTypeType)
+ {
+ var allUnionTypeInfosSet = new List();
+ List? primitiveUnionTypeInfosSet = null;
+ List? arrayUnionTypeInfosSet = null;
+ List? objectUnionTypeInfosSet = null;
+
+ // If the SumType is a nullable extract the underlying type and re-assign
+ sumTypeType = NormalizeToNonNullable(sumTypeType);
+
+ var typeInfo = sumTypeType.GetTypeInfo();
+ var parameterTypes = typeInfo.GenericTypeArguments;
+ foreach (var parameterType in parameterTypes)
+ {
+ var parameterTypeInfo = NormalizeToNonNullable(parameterType).GetTypeInfo();
+ var declaredConstructor = typeInfo.GetConstructor(new Type[] { parameterType }) ??
+ throw new ArgumentException(nameof(sumTypeType), "All constructor parameter types must be represented in the generic type arguments of the SumType");
+
+ var kindAttribute = parameterType.GetCustomAttribute();
+ var unionTypeInfo = new UnionTypeInfo(parameterType, declaredConstructor, kindAttribute);
+ allUnionTypeInfosSet.Add(unionTypeInfo);
+
+ if (parameterTypeInfo.IsPrimitive ||
+ parameterTypeInfo == typeof(string) ||
+ typeof(IStringEnum).IsAssignableFrom(parameterTypeInfo))
+ {
+ primitiveUnionTypeInfosSet ??= new List();
+ primitiveUnionTypeInfosSet.Add(unionTypeInfo);
+ }
+ else if (parameterTypeInfo.IsArray)
+ {
+ arrayUnionTypeInfosSet ??= new List();
+ arrayUnionTypeInfosSet.Add(unionTypeInfo);
+ }
+ else
+ {
+ objectUnionTypeInfosSet ??= new List();
+ objectUnionTypeInfosSet.Add(unionTypeInfo);
+ }
+ }
+
+ this.allUnionTypeInfos = allUnionTypeInfosSet;
+ this.primitiveUnionTypeInfos = primitiveUnionTypeInfosSet ?? EmptyUnionInfos;
+ this.arrayUnionTypeInfos = arrayUnionTypeInfosSet ?? EmptyUnionInfos;
+ if ((objectUnionTypeInfosSet?.Count ?? 0) > 1)
+ {
+ // If some types are tagged with a KindAttribute, make sure they are first in the list in order to avoid the wrong type being deserialized
+ this.objectUnionTypeInfos = objectUnionTypeInfosSet.Where(t => t.KindAttribute is not null).Concat(
+ objectUnionTypeInfosSet.Where(t => t.KindAttribute is null)).ToList();
+ }
+ else
+ {
+ this.objectUnionTypeInfos = objectUnionTypeInfosSet ?? EmptyUnionInfos;
+ }
+ }
+
+ public IReadOnlyList GetApplicableInfos(JsonToken startingTokenType)
+ {
+ return startingTokenType switch
+ {
+ JsonToken.StartArray
+ => this.arrayUnionTypeInfos,
+ JsonToken.Integer or
+ JsonToken.Float or
+ JsonToken.Bytes or
+ JsonToken.String or
+ JsonToken.Boolean
+ => this.primitiveUnionTypeInfos,
+ JsonToken.StartObject
+ => this.objectUnionTypeInfos,
+ _ => this.allUnionTypeInfos,
+ };
+ }
+
+ private static Type NormalizeToNonNullable(Type sumTypeType)
+ {
+ return Nullable.GetUnderlyingType(sumTypeType) ?? sumTypeType;
+ }
+
+ internal class UnionTypeInfo
+ {
+ public UnionTypeInfo(Type type, ConstructorInfo constructor, KindAttribute? kindAttribute)
+ {
+ this.Type = type ?? throw new ArgumentNullException(nameof(type));
+ this.Constructor = constructor ?? throw new ArgumentNullException(nameof(constructor));
+ this.KindAttribute = kindAttribute;
+ }
+
+ public Type Type { get; }
+
+ public ConstructorInfo Constructor { get; }
+
+ public KindAttribute? KindAttribute { get; }
+ }
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Converters/TextDocumentSyncConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Converters/TextDocumentSyncConverter.cs
new file mode 100644
index 0000000000000..a8dd8c1f6e588
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Converters/TextDocumentSyncConverter.cs
@@ -0,0 +1,100 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Globalization;
+ using Microsoft.CodeAnalysis.LanguageServer;
+ using Microsoft.CommonLanguageServerProtocol.Framework;
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Linq;
+
+ ///
+ /// Converter which offers custom serialization for enum to a object.
+ ///
+ ///
+ /// This is to support backwards compatibility for the protocol.
+ ///
+ internal class TextDocumentSyncConverter : JsonConverter
+ {
+ ///
+ public override bool CanConvert(Type objectType)
+ {
+ return true;
+ }
+
+ ///
+ /// Deserializes a json value to a object.
+ ///
+ /// Reader from which to read json value.
+ /// Type of the json value.
+ /// Existing value.
+ /// Default serializer.
+ /// A which matches the json value.
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ reader = reader ?? throw new ArgumentNullException(nameof(reader));
+ if (reader.TokenType == JsonToken.Float || reader.TokenType == JsonToken.Integer)
+ {
+ // This conversion is modeled after what VS Code does, see https://github.com/Microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L1234
+ var textDocSync = new TextDocumentSyncOptions
+ {
+ OpenClose = true,
+ Change = (TextDocumentSyncKind)int.Parse(reader.Value!.ToString(), NumberStyles.Integer, CultureInfo.CurrentCulture),
+ Save = new SaveOptions
+ {
+ IncludeText = false,
+ },
+ };
+
+ return textDocSync;
+ }
+ else if (reader.TokenType == JsonToken.String)
+ {
+ return JsonConvert.DeserializeObject(reader.Value!.ToString());
+ }
+ else if (reader.TokenType == JsonToken.StartObject)
+ {
+ var token = JToken.ReadFrom(reader);
+ return token.ToObject();
+ }
+ else if (reader.TokenType == JsonToken.Null)
+ {
+ // This conversion is modeled after what VS Code does, see https://github.com/Microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L1234
+ var textDocSync = new TextDocumentSyncOptions
+ {
+ OpenClose = true,
+ Change = TextDocumentSyncKind.None,
+ Save = new SaveOptions
+ {
+ IncludeText = false,
+ },
+ };
+
+ return textDocSync;
+ }
+
+ throw new JsonSerializationException(string.Format(CultureInfo.InvariantCulture, LanguageServerProtocolResources.TextDocumentSyncSerializationError, reader.Value));
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ writer = writer ?? throw new ArgumentNullException(nameof(writer));
+
+ if (value is null)
+ {
+ writer.WriteNull();
+ }
+ else
+ {
+ writer = writer ?? throw new ArgumentNullException(nameof(writer));
+
+ var token = JToken.FromObject(value);
+ token.WriteTo(writer);
+ }
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CreateFile.cs b/src/Features/LanguageServer/Protocol/Protocol/CreateFile.cs
new file mode 100644
index 0000000000000..8cc16ae3379ff
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CreateFile.cs
@@ -0,0 +1,49 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a create file operation.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ [Kind("create")]
+ internal class CreateFile
+ {
+ ///
+ /// Gets the kind value.
+ ///
+ [DataMember(Name = "kind")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Member can't be static since it's part of the protocol")]
+ public string Kind => "create";
+
+ ///
+ /// Gets or sets the resource to create.
+ ///
+ [DataMember(Name = "uri", IsRequired = true)]
+ [JsonConverter(typeof(DocumentUriConverter))]
+ public Uri Uri
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the additional options.
+ ///
+ [DataMember(Name = "options")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CreateFileOptions? Options
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CreateFileOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/CreateFileOptions.cs
new file mode 100644
index 0000000000000..68fcf7c8e30c5
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CreateFileOptions.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the options for a create file operation.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class CreateFileOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether the creation should overwrite the file if it already exists. (Overwrite wins over ignoreIfExists).
+ ///
+ [DataMember(Name = "overwrite")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool Overwrite
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the action should be ignored if the file already exists.
+ ///
+ [DataMember(Name = "ignoreIfExists")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool IgnoreIfExists
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/CustomDictionary.xml b/src/Features/LanguageServer/Protocol/Protocol/CustomDictionary.xml
new file mode 100644
index 0000000000000..1ab85c61f13c6
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/CustomDictionary.xml
@@ -0,0 +1,7 @@
+
+
+
+ params
+
+
+
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DefaultBehaviorPrepareRename.cs b/src/Features/LanguageServer/Protocol/Protocol/DefaultBehaviorPrepareRename.cs
new file mode 100644
index 0000000000000..abcd66aa84d61
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DefaultBehaviorPrepareRename.cs
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents a possible result value of the 'textDocument/prepareRename' request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DefaultBehaviorPrepareRename
+ {
+ ///
+ /// Gets or sets a value indicating whether the rename position is valid and the client should use its
+ /// default behavior to compute the rename range.
+ ///
+ [DataMember(Name = "defaultBehavior")]
+ [JsonProperty(Required = Required.Always)]
+ public bool DefaultBehavior
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DefinitionOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/DefinitionOptions.cs
new file mode 100644
index 0000000000000..10493fb0aa1cc
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DefinitionOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents workspace symbols capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DefinitionOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DeleteFile.cs b/src/Features/LanguageServer/Protocol/Protocol/DeleteFile.cs
new file mode 100644
index 0000000000000..dcc6eed78e854
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DeleteFile.cs
@@ -0,0 +1,49 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a delete file operation.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ [Kind("delete")]
+ internal class DeleteFile
+ {
+ ///
+ /// Gets the kind value.
+ ///
+ [DataMember(Name = "kind")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Member can't be static since it's part of the protocol")]
+ public string Kind => "delete";
+
+ ///
+ /// Gets or sets the file to delete.
+ ///
+ [DataMember(Name = "uri", IsRequired = true)]
+ [JsonConverter(typeof(DocumentUriConverter))]
+ public Uri Uri
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the additional options.
+ ///
+ [DataMember(Name = "options")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public DeleteFileOptions? Options
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DeleteFileOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/DeleteFileOptions.cs
new file mode 100644
index 0000000000000..5e1c8edd9e884
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DeleteFileOptions.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the options for a create file operation.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DeleteFileOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether the delete operation should be applied recursively if a folder is denoted. (Overwrite wins over ignoreIfNotExists).
+ ///
+ [DataMember(Name = "recursive")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool Recursive
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the action should be ignored if the file doesn't exists.
+ ///
+ [DataMember(Name = "ignoreIfNotExists")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool IgnoreIfNotExists
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Diagnostic.cs b/src/Features/LanguageServer/Protocol/Protocol/Diagnostic.cs
new file mode 100644
index 0000000000000..d664f263d5a7b
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Diagnostic.cs
@@ -0,0 +1,171 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Linq;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents a source code diagnostic message.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class Diagnostic : IEquatable
+ {
+ ///
+ /// Gets or sets the source code range.
+ ///
+ [DataMember(Name = "range")]
+ public Range Range
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the diagnostic severity.
+ ///
+ [DataMember(Name = "severity")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public DiagnosticSeverity? Severity
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the diagnostic's code, which usually appear in the user interface.
+ ///
+ ///
+ /// The value can be an , .
+ ///
+ [DataMember(Name = "code")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public SumType? Code
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets an optional value that describes the error code.
+ ///
+ [DataMember(Name = "codeDescription")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public CodeDescription? CodeDescription
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a human-readable string describing the source of this
+ /// diagnostic, e.g. 'typescript' or 'super lint'. It usually appears in the user interface.
+ ///
+ [DataMember(Name = "source")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Source
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the diagnostic's message.
+ ///
+ [DataMember(Name = "message")]
+ public string Message
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the diagnostic's tags.
+ ///
+ [DataMember(Name = "tags")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public DiagnosticTag[]? Tags
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the diagnostic related information
+ ///
+ [DataMember(Name = "relatedInformation")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public DiagnosticRelatedInformation[]? RelatedInformation
+ {
+ get;
+ set;
+ }
+
+ public static bool operator ==(Diagnostic? value1, Diagnostic? value2)
+ {
+ if (ReferenceEquals(value1, value2))
+ {
+ return true;
+ }
+
+ // Is null?
+ if (ReferenceEquals(null, value2))
+ {
+ return false;
+ }
+
+ return value1?.Equals(value2) ?? false;
+ }
+
+ public static bool operator !=(Diagnostic? value1, Diagnostic? value2)
+ {
+ return !(value1 == value2);
+ }
+
+ ///
+ public bool Equals(Diagnostic other)
+ {
+ return other is not null
+ && this.Range == other.Range
+ && this.Severity == other.Severity
+ && object.Equals(this.Code, other.Code)
+ && this.CodeDescription == other.CodeDescription
+ && string.Equals(this.Source, other.Source, StringComparison.Ordinal)
+ && string.Equals(this.Message, other.Message, StringComparison.Ordinal)
+ && (this.Tags == null
+ ? other.Tags == null
+ : this.Tags.Equals(other.Tags) || this.Tags.SequenceEqual(other.Tags));
+ }
+
+ ///
+ public override bool Equals(object obj)
+ {
+ if (obj is Diagnostic other)
+ {
+ return this.Equals(other);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ return (this.Range == null ? 53 : this.Range.GetHashCode() * 13)
+ ^ (this.Severity.GetHashCode() * 17)
+ ^ (this.Code == null ? 47 : this.Code.GetHashCode() * 19)
+ ^ (this.Source == null ? 61 : this.Source.GetHashCode() * 79)
+ ^ (this.Message == null ? 83 : this.Message.GetHashCode() * 23)
+ ^ (this.Tags == null ? 89 : this.Tags.Sum(t => (int)t) * 73)
+ ^ (this.CodeDescription == null ? 23 : this.CodeDescription.GetHashCode() * 29);
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DiagnosticOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticOptions.cs
new file mode 100644
index 0000000000000..e9b7898c56d37
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticOptions.cs
@@ -0,0 +1,59 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+
+///
+/// Server capabilities for pull diagnostics.
+///
+/// See the Language Server Protocol specification for additional information.
+///
+[DataContract]
+internal class DiagnosticOptions : IWorkDoneProgressOptions
+{
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the identifier in which the diagnostics are bucketed by the client.
+ ///
+ [DataMember(Name = "identifier")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Identifier
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the language has inter file dependencies.
+ ///
+ [DataMember(Name = "interFileDependencies")]
+ public bool InterFileDependencies
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server provides support for workspace diagnostics as well.
+ ///
+ [DataMember(Name = "workspaceDiagnostics")]
+ public bool WorkspaceDiagnostics
+ {
+ get;
+ set;
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DiagnosticRegistrationOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticRegistrationOptions.cs
new file mode 100644
index 0000000000000..549fe02ed56cf
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticRegistrationOptions.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+
+///
+/// Diagnostic registration options.
+///
+/// See the Language Server Protocol specification for additional information.
+///
+[DataContract]
+internal class DiagnosticRegistrationOptions : DiagnosticOptions, IStaticRegistrationOptions, ITextDocumentRegistrationOptions
+{
+ ///
+ /// Gets or sets the document filters for this registration option.
+ ///
+ [DataMember(Name = "documentSelector")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Include)]
+ public DocumentFilter[]? DocumentSelector
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "id")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Id
+ {
+ get;
+ set;
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DiagnosticRelatedInformation.cs b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticRelatedInformation.cs
new file mode 100644
index 0000000000000..e62e8058f8cf7
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticRelatedInformation.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents a related message and source code location for a diagnostic.
+ /// This should be used to point to code locations that cause or are related to
+ /// a diagnostics, e.g when duplicating a symbol in a scope.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DiagnosticRelatedInformation
+ {
+ ///
+ /// Gets or sets the location for the related information.
+ ///
+ [DataMember(Name = "location")]
+ public Location Location { get; set; }
+
+ ///
+ /// Gets or sets the message for the related information.
+ ///
+ [DataMember(Name = "message")]
+ public string Message { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DiagnosticServerCancellationData.cs b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticServerCancellationData.cs
new file mode 100644
index 0000000000000..9840373f3f4c5
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticServerCancellationData.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System.Runtime.Serialization;
+
+///
+/// Class representing the cancellation data returned from a diagnostic request.
+///
+/// See the Language Server Protocol specification for additional information.
+///
+[DataContract]
+internal class DiagnosticServerCancellationData
+{
+ ///
+ /// Gets or sets a value indicating whether the client should re-trigger the request.
+ ///
+ [DataMember(Name = "retriggerRequest")]
+ public bool RetriggerRequest
+ {
+ get;
+ set;
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DiagnosticSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticSetting.cs
new file mode 100644
index 0000000000000..75c0827e25bf6
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticSetting.cs
@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+
+///
+/// Client settings for pull diagnostics.
+///
+/// See the Language Server Protocol specification for additional information.
+///
+[DataContract]
+internal class DiagnosticSetting : DynamicRegistrationSetting
+{
+ ///
+ /// Gets or sets a value indicating whether the client supports related documents for document diagnostic pulls.
+ ///
+ [DataMember(Name = "relatedDocumentSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool RelatedDocumentSupport { get; set; }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DiagnosticSeverity.cs b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticSeverity.cs
new file mode 100644
index 0000000000000..ede441ea9074c
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticSeverity.cs
@@ -0,0 +1,34 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Diagnostic severity enum.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ internal enum DiagnosticSeverity
+ {
+ ///
+ /// Error.
+ ///
+ Error = 1,
+
+ ///
+ /// Warning.
+ ///
+ Warning = 2,
+
+ ///
+ /// Information.
+ ///
+ Information = 3,
+
+ ///
+ /// Hint.
+ ///
+ Hint = 4,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DiagnosticTag.cs b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticTag.cs
new file mode 100644
index 0000000000000..1b2662066ffea
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticTag.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Diagnostic tag enum.
+ /// Additional metadata about the type of a diagnostic
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ internal enum DiagnosticTag
+ {
+ ///
+ /// Unused or unnecessary code.
+ /// Diagnostics with this tag are rendered faded out.
+ ///
+ Unnecessary = 1,
+
+ ///
+ /// Deprecated or obsolete code.
+ /// Clients are allowed to rendered diagnostics with this tag strike through.
+ ///
+ Deprecated = 2,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DiagnosticWorkspaceSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticWorkspaceSetting.cs
new file mode 100644
index 0000000000000..1c1640598d134
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DiagnosticWorkspaceSetting.cs
@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+
+///
+/// Class representing the workspace diagnostic client capabilities.
+///
+/// See the Language Server Protocol specification for additional information.
+///
+[DataContract]
+internal class DiagnosticWorkspaceSetting
+{
+ ///
+ /// Gets or sets a value indicating whether the client supports a refresh request sent from the server to the client.
+ ///
+ [DataMember(Name = "refreshSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool RefreshSupport { get; set; }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DidChangeConfigurationParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DidChangeConfigurationParams.cs
new file mode 100644
index 0000000000000..a9816d3926583
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DidChangeConfigurationParams.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents the parameter sent with workspace/didChangeConfiguration requests.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DidChangeConfigurationParams
+ {
+ ///
+ /// Gets or sets the settings that are applicable to the language server.
+ ///
+ [DataMember(Name = "settings")]
+ public object Settings
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DidChangeTextDocumentParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DidChangeTextDocumentParams.cs
new file mode 100644
index 0000000000000..0a4f9c3934a02
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DidChangeTextDocumentParams.cs
@@ -0,0 +1,42 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents the parameter that is sent with textDocument/didChange message.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DidChangeTextDocumentParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the document that changed.
+ ///
+ [DataMember(Name = "textDocument")]
+ public VersionedTextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the content changes.
+ ///
+ [DataMember(Name = "contentChanges")]
+ public TextDocumentContentChangeEvent[] ContentChanges
+ {
+ get;
+ set;
+ }
+
+ TextDocumentIdentifier ITextDocumentParams.TextDocument
+ {
+ get => this.TextDocument;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DidChangeWatchedFilesParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DidChangeWatchedFilesParams.cs
new file mode 100644
index 0000000000000..75e21d2e8de99
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DidChangeWatchedFilesParams.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Diagnostics.CodeAnalysis;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents the parameter that is sent with workspace/didChangeWatchedFiles message.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DidChangeWatchedFilesParams
+ {
+ ///
+ /// Gets or sets of the collection of file change events.
+ ///
+ [DataMember(Name = "changes")]
+ public FileEvent[] Changes
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DidCloseTextDocumentParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DidCloseTextDocumentParams.cs
new file mode 100644
index 0000000000000..f2e1dccc784a4
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DidCloseTextDocumentParams.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents the parameter that is sent with textDocument/didClose message.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DidCloseTextDocumentParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the text document identifier.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DidOpenTextDocumentParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DidOpenTextDocumentParams.cs
new file mode 100644
index 0000000000000..2d32742a3c94f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DidOpenTextDocumentParams.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents the parameter that is sent with textDocument/didOpen message.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DidOpenTextDocumentParams
+ {
+ ///
+ /// Gets or sets the which represents the text document that was opened.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentItem TextDocument
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DidSaveTextDocumentParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DidSaveTextDocumentParams.cs
new file mode 100644
index 0000000000000..aab858ce354e8
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DidSaveTextDocumentParams.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents the parameter that is sent with a textDocument/didSave message.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DidSaveTextDocumentParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the which represents the text document that was saved.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the which represents the content of the text document when it was saved.
+ ///
+ [DataMember(Name = "text")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Text
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentColorOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentColorOptions.cs
new file mode 100644
index 0000000000000..c3c1097998f71
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentColorOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents workspace symbols capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentColorOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentColorParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentColorParams.cs
new file mode 100644
index 0000000000000..7f364f077b7cb
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentColorParams.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the parameters sent for a textDocument/documentColor request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentColorParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the to provide links for.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentDiagnosticParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentDiagnosticParams.cs
new file mode 100644
index 0000000000000..55cd0c4f38eb7
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentDiagnosticParams.cs
@@ -0,0 +1,65 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+
+///
+/// Class representing the document diagnostic request parameters
+///
+/// See the Language Server Protocol specification for additional information.
+///
+[DataContract]
+internal class DocumentDiagnosticParams : ITextDocumentParams, IPartialResultParams>
+{
+ ///
+ /// Gets or sets the value of the Progress instance.
+ ///
+ ///
+ /// Note that the first literal send needs to be either the or
+ /// followed by n literals.
+ ///
+ [DataMember(Name = Methods.PartialResultTokenName, IsRequired = false)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public IProgress>? PartialResultToken
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the to provide diagnostics for.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the identifier for which the client is requesting diagnostics for.
+ ///
+ [DataMember(Name = "identifier")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Identifier
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the result id of a previous diagnostics response if provided.
+ ///
+ [DataMember(Name = "previousResultId")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? PreviousResultId
+ {
+ get;
+ set;
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentDiagnosticReportKind.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentDiagnosticReportKind.cs
new file mode 100644
index 0000000000000..30efcc8483aa7
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentDiagnosticReportKind.cs
@@ -0,0 +1,23 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+///
+/// Value representing the kind of the document diagnostic report.
+///
+/// See the Language Server Protocol specification for additional information.
+///
+internal static class DocumentDiagnosticReportKind
+{
+ ///
+ /// Kind representing a diagnostic report with a full set of problems.
+ ///
+ public const string Full = "full";
+
+ ///
+ /// Kind representing a diagnostic report indicating that the last returned report is still accurate.
+ ///
+ public const string Unchanged = "unchanged";
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentDiagnosticReportPartialResult.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentDiagnosticReportPartialResult.cs
new file mode 100644
index 0000000000000..936ad48f1dbde
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentDiagnosticReportPartialResult.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+
+///
+/// Class representing a partial document diagnostic report for a set of related documents.
+///
+/// See the Language Server Protocol specification for additional information.
+///
+[DataContract]
+internal class DocumentDiagnosticReportPartialResult
+{
+ ///
+ /// Gets or sets the map of related document diagnostic reports.
+ ///
+ [DataMember(Name = "relatedDocuments")]
+ public Dictionary> RelatedDocuments
+ {
+ get;
+ set;
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentFilter.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentFilter.cs
new file mode 100644
index 0000000000000..d06ad65ed2e9a
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentFilter.cs
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a filter over certain types of documents
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentFilter
+ {
+ ///
+ /// Gets or sets a language id for the filter (e.g. 'typescript').
+ ///
+ [DataMember(Name = "language")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Language
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a Uri scheme (e.g. 'file' or 'untitled').
+ ///
+ [DataMember(Name = "scheme")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Scheme
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a glob pattern (e.g. '*.cs').
+ ///
+ [DataMember(Name = "pattern")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Pattern
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentFormattingOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentFormattingOptions.cs
new file mode 100644
index 0000000000000..6428db78e15a3
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentFormattingOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the document formatting options for server capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentFormattingOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentFormattingParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentFormattingParams.cs
new file mode 100644
index 0000000000000..766dc19e1843e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentFormattingParams.cs
@@ -0,0 +1,37 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents the parameter that is sent with textDocument/formatting message.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentFormattingParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the identifier for the text document to be formatted.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the formatting options.
+ ///
+ [DataMember(Name = "options")]
+ public FormattingOptions Options
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlight.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlight.cs
new file mode 100644
index 0000000000000..692bc31ab9b6f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlight.cs
@@ -0,0 +1,44 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.ComponentModel;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the response from a textDocument/documentHighlight request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentHighlight
+ {
+ ///
+ /// Gets or sets the range that the highlight applies to.
+ ///
+ [DataMember(Name = "range")]
+ public Range Range
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the kind of highlight.
+ ///
+ [DataMember(Name = "kind")]
+ [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")]
+ [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1500:BracesForMultiLineStatementsShouldNotShareLine", Justification = "There are no issues with this code")]
+ [DefaultValue(DocumentHighlightKind.Text)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public DocumentHighlightKind Kind
+ {
+ get;
+ set;
+ } = DocumentHighlightKind.Text;
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlightKind.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlightKind.cs
new file mode 100644
index 0000000000000..60375fb94cb92
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlightKind.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Enum representing the different types of document highlight.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal enum DocumentHighlightKind
+ {
+ ///
+ /// A textual occurance.
+ ///
+ Text = 1,
+
+ ///
+ /// Read access of a symbol.
+ ///
+ Read = 2,
+
+ ///
+ /// Write access of a symbol.
+ ///
+ Write = 3,
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlightOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlightOptions.cs
new file mode 100644
index 0000000000000..a964e6d79e7fe
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlightOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents workspace symbols capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentHighlightOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlightParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlightParams.cs
new file mode 100644
index 0000000000000..65107dad7c797
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentHighlightParams.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the parameters sent for a textDocument/documentHighlight request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ internal class DocumentHighlightParams
+ : TextDocumentPositionParams,
+ IPartialResultParams
+ {
+ ///
+ /// Gets or sets the value of the PartialResultToken instance.
+ ///
+ [DataMember(Name = "partialResultToken")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public IProgress? PartialResultToken
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentLink.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentLink.cs
new file mode 100644
index 0000000000000..91e3d65073174
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentLink.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the response of a textDocument/documentLink request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentLink
+ {
+ ///
+ /// Gets or sets the range the link applies to.
+ ///
+ [DataMember(Name = "range")]
+ public Range Range
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the uri that the link points to.
+ ///
+ [DataMember(Name = "target")]
+ [JsonConverter(typeof(DocumentUriConverter))]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Uri? Target
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentLinkOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentLinkOptions.cs
new file mode 100644
index 0000000000000..f2334f4ffe47a
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentLinkOptions.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the document link options for server capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentLinkOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether or not the server supports resolve providers.
+ ///
+ [DataMember(Name = "resolveProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool ResolveProvider
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentLinkParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentLinkParams.cs
new file mode 100644
index 0000000000000..58aaf921ffbc4
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentLinkParams.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the parameters sent for a textDocument/documentLink request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentLinkParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the to provide links for.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentOnTypeFormattingOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentOnTypeFormattingOptions.cs
new file mode 100644
index 0000000000000..c358c3dc1b7be
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentOnTypeFormattingOptions.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the options for on type formatting.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentOnTypeFormattingOptions
+ {
+ ///
+ /// Gets or sets the first trigger character.
+ ///
+ [DataMember(Name = "firstTriggerCharacter")]
+ public string FirstTriggerCharacter
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets additional trigger characters.
+ ///
+ [DataMember(Name = "moreTriggerCharacter")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string[]? MoreTriggerCharacter
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentOnTypeFormattingParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentOnTypeFormattingParams.cs
new file mode 100644
index 0000000000000..eda0db4a326e2
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentOnTypeFormattingParams.cs
@@ -0,0 +1,37 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the parameters sent for a textDocument/onTypeFormatting request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentOnTypeFormattingParams : TextDocumentPositionParams
+ {
+ ///
+ /// Gets or sets the character that was typed.
+ ///
+ [DataMember(Name = "ch")]
+ public string Character
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the for the request.
+ ///
+ [DataMember(Name = "options")]
+ public FormattingOptions Options
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentRangeFormattingOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentRangeFormattingOptions.cs
new file mode 100644
index 0000000000000..29f53cf25852f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentRangeFormattingOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the document range formatting options for server capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentRangeFormattingOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentRangeFormattingParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentRangeFormattingParams.cs
new file mode 100644
index 0000000000000..103881f93ef17
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentRangeFormattingParams.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents the parameter that is sent with textDocument/rangeFormatting message.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentRangeFormattingParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the identifier for the text document to be formatted.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the selection range to be formatted.
+ ///
+ [DataMember(Name = "range")]
+ public Range Range
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the formatting options.
+ ///
+ [DataMember(Name = "options")]
+ public FormattingOptions Options
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbol.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbol.cs
new file mode 100644
index 0000000000000..bb1f719958c7b
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbol.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be
+ /// hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range,
+ /// e.g. the range of an identifier.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentSymbol
+ {
+ ///
+ /// Gets or sets the name of this symbol.
+ ///
+ [DataMember(IsRequired = true, Name = "name")]
+ public string Name
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets more detail for this symbol, e.g the signature of a function.
+ ///
+ [DataMember(Name = "detail")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Detail
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the of this symbol.
+ ///
+ [DataMember(Name = "kind")]
+ public SymbolKind Kind
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether this symbol is deprecated.
+ ///
+ [DataMember(Name = "deprecated")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool Deprecated
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the range enclosing this symbol not including leading/trailing whitespace but everything else
+ /// like comments.This information is typically used to determine if the clients cursor is
+ /// inside the symbol to reveal in the symbol in the UI.
+ ///
+ [DataMember(IsRequired = true, Name = "range")]
+ public Range Range
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
+ /// Must be contained by the `range`.
+ ///
+ [DataMember(IsRequired = true, Name = "selectionRange")]
+ public Range SelectionRange
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the children of this symbol, e.g. properties of a class.
+ ///
+ [DataMember(Name = "children")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public DocumentSymbol[]? Children
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbolOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbolOptions.cs
new file mode 100644
index 0000000000000..d12b5f9552b1e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbolOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents workspace symbols capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentSymbolOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbolParams.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbolParams.cs
new file mode 100644
index 0000000000000..3ba1eaa41230b
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbolParams.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents the parameter sent with textDocument/documentSymbol requests.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentSymbolParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the text document.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbolSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbolSetting.cs
new file mode 100644
index 0000000000000..f1df03c9304ef
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DocumentSymbolSetting.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the initialization setting for document symbols.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class DocumentSymbolSetting : DynamicRegistrationSetting
+ {
+ ///
+ /// Gets or sets the capabilities.
+ ///
+ [DataMember(Name = "symbolKind")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public SymbolKindSetting? SymbolKind
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the document has hierarchical symbol support.
+ ///
+ [DataMember(Name = "hierarchicalDocumentSymbolSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool HierarchicalDocumentSymbolSupport
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/DynamicRegistrationSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/DynamicRegistrationSetting.cs
new file mode 100644
index 0000000000000..095b552f61176
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/DynamicRegistrationSetting.cs
@@ -0,0 +1,43 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents a setting that can be dynamically registered.
+ ///
+ [DataContract]
+ internal class DynamicRegistrationSetting
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public DynamicRegistrationSetting()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Value indicating whether the setting can be dynamically registered.
+ public DynamicRegistrationSetting(bool value)
+ {
+ this.DynamicRegistration = value;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether setting can be dynamically registered.
+ ///
+ [DataMember(Name = "dynamicRegistration")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool DynamicRegistration
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ExecuteCommandOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/ExecuteCommandOptions.cs
new file mode 100644
index 0000000000000..ef7afc7431db0
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ExecuteCommandOptions.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the options for execute command support.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class ExecuteCommandOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets the commands that are to be executed on the server.
+ ///
+ [DataMember(Name = "commands")]
+ public string[] Commands
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ExecuteCommandParams.cs b/src/Features/LanguageServer/Protocol/Protocol/ExecuteCommandParams.cs
new file mode 100644
index 0000000000000..d9c934063e7ba
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ExecuteCommandParams.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the parameters sent from client to server for the workspace/executeCommand request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class ExecuteCommandParams
+ {
+ ///
+ /// Gets or sets the command identifier associated with the command handler.
+ ///
+ [DataMember(Name = "command")]
+ public string Command
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the arguments that the command should be invoked with.
+ ///
+ [DataMember(Name = "arguments")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object[]? Arguments
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/Converters/VSExtensionConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/Converters/VSExtensionConverter.cs
new file mode 100644
index 0000000000000..70f3ed31e8acb
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/Converters/VSExtensionConverter.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using Newtonsoft.Json;
+
+ ///
+ /// Converter used to serialize and deserialize classes extending types defined in the
+ /// Microsoft.VisualStudio.LanguageServer.Protocol package.
+ ///
+ /// Base class that is specified in the
+ /// Microsoft.VisualStudio.LanguageServer.Protocol package.
+ /// Extension class that extends TBase.
+ internal class VSExtensionConverter : JsonConverter
+ where TExtension : TBase
+ {
+ ///
+ public override bool CanWrite => false;
+
+ ///
+ public override bool CanConvert(Type objectType)
+ {
+ return objectType == typeof(TBase);
+ }
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ return serializer.Deserialize(reader);
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/Converters/VSExtensionUtilities.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/Converters/VSExtensionUtilities.cs
new file mode 100644
index 0000000000000..51ce11b3bf2bc
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/Converters/VSExtensionUtilities.cs
@@ -0,0 +1,57 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using Newtonsoft.Json;
+
+ ///
+ /// Utility functions to simplify working with the Visual Studio extensions to the Language Server Protocol.
+ ///
+ internal static class VSExtensionUtilities
+ {
+ ///
+ /// Adds to the allowing to
+ /// deserialize the JSON stream into objects which include Visual Studio specific extensions.
+ ///
+ /// For example, it allows to correctly deserialize the entries of a
+ /// 'codeAction/resolve' request into objects even if
+ /// is defined as an array of .
+ ///
+ ///
+ /// If is used in parallel to the execution of this method,
+ /// its access needs to be synchronized with this method call, to guarantee that the
+ /// collection is not modified when is in use.
+ ///
+ /// Instance of to be configured.
+ public static void AddVSExtensionConverters(this JsonSerializer serializer)
+ {
+ // Reading the number of converters before we start adding new ones
+ var existingConvertersCount = serializer.Converters.Count;
+
+ TryAddConverter();
+ TryAddConverter();
+ TryAddConverter();
+ TryAddConverter();
+ TryAddConverter();
+
+ void TryAddConverter()
+ where TExtension : TBase
+ {
+ for (var i = 0; i < existingConvertersCount; i++)
+ {
+ var existingConverterType = serializer.Converters[i].GetType();
+ if (existingConverterType.IsGenericType &&
+ existingConverterType.GetGenericTypeDefinition() == typeof(VSExtensionConverter<,>) &&
+ existingConverterType.GenericTypeArguments[0] == typeof(TBase))
+ {
+ return;
+ }
+ }
+
+ serializer.Converters.Add(new VSExtensionConverter());
+ }
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnostic.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnostic.cs
new file mode 100644
index 0000000000000..4ac6e47c0a682
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnostic.cs
@@ -0,0 +1,68 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// extends providing additional properties used by Visual Studio.
+ ///
+ [DataContract]
+ internal class VSDiagnostic : Diagnostic
+ {
+ ///
+ /// Gets or sets the project and context (e.g. Win32, MacOS, etc.) in which the diagnostic was generated.
+ ///
+ [DataMember(Name = "_vs_projects")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSDiagnosticProjectInformation[]? Projects { get; set; }
+
+ ///
+ /// Gets or sets an expanded description of the diagnostic.
+ ///
+ [DataMember(Name = "_vs_expandedMessage")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? ExpandedMessage { get; set; }
+
+ ///
+ /// Gets or sets a message shown when the user hovers over an error. If , then
+ /// is used (use to prevent a tool tip from being shown).
+ ///
+ [DataMember(Name = "_vs_toolTip")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? ToolTip { get; set; }
+
+ ///
+ /// Gets or sets a non-human-readable identier allowing consolidation of multiple equivalent diagnostics
+ /// (e.g. the same syntax error from builds targeting different platforms).
+ ///
+ [DataMember(Name = "_vs_identifier")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Identifier { get; set; }
+
+ ///
+ /// Gets or sets a string describing the diagnostic types (e.g. Security, Performance, Style, etc.).
+ ///
+ [DataMember(Name = "_vs_diagnosticType")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? DiagnosticType { get; set; }
+
+ ///
+ /// Gets or sets a rank associated with this diagnostic, used for the default sort.
+ /// will be used if no rank is specified.
+ ///
+ [DataMember(Name = "_vs_diagnosticRank")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSDiagnosticRank? DiagnosticRank { get; set; }
+
+ ///
+ /// Gets or sets an ID used to associate this diagnostic with a corresponding line in the output window.
+ ///
+ [DataMember(Name = "_vs_outputId")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public int? OutputId { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnosticProjectInformation.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnosticProjectInformation.cs
new file mode 100644
index 0000000000000..c2a84f512d6eb
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnosticProjectInformation.cs
@@ -0,0 +1,38 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// represents the project and context in which the is generated.
+ ///
+ [DataContract]
+ internal class VSDiagnosticProjectInformation
+ {
+ ///
+ /// Gets or sets a human-readable identifier for the project in which the diagnostic was generated.
+ ///
+ [DataMember(Name = "_vs_projectName")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? ProjectName { get; set; }
+
+ ///
+ /// Gets or sets a human-readable identifier for the build context (e.g. Win32 or MacOS)
+ /// in which the diagnostic was generated.
+ ///
+ [DataMember(Name = "_vs_context")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Context { get; set; }
+
+ ///
+ /// Gets or sets the unique identifier for the project in which the diagnostic was generated.
+ ///
+ [DataMember(Name = "_vs_projectIdentifier")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? ProjectIdentifier { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnosticRank.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnosticRank.cs
new file mode 100644
index 0000000000000..5aab9983aa9ae
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnosticRank.cs
@@ -0,0 +1,37 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// represents the rank of a object.
+ ///
+ internal enum VSDiagnosticRank
+ {
+ ///
+ /// Highest priority.
+ ///
+ Highest = 100,
+
+ ///
+ /// High priority.
+ ///
+ High = 200,
+
+ ///
+ /// Default priority.
+ ///
+ Default = 300,
+
+ ///
+ /// Low priority.
+ ///
+ Low = 400,
+
+ ///
+ /// Lowest priority.
+ ///
+ Lowest = 500,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnosticTags.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnosticTags.cs
new file mode 100644
index 0000000000000..a5a54652689ff
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSDiagnosticTags.cs
@@ -0,0 +1,63 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Additional values that are specific to Visual Studio.
+ ///
+ internal static class VSDiagnosticTags
+ {
+ ///
+ /// A entry generated by the build.
+ ///
+ public const DiagnosticTag BuildError = (DiagnosticTag)(-1);
+
+ ///
+ /// A entry generated by Intellisense.
+ ///
+ public const DiagnosticTag IntellisenseError = (DiagnosticTag)(-2);
+
+ ///
+ /// A entry that could be generated from both builds
+ /// and Intellisense.
+ ///
+ /// entries tagged with will be hidden
+ /// in the error list if the error list is displaying build and intellisense
+ /// errors.
+ ///
+ public const DiagnosticTag PotentialDuplicate = (DiagnosticTag)(-3);
+
+ ///
+ /// A entry is never displayed in the error list.
+ ///
+ public const DiagnosticTag HiddenInErrorList = (DiagnosticTag)(-4);
+
+ ///
+ /// The entry is always displayed in the error list.
+ ///
+ public const DiagnosticTag VisibleInErrorList = (DiagnosticTag)(-5);
+
+ ///
+ /// The entry is never displayed in the editor.
+ ///
+ public const DiagnosticTag HiddenInEditor = (DiagnosticTag)(-6);
+
+ ///
+ /// No tooltip is shown for the entry in the editor.
+ ///
+ public const DiagnosticTag SuppressEditorToolTip = (DiagnosticTag)(-7);
+
+ ///
+ /// The entry is represented in the Editor as an Edit
+ /// and Continue error.
+ ///
+ public const DiagnosticTag EditAndContinueError = (DiagnosticTag)(-8);
+
+ ///
+ /// A entry is represented in the Editor as a Task List item in the TODO list.
+ ///
+ public const DiagnosticTag TaskItem = (DiagnosticTag)(-9);
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSGetProjectContextsParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSGetProjectContextsParams.cs
new file mode 100644
index 0000000000000..f02ebbc2bf112
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSGetProjectContextsParams.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// represents the parameter that is sent
+ /// with the 'textDocument/_vs_getProjectContexts' request.
+ ///
+ [DataContract]
+ internal class VSGetProjectContextsParams
+ {
+ ///
+ /// Gets or sets the document for which project contexts are queried.
+ ///
+ [DataMember(Name = "_vs_textDocument")]
+ public TextDocumentItem TextDocument
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSImageId.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSImageId.cs
new file mode 100644
index 0000000000000..ed16c06838842
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSImageId.cs
@@ -0,0 +1,62 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ ///
+ /// represents the unique identifier for a Visual Studio image asset.
+ /// The identified is composed by a and an integer.
+ /// A list of valid image ids can be retrieved from the KnownMonikers class
+ /// from the Visual Studio SDK.
+ ///
+ [DataContract]
+ internal class VSImageId : IEquatable
+ {
+ ///
+ /// Gets or sets the component of the unique identifier.
+ ///
+ [DataMember(Name = "_vs_guid")]
+ public Guid Guid
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the integer component of the unique identifier.
+ ///
+ [DataMember(Name = "_vs_id")]
+ public int Id
+ {
+ get;
+ set;
+ }
+
+ ///
+ public override bool Equals(object obj)
+ {
+ return this.Equals(obj as VSImageId);
+ }
+
+ ///
+ public bool Equals(VSImageId? other)
+ {
+ return other != null &&
+ this.Guid == other.Guid &&
+ this.Id == other.Id;
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ var hashCode = 184147724;
+ hashCode = (hashCode * -1521134295) + this.Guid.GetHashCode();
+ hashCode = (hashCode * -1521134295) + this.Id.GetHashCode();
+ return hashCode;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSLocation.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSLocation.cs
new file mode 100644
index 0000000000000..a34ea77a25296
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSLocation.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// extends providing additional properties used by Visual Studio.
+ ///
+ [DataContract]
+ internal class VSLocation : Location
+ {
+ ///
+ /// Gets or sets the project name to be displayed to user.
+ ///
+ [DataMember(Name = "_vs_projectName")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? ProjectName { get; set; }
+
+ ///
+ /// Gets or sets the text value for the display path.
+ /// In case the actual path on disk would be confusing for users, this should be a friendly display name.
+ /// This doesn't have to correspond to a real file path, but must be parsable by the method.
+ ///
+ [DataMember(Name = "_vs_displayPath")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? DisplayPath { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSMethods.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSMethods.cs
new file mode 100644
index 0000000000000..e2d186472f733
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSMethods.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// contains the string values for all Language Server Protocol Visual Studio specific methods.
+ ///
+ internal static class VSMethods
+ {
+ ///
+ /// Method name for 'textDocument/_vs_getProjectContexts'.
+ /// The 'textDocument/_vs_getProjectContexts' request is sent from the client to the server to query
+ /// the list of project context associated with a document.
+ /// This method has a parameter of type and a return value of type
+ /// .
+ /// In order to enable the client to send the 'textDocument/_vs_getProjectContexts' requests, the server must
+ /// set the property.
+ ///
+ public const string GetProjectContextsName = "textDocument/_vs_getProjectContexts";
+
+ ///
+ /// Strongly typed request object for 'textDocument/_vs_getProjectContexts'.
+ ///
+ public static readonly LspRequest GetProjectContexts = new LspRequest(GetProjectContextsName);
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSProjectContext.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSProjectContext.cs
new file mode 100644
index 0000000000000..de37989753381
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSProjectContext.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ ///
+ /// represents a project context.
+ ///
+ [DataContract]
+ internal class VSProjectContext : IEquatable
+ {
+ ///
+ /// Gets or sets the label for the project context.
+ ///
+ [DataMember(Name = "_vs_label", IsRequired = true)]
+ public string Label
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the unique identifier of the project context.
+ ///
+ [DataMember(Name = "_vs_id", IsRequired = true)]
+ public string Id
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the context kind of the project context which is used to determine its associated icon.
+ ///
+ [DataMember(Name = "_vs_kind")]
+ public VSProjectKind Kind
+ {
+ get;
+ set;
+ }
+
+ public static bool operator ==(VSProjectContext? value1, VSProjectContext? value2)
+ {
+ if (ReferenceEquals(value1, value2))
+ {
+ return true;
+ }
+
+ // Is null?
+ if (value2 is null)
+ {
+ return false;
+ }
+
+ return value1?.Equals(value2) ?? false;
+ }
+
+ public static bool operator !=(VSProjectContext? value1, VSProjectContext? value2)
+ {
+ return !(value1 == value2);
+ }
+
+ ///
+ public virtual bool Equals(VSProjectContext other)
+ {
+ return string.Equals(this.Label, other.Label, StringComparison.Ordinal)
+ && string.Equals(this.Id, other.Id, StringComparison.Ordinal)
+ && this.Kind == other.Kind;
+ }
+
+ ///
+ public override bool Equals(object obj)
+ {
+ if (obj is VSProjectContext other)
+ {
+ return this.Equals(other);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ return (this.Label == null ? 53 : this.Label.GetHashCode() * 13)
+ ^ (this.Id == null ? 61 : this.Id.GetHashCode() * 17)
+ ^ ((int)this.Kind * 19);
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSProjectContextList.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSProjectContextList.cs
new file mode 100644
index 0000000000000..4c1ee69a0bbff
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSProjectContextList.cs
@@ -0,0 +1,36 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// represents the response to the
+ /// 'textDocument/_vs_getProjectContexts' request.
+ ///
+ [DataContract]
+ internal class VSProjectContextList
+ {
+ ///
+ /// Gets or sets the document contexts associated with a text document.
+ ///
+ [DataMember(Name = "_vs_projectContexts")]
+ public VSProjectContext[] ProjectContexts
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the index of the default entry of the array.
+ ///
+ [DataMember(Name = "_vs_defaultIndex")]
+ public int DefaultIndex
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSProjectKind.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSProjectKind.cs
new file mode 100644
index 0000000000000..6a541c5bce361
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSProjectKind.cs
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// represents the various kinds of contexts.
+ ///
+ [DataContract]
+ internal enum VSProjectKind
+ {
+ ///
+ /// C++ project.
+ ///
+ CPlusPlus = 1,
+
+ ///
+ /// C# project.
+ ///
+ CSharp = 2,
+
+ ///
+ /// Visual Basic project.
+ ///
+ VisualBasic = 3,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSServerCapabilities.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSServerCapabilities.cs
new file mode 100644
index 0000000000000..6985e61b5ba06
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSServerCapabilities.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// extends allowing to provide
+ /// additional capabilities supported by Visual Studio.
+ ///
+ [DataContract]
+ internal class VSServerCapabilities : ServerCapabilities
+ {
+ ///
+ /// Gets or sets a value indicating whether the server supports the
+ /// 'textDocument/_vs_getProjectContexts' request.
+ ///
+ [DataMember(Name = "_vs_projectContextProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool ProjectContextProvider
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSSymbolInformation.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSSymbolInformation.cs
new file mode 100644
index 0000000000000..62b8b120be35e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSSymbolInformation.cs
@@ -0,0 +1,37 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// extends providing additional properties used by Visual Studio.
+ ///
+ [DataContract]
+ internal class VSSymbolInformation : SymbolInformation
+ {
+ ///
+ /// Gets or sets the icon associated with the symbol. If specified, this icon is used instead of .
+ ///
+ [DataMember(Name = "_vs_icon")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSImageId? Icon { get; set; }
+
+ ///
+ /// Gets or sets the description of the symbol.
+ ///
+ [DataMember(Name = "_vs_description")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Description { get; set; }
+
+ ///
+ /// Gets or sets the hint text for the symbol.
+ ///
+ [DataMember(Name = "_vs_hintText")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? HintText { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSTextDocumentIdentifier.cs b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSTextDocumentIdentifier.cs
new file mode 100644
index 0000000000000..2cffba1c8d1d8
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Extensions/VSTextDocumentIdentifier.cs
@@ -0,0 +1,88 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// extends providing additional properties used by Visual Studio.
+ ///
+ [DataContract]
+ internal class VSTextDocumentIdentifier : TextDocumentIdentifier, IEquatable
+ {
+ ///
+ /// Gets or sets the project context of the text document.
+ ///
+ [DataMember(Name = "_vs_projectContext")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSProjectContext? ProjectContext
+ {
+ get;
+ set;
+ }
+
+ public static bool operator ==(VSTextDocumentIdentifier? value1, VSTextDocumentIdentifier? value2)
+ {
+ if (ReferenceEquals(value1, value2))
+ {
+ return true;
+ }
+
+ // Is null?
+ if (ReferenceEquals(null, value2))
+ {
+ return false;
+ }
+
+ return value1?.Equals(value2) ?? false;
+ }
+
+ public static bool operator !=(VSTextDocumentIdentifier? value1, VSTextDocumentIdentifier? value2)
+ {
+ return !(value1 == value2);
+ }
+
+ ///
+ public bool Equals(VSTextDocumentIdentifier other)
+ {
+ return this.ProjectContext == other.ProjectContext
+ && base.Equals(other);
+ }
+
+ ///
+ public override bool Equals(object obj)
+ {
+ if (obj is VSTextDocumentIdentifier other)
+ {
+ return this.Equals(other);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ return this.ProjectContext == null ? 89 : this.ProjectContext.GetHashCode()
+ ^ (base.GetHashCode() * 79);
+ }
+
+ ///
+ public override string ToString()
+ {
+ var result = base.ToString();
+ if (this.ProjectContext != null)
+ {
+ result += "|" + this.ProjectContext.Label + "|" + this.ProjectContext.Id;
+ }
+
+ return result;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/FileChangeType.cs b/src/Features/LanguageServer/Protocol/Protocol/FileChangeType.cs
new file mode 100644
index 0000000000000..e09e40a3478b2
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/FileChangeType.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// File event type enum.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ internal enum FileChangeType
+ {
+ ///
+ /// File was created.
+ ///
+ Created = 1,
+
+ ///
+ /// File was changed.
+ ///
+ Changed = 2,
+
+ ///
+ /// File was deleted.
+ ///
+ Deleted = 3,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/FileEvent.cs b/src/Features/LanguageServer/Protocol/Protocol/FileEvent.cs
new file mode 100644
index 0000000000000..7d437e7bd1acb
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/FileEvent.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents a file change event.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class FileEvent
+ {
+ ///
+ /// Gets or sets the URI of the file.
+ ///
+ [DataMember(Name = "uri")]
+ [JsonConverter(typeof(DocumentUriConverter))]
+ public Uri Uri
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the file change type.
+ ///
+ [DataMember(Name = "type")]
+ public FileChangeType FileChangeType
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/FoldingRange.cs b/src/Features/LanguageServer/Protocol/Protocol/FoldingRange.cs
new file mode 100644
index 0000000000000..a45d49f3f9d5f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/FoldingRange.cs
@@ -0,0 +1,82 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a folding range in a document.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class FoldingRange
+ {
+ ///
+ /// Gets or sets the start line value.
+ ///
+ [DataMember(Name = "startLine")]
+ public int StartLine
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the start character value.
+ ///
+ [DataMember(Name = "startCharacter")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public int? StartCharacter
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the end line value.
+ ///
+ [DataMember(Name = "endLine")]
+ public int EndLine
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the end character value.
+ ///
+ [DataMember(Name = "endCharacter")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public int? EndCharacter
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the folding range kind.
+ ///
+ [DataMember(Name = "kind")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public FoldingRangeKind? Kind
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the collapsedText.
+ ///
+ [DataMember(Name = "collapsedText")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? CollapsedText
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeKind.cs b/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeKind.cs
new file mode 100644
index 0000000000000..05e12df4907f0
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeKind.cs
@@ -0,0 +1,36 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.ComponentModel;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Value representing various code action kinds.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ [JsonConverter(typeof(StringEnumConverter))]
+ [TypeConverter(typeof(StringEnumConverter.TypeConverter))]
+ internal readonly record struct FoldingRangeKind(string Value) : IStringEnum
+ {
+ ///
+ /// Comment folding range.
+ ///
+ public static readonly FoldingRangeKind Comment = new("comment");
+
+ ///
+ /// Imports folding range.
+ ///
+ public static readonly FoldingRangeKind Imports = new("imports");
+
+ ///
+ /// Region folding range.
+ ///
+ public static readonly FoldingRangeKind Region = new("region");
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeOptions.cs
new file mode 100644
index 0000000000000..61b531332810d
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the folding range provider options for initialization.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class FoldingRangeOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeParams.cs b/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeParams.cs
new file mode 100644
index 0000000000000..ac57b23d4f24c
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeParams.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the folding range request parameter.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class FoldingRangeParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the text document associated with the folding range request.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeSetting.cs
new file mode 100644
index 0000000000000..f4c10c48e1f26
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeSetting.cs
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the folding range setting for initialization.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class FoldingRangeSetting : DynamicRegistrationSetting
+ {
+ ///
+ /// Gets or sets the range limit for folding ranges.
+ ///
+ [DataMember(Name = "rangeLimit")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public int? RangeLimit
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether if client only supports entire line folding only.
+ ///
+ [DataMember(Name = "lineFoldingOnly")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool LineFoldingOnly
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating the specific options for the folding range.
+ ///
+ [DataMember(Name = "foldingRange")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public FoldingRangeSettingOptions? FoldingRange
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeSettingOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeSettingOptions.cs
new file mode 100644
index 0000000000000..f1a1fe75e4584
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/FoldingRangeSettingOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the specific options for the folding range.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class FoldingRangeSettingOptions : DynamicRegistrationSetting
+ {
+ ///
+ /// Gets or sets a value indicating whether if client supports collapsedText on folding ranges.
+ ///
+ [DataMember(Name = "collapsedText")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool CollapsedText
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/FormattingOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/FormattingOptions.cs
new file mode 100644
index 0000000000000..e1787620e30f5
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/FormattingOptions.cs
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents formatting options.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class FormattingOptions
+ {
+ ///
+ /// Gets or sets the number of spaces to be inserted per tab.
+ ///
+ [DataMember(Name = "tabSize")]
+ public int TabSize
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether tabs should be spaces.
+ ///
+ [DataMember(Name = "insertSpaces")]
+ public bool InsertSpaces
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the other potential formatting options.
+ ///
+ [JsonExtensionData]
+ public Dictionary? OtherOptions
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/FullDocumentDiagnosticReport.cs b/src/Features/LanguageServer/Protocol/Protocol/FullDocumentDiagnosticReport.cs
new file mode 100644
index 0000000000000..ab55018017cb3
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/FullDocumentDiagnosticReport.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+
+///
+/// Class representing a diagnostic report with a full set of problems.
+///
+/// See the Language Server Protocol specification for additional information.
+///
+[DataContract]
+[Kind(DocumentDiagnosticReportKind.Full)]
+internal class FullDocumentDiagnosticReport
+{
+ ///
+ /// Gets the kind of this report.
+ ///
+ [DataMember(Name = "kind")]
+#pragma warning disable CA1822 // Mark members as static
+ public string Kind => DocumentDiagnosticReportKind.Full;
+#pragma warning restore CA1822 // Mark members as static
+
+ ///
+ /// Gets or sets the optional result id.
+ ///
+ [DataMember(Name = "resultId")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? ResultId
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the diagnostics in this report.
+ ///
+ [DataMember(Name = "items")]
+ public Diagnostic[] Items
+ {
+ get;
+ set;
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Hover.cs b/src/Features/LanguageServer/Protocol/Protocol/Hover.cs
new file mode 100644
index 0000000000000..339ca873bcc6d
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Hover.cs
@@ -0,0 +1,42 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the data returned by a textDocument/hover request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class Hover
+ {
+ ///
+ /// Gets or sets the content for the hover. Object can either be an array or a single object.
+ /// If the object is an array the array can contain objects of type and .
+ /// If the object is not an array it can be of type , , or .
+ ///
+ // This is nullable because in VS we allow null when VSInternalHover.RawContent is specified instead of Contents
+ [DataMember(Name = "contents")]
+ public SumType[], MarkupContent>? Contents
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the range over which the hover applies.
+ ///
+ [DataMember(Name = "range")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Range? Range
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/HoverOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/HoverOptions.cs
new file mode 100644
index 0000000000000..a34a473e58952
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/HoverOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents the server hover support.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class HoverOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/HoverSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/HoverSetting.cs
new file mode 100644
index 0000000000000..f1d195fb0a6d8
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/HoverSetting.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents the initialization setting for hover.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class HoverSetting : DynamicRegistrationSetting
+ {
+ ///
+ /// Gets or sets the values supported.
+ ///
+ [DataMember(Name = "contentFormat")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public MarkupKind[]? ContentFormat
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/IPartialResultParams.cs b/src/Features/LanguageServer/Protocol/Protocol/IPartialResultParams.cs
new file mode 100644
index 0000000000000..194dc57dc96cc
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/IPartialResultParams.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+
+ ///
+ /// Interface to describe parameters for requests that support streaming results.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ /// The type to be reported by .
+ internal interface IPartialResultParams
+ {
+ ///
+ /// Gets or sets the value of the PartialResultToken instance.
+ ///
+ public IProgress? PartialResultToken
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/IStaticRegistrationOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/IStaticRegistrationOptions.cs
new file mode 100644
index 0000000000000..52fab2aad3cbd
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/IStaticRegistrationOptions.cs
@@ -0,0 +1,18 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+///
+/// Interface representing the static registration options for options returned in the initialize request.
+///
+/// See the Language Server Protocol specification for additional information.
+///
+internal interface IStaticRegistrationOptions
+{
+ ///
+ /// Gets or sets the id used to register the request. The id can be used to deregister the request again.
+ ///
+ public string? Id { get; set; }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/IStringEnum.cs b/src/Features/LanguageServer/Protocol/Protocol/IStringEnum.cs
new file mode 100644
index 0000000000000..e08acb1c3008d
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/IStringEnum.cs
@@ -0,0 +1,21 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+///
+/// Interface that describes a string-based enumeration.
+/// String-based enumerations are serialized simply as their .
+///
+///
+/// When implementing this interface, a constructor that takes a single string as parameters is required by
+/// .
+///
+internal interface IStringEnum
+{
+ ///
+ /// Gets the value of the enumeration.
+ ///
+ string Value { get; }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ISumType.cs b/src/Features/LanguageServer/Protocol/Protocol/ISumType.cs
new file mode 100644
index 0000000000000..97dd2e33487c3
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ISumType.cs
@@ -0,0 +1,19 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Abstracts over the idea of a "sum type". Sum types are types that can contain one value of various types.
+ /// This abstraction is guaranteed to be typesafe, meaning you cannot access the underlying value without knowing
+ /// its specific type.
+ ///
+ internal interface ISumType
+ {
+ ///
+ /// Gets the value stored in the SumType. This can be matched against using the "is" operator.
+ ///
+ object? Value { get; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ITextDocumentParams.cs b/src/Features/LanguageServer/Protocol/Protocol/ITextDocumentParams.cs
new file mode 100644
index 0000000000000..4fa13027b0903
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ITextDocumentParams.cs
@@ -0,0 +1,20 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Interface to identify a text document.
+ ///
+ internal interface ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the value which identifies the document.
+ ///
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ITextDocumentPositionParams.cs b/src/Features/LanguageServer/Protocol/Protocol/ITextDocumentPositionParams.cs
new file mode 100644
index 0000000000000..22901df807aa9
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ITextDocumentPositionParams.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Interface to identify a text document and a position inside that document.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ internal interface ITextDocumentPositionParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the value which identifies the document.
+ ///
+ public new TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the value which indicates the position within the document.
+ ///
+ public Position Position
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ITextDocumentRegistrationOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/ITextDocumentRegistrationOptions.cs
new file mode 100644
index 0000000000000..b919469dfb16f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ITextDocumentRegistrationOptions.cs
@@ -0,0 +1,18 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+///
+/// Interface representing the text document registration options.
+///
+/// See the Language Server Protocol specification for additional information.
+///
+internal interface ITextDocumentRegistrationOptions
+{
+ ///
+ /// Gets or sets the document filters for this registration option.
+ ///
+ public DocumentFilter[]? DocumentSelector { get; set; }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/IWorkDoneProgressOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/IWorkDoneProgressOptions.cs
new file mode 100644
index 0000000000000..d522a0fd552ef
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/IWorkDoneProgressOptions.cs
@@ -0,0 +1,23 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Options to signal work done progress support in server capabilities.
+ ///
+ internal interface IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/ImplementationOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/ImplementationOptions.cs
new file mode 100644
index 0000000000000..e158e93bd7b75
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/ImplementationOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents workspace symbols capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class ImplementationOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InitializeError.cs b/src/Features/LanguageServer/Protocol/Protocol/InitializeError.cs
new file mode 100644
index 0000000000000..756906f6d62c7
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InitializeError.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the error type sent when the initialize request fails.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InitializeError
+ {
+ ///
+ /// Gets or sets a value indicating whether or not to retry.
+ ///
+ [DataMember(Name = "retry")]
+ public bool Retry
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InitializeErrorCode.cs b/src/Features/LanguageServer/Protocol/Protocol/InitializeErrorCode.cs
new file mode 100644
index 0000000000000..3f412b17040a5
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InitializeErrorCode.cs
@@ -0,0 +1,22 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Enum representing the possible reasons for an initialization error.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal enum InitializeErrorCode
+ {
+ ///
+ /// Protocol version can't be handled by the server.
+ ///
+ UnknownProtocolVersion = 1,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InitializeParams.cs b/src/Features/LanguageServer/Protocol/Protocol/InitializeParams.cs
new file mode 100644
index 0000000000000..a3f76104ae979
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InitializeParams.cs
@@ -0,0 +1,108 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.ComponentModel;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents the parameter sent with an initialize method request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InitializeParams
+ {
+ ///
+ /// Gets or sets the ID of the process which launched the language server.
+ ///
+ [DataMember(Name = "processId")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Include)]
+ public int? ProcessId
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the locale the client is currently showing the user interface in.
+ /// This must not necessarily be the locale of the operating system.
+ ///
+ /// Uses IETF language tags as the value's syntax.
+ /// (See https://en.wikipedia.org/wiki/IETF_language_tag)
+ ///
+ [DataMember(Name = "locale")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Locale
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the workspace root path.
+ ///
+ [DataMember(Name = "rootPath")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ [Obsolete("Deprecated in favour of RootUri")]
+ public string? RootPath
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the workspace root path.
+ ///
+ ///
+ /// This should be a string representation of an URI.
+ ///
+ [DataMember(Name = "rootUri")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Include)]
+ [JsonConverter(typeof(DocumentUriConverter))]
+ public Uri? RootUri
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the initialization options as specified by the client.
+ ///
+ [DataMember(Name = "initializationOptions")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? InitializationOptions
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the capabilities supported by the client.
+ ///
+ [DataMember(Name = "capabilities")]
+ public ClientCapabilities Capabilities
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the initial trace setting.
+ ///
+ [DataMember(Name = "trace")]
+ [DefaultValue(typeof(TraceSetting), "off")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public TraceSetting Trace
+ {
+ get;
+ set;
+#pragma warning disable SA1500, SA1513 // Braces for multi-line statements should not share line, Closing brace should be followed by blank line
+ } = TraceSetting.Off;
+#pragma warning restore SA1500, SA1513 // Braces for multi-line statements should not share line, Closing brace should be followed by blank line
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InitializeResult.cs b/src/Features/LanguageServer/Protocol/Protocol/InitializeResult.cs
new file mode 100644
index 0000000000000..8970f738ee2b2
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InitializeResult.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents the result returned by the initialize request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InitializeResult
+ {
+ ///
+ /// Gets or sets the server capabilities.
+ ///
+ [DataMember(Name = "capabilities")]
+ public ServerCapabilities Capabilities
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InitializedParams.cs b/src/Features/LanguageServer/Protocol/Protocol/InitializedParams.cs
new file mode 100644
index 0000000000000..833419f347088
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InitializedParams.cs
@@ -0,0 +1,15 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Class containing information sent with the 'initialized' notification.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ internal class InitializedParams
+ {
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InlayHint.cs b/src/Features/LanguageServer/Protocol/Protocol/InlayHint.cs
new file mode 100644
index 0000000000000..e710324261479
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InlayHint.cs
@@ -0,0 +1,104 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// A class representing inlay hints that appear next to parameters or types.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InlayHint
+ {
+ ///
+ /// Gets or sets the position that the inlay hint applies to.
+ ///
+ [DataMember(Name = "position")]
+ public Position Position
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the label associated with this inlay hint.
+ ///
+ [DataMember(Name = "label")]
+ public SumType Label
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the InlayHintKind associated with this inlay hint.
+ ///
+ [DataMember(Name = "kind")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public InlayHintKind? Kind
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the TextEdits associated with this inlay hint.
+ ///
+ [DataMember(Name = "textEdits")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public TextEdit[]? TextEdits
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the tooltip of this inlay hint.
+ ///
+ [DataMember(Name = "tooltip")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public SumType? ToolTip
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the padding before this inlay hint.
+ ///
+ [DataMember(Name = "paddingLeft")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool PaddingLeft
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the padding after this inlay hint.
+ ///
+ [DataMember(Name = "paddingRight")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool PaddingRight
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the data that should be preserved between a textDocument/inlayHint request and a inlayHint/resolve request.
+ ///
+ [DataMember(Name = "data")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? Data
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InlayHintKind.cs b/src/Features/LanguageServer/Protocol/Protocol/InlayHintKind.cs
new file mode 100644
index 0000000000000..26b3d742d0007
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InlayHintKind.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Enum values for inlay hint kinds.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal enum InlayHintKind
+ {
+ ///
+ /// Type.
+ ///
+ Type = 1,
+
+ ///
+ /// Parameter.
+ ///
+ Parameter = 2,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InlayHintLabelPart.cs b/src/Features/LanguageServer/Protocol/Protocol/InlayHintLabelPart.cs
new file mode 100644
index 0000000000000..f3ae678a2f27f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InlayHintLabelPart.cs
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using Newtonsoft.Json;
+ using System.Runtime.Serialization;
+
+ ///
+ /// A class representing inlay hint label parts.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InlayHintLabelPart
+ {
+ ///
+ /// Gets or sets the value associated with this label part.
+ ///
+ [DataMember(Name = "value")]
+ public string Value
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the tooltip of this label part.
+ ///
+ [DataMember(Name = "tooltip")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public SumType? ToolTip
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the location of this label part.
+ ///
+ [DataMember(Name = "location")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Location? Location
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the command of this label part.
+ ///
+ [DataMember(Name = "command")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Command? Command
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InlayHintOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/InlayHintOptions.cs
new file mode 100644
index 0000000000000..28b384ae81ee0
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InlayHintOptions.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using Newtonsoft.Json;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Server capabilities for inlay hints.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InlayHintOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether or not the inlay hints support has a resolve provider.
+ ///
+ [DataMember(Name = "resolveProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool ResolveProvider
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InlayHintParams.cs b/src/Features/LanguageServer/Protocol/Protocol/InlayHintParams.cs
new file mode 100644
index 0000000000000..84556a6ec5a3f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InlayHintParams.cs
@@ -0,0 +1,37 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the parameters sent from the client to the server for a textDocument/inlayHint request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InlayHintParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the document identifier to fetch inlay hints results for.
+ ///
+ [DataMember(Name = "textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the range to fetch inlay hints results for.
+ ///
+ [DataMember(Name = "range")]
+ public Range Range
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InlayHintRegistrationOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/InlayHintRegistrationOptions.cs
new file mode 100644
index 0000000000000..5825a4c023ac5
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InlayHintRegistrationOptions.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using Newtonsoft.Json;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Inlay hint registration options.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InlayHintRegistrationOptions : InlayHintOptions, ITextDocumentRegistrationOptions, IStaticRegistrationOptions
+ {
+ ///
+ /// Gets or sets the document filters for this registration option.
+ ///
+ [DataMember(Name = "documentSelector")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Include)]
+ public DocumentFilter[]? DocumentSelector
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "id")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Id
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InlayHintResolveSupportSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/InlayHintResolveSupportSetting.cs
new file mode 100644
index 0000000000000..560985840651c
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InlayHintResolveSupportSetting.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing settings for inlayHint/resolve support.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InlayHintResolveSupportSetting
+ {
+ ///
+ /// Gets or sets a value indicating the properties that a client can resolve lazily.
+ ///
+ [DataMember(Name = "properties")]
+ public string[] Properties
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InlayHintSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/InlayHintSetting.cs
new file mode 100644
index 0000000000000..edce450da136b
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InlayHintSetting.cs
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing settings for inlay hint support.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InlayHintSetting : DynamicRegistrationSetting
+ {
+ ///
+ /// Gets or sets a value indicating whether the client supports
+ /// resolving lazily on an inlay hint.
+ ///
+ [DataMember(Name = "resolveSupport")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public InlayHintResolveSupportSetting? ResolveSupport
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InlayHintWorkspaceSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/InlayHintWorkspaceSetting.cs
new file mode 100644
index 0000000000000..5060f0e640602
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InlayHintWorkspaceSetting.cs
@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Newtonsoft.Json;
+using System.Runtime.Serialization;
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Class representing the workspace inlay hint client capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InlayHintWorkspaceSetting
+ {
+ ///
+ /// Gets or sets a value indicating whether the client supports a refresh request sent from the server to the client.
+ ///
+ [DataMember(Name = "refreshSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool RefreshSupport { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InsertReplaceEdit.cs b/src/Features/LanguageServer/Protocol/Protocol/InsertReplaceEdit.cs
new file mode 100644
index 0000000000000..9f34cd35362cd
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InsertReplaceEdit.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// A special text edit to provide an insert and a replace operation.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InsertReplaceEdit
+ {
+ ///
+ /// Gets or sets the string to be inserted.
+ ///
+ [DataMember(Name = "newText", IsRequired = true)]
+ public string NewText
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the range range if the insert is requested
+ ///
+ [DataMember(Name = "insert", IsRequired = true)]
+ public Range Insert
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the range range if the replace is requested
+ ///
+ [DataMember(Name = "replace", IsRequired = true)]
+ public Range Replace
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InsertReplaceRange.cs b/src/Features/LanguageServer/Protocol/Protocol/InsertReplaceRange.cs
new file mode 100644
index 0000000000000..2ffbf04d520c6
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InsertReplaceRange.cs
@@ -0,0 +1,35 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents default range of InsertReplaceEdit for the entire completion list
+ ///
+ [DataContract]
+ internal class InsertReplaceRange
+ {
+ ///
+ /// Gets or sets the insert range.
+ ///
+ [DataMember(Name = "insert", IsRequired = true)]
+ public Range Insert
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the replace edit range.
+ ///
+ [DataMember(Name = "replace", IsRequired = true)]
+ public Range Replace
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InsertTextFormat.cs b/src/Features/LanguageServer/Protocol/Protocol/InsertTextFormat.cs
new file mode 100644
index 0000000000000..537c41b695637
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InsertTextFormat.cs
@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Enum representing insert text format for completion items.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ internal enum InsertTextFormat
+ {
+ ///
+ /// Completion item insertion is plaintext.
+ ///
+ Plaintext = 1,
+
+ ///
+ /// Completion item insertion is snippet.
+ ///
+ Snippet = 2,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InsertTextMode.cs b/src/Features/LanguageServer/Protocol/Protocol/InsertTextMode.cs
new file mode 100644
index 0000000000000..68d7be59e0c45
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InsertTextMode.cs
@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// How whitespace and indentation is handled during completion item insertion.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ internal enum InsertTextMode
+ {
+ ///
+ /// The insertion or replace strings is taken as it is.
+ ///
+ AsIs = 1,
+
+ ///
+ /// The editor adjusts leading whitespace of new lines so that they match the indentation up to the cursor of the line for which the item is accepted.
+ ///
+ AdjustIndentation = 2,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/InsertTextModeSupportSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/InsertTextModeSupportSetting.cs
new file mode 100644
index 0000000000000..3de5c8aa688cb
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/InsertTextModeSupportSetting.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents initialization setting for the tag property on a completion item.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class InsertTextModeSupportSetting
+ {
+ ///
+ /// Gets or sets a value indicating the client supports the `insertTextMode` property on a completion item to override the whitespace handling mode as defined by the client.
+ ///
+ [DataMember(Name = "valueSet", IsRequired = true)]
+ public InsertTextMode[] ValueSet
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextElementConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextElementConverter.cs
new file mode 100644
index 0000000000000..c7a88f7485e0f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextElementConverter.cs
@@ -0,0 +1,84 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System;
+using System.Linq;
+using Roslyn.Text.Adornments;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+///
+/// JsonConverter for serializing and deserializing .
+///
+internal class ClassifiedTextElementConverter : JsonConverter
+{
+ ///
+ /// A reusable instance of the .
+ ///
+ public static readonly ClassifiedTextElementConverter Instance = new();
+
+ ///
+ public override bool CanConvert(Type objectType) => objectType == typeof(ClassifiedTextElement);
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ if (reader.TokenType == JsonToken.Null)
+ {
+ reader.Read();
+ return null;
+ }
+ else if (reader.TokenType == JsonToken.StartObject)
+ {
+ var data = JObject.Load(reader);
+ var typeProperty = data[ObjectContentConverter.TypeProperty];
+ if (typeProperty is not null && typeProperty.ToString() != nameof(ClassifiedTextElement))
+ {
+ throw new JsonSerializationException($"Expected {ObjectContentConverter.TypeProperty} property value {nameof(ClassifiedTextElement)}");
+ }
+
+ var runTokens = data[nameof(ClassifiedTextElement.Runs)]?.ToArray() ??
+ throw new JsonSerializationException($"Missing {nameof(ClassifiedTextElement.Runs)} property");
+ var runs = new ClassifiedTextRun[runTokens.Length];
+ for (var i = 0; i < runTokens.Length; i++)
+ {
+ var runTokenReader = runTokens[i].CreateReader();
+ runTokenReader.Read();
+ runs[i] = (ClassifiedTextRun)ClassifiedTextRunConverter.Instance.ReadJson(runTokenReader, typeof(ClassifiedTextRun), null, serializer)!;
+ }
+
+ return new ClassifiedTextElement(runs);
+ }
+ else
+ {
+ throw new JsonSerializationException("Expected start object or null tokens");
+ }
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ if (value is not ClassifiedTextElement classifiedTextElement)
+ {
+ writer.WriteNull();
+ }
+ else
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName(nameof(ClassifiedTextElement.Runs));
+ writer.WriteStartArray();
+ foreach (var run in classifiedTextElement.Runs)
+ {
+ ClassifiedTextRunConverter.Instance.WriteJson(writer, run, serializer);
+ }
+
+ writer.WriteEndArray();
+ writer.WritePropertyName(ObjectContentConverter.TypeProperty);
+ writer.WriteValue(nameof(ClassifiedTextElement));
+ writer.WriteEndObject();
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextRunConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextRunConverter.cs
new file mode 100644
index 0000000000000..b4becb32c4bef
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextRunConverter.cs
@@ -0,0 +1,92 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System;
+using Roslyn.Text.Adornments;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+///
+/// JsonConverter for serializing and deserializing .
+///
+internal class ClassifiedTextRunConverter : JsonConverter
+{
+ ///
+ /// A reusable instance of the .
+ ///
+ public static readonly ClassifiedTextRunConverter Instance = new();
+
+ ///
+ public override bool CanConvert(Type objectType)
+ => objectType == typeof(ClassifiedTextRun);
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ if (reader.TokenType == JsonToken.Null)
+ {
+ reader.Read();
+ return null;
+ }
+ else if (reader.TokenType == JsonToken.StartObject)
+ {
+ var data = JObject.Load(reader);
+ var typeProperty = data[ObjectContentConverter.TypeProperty];
+ if (typeProperty is not null && typeProperty.ToString() != nameof(ClassifiedTextRun))
+ {
+ throw new JsonSerializationException($"Expected {ObjectContentConverter.TypeProperty} property value {nameof(ClassifiedTextRun)}");
+ }
+
+ var classificationTypeName = data[nameof(ClassifiedTextRun.ClassificationTypeName)]?.Value();
+ var text = data[nameof(ClassifiedTextRun.Text)]?.Value();
+ var markerTagType = data[nameof(ClassifiedTextRun.MarkerTagType)]?.Value();
+ var style = (ClassifiedTextRunStyle)(data[nameof(ClassifiedTextRun.Style)]?.Value() ?? 0);
+ return new ClassifiedTextRun(classificationTypeName!, text!, style, markerTagType);
+ }
+ else
+ {
+ throw new JsonSerializationException("Expected start object or null tokens");
+ }
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ if (value is not ClassifiedTextRun classifiedTextRun)
+ {
+ writer.WriteNull();
+ }
+ else
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName(nameof(ClassifiedTextRun.ClassificationTypeName));
+ writer.WriteValue(classifiedTextRun.ClassificationTypeName);
+ writer.WritePropertyName(nameof(ClassifiedTextRun.Text));
+ writer.WriteValue(classifiedTextRun.Text);
+ writer.WritePropertyName(nameof(ClassifiedTextRun.MarkerTagType));
+ writer.WriteValue(classifiedTextRun.MarkerTagType);
+ writer.WritePropertyName(nameof(ClassifiedTextRun.Style));
+ writer.WriteValue(classifiedTextRun.Style);
+ writer.WritePropertyName(nameof(ClassifiedTextRun.Tooltip));
+ writer.WriteNull();
+ if (classifiedTextRun.Tooltip is not null)
+ {
+ throw new JsonSerializationException();
+ }
+
+ writer.WritePropertyName(nameof(ClassifiedTextRun.NavigationAction));
+ writer.WriteNull();
+ if (classifiedTextRun.NavigationAction is not null)
+ {
+ throw new JsonSerializationException();
+ }
+
+ writer.WritePropertyName(ObjectContentConverter.TypeProperty);
+ writer.WriteValue(nameof(ClassifiedTextRun));
+ writer.WriteEndObject();
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ContainerElementConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ContainerElementConverter.cs
new file mode 100644
index 0000000000000..d1778d40c9251
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ContainerElementConverter.cs
@@ -0,0 +1,87 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System;
+using System.Linq;
+using Roslyn.Text.Adornments;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+///
+/// JsonConverter for serializing and deserializing .
+///
+internal class ContainerElementConverter : JsonConverter
+{
+ ///
+ /// A reusable instance of the .
+ ///
+ public static readonly ContainerElementConverter Instance = new();
+
+ ///
+ public override bool CanConvert(Type objectType) => objectType == typeof(ContainerElement);
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ if (reader.TokenType == JsonToken.Null)
+ {
+ reader.Read();
+ return null;
+ }
+ else if (reader.TokenType == JsonToken.StartObject)
+ {
+ var data = JObject.Load(reader);
+ var typeProperty = data[ObjectContentConverter.TypeProperty];
+ if (typeProperty is not null && typeProperty.ToString() != nameof(ContainerElement))
+ {
+ throw new JsonSerializationException($"Expected {ObjectContentConverter.TypeProperty} property value {nameof(ContainerElement)}");
+ }
+
+ var elementTokens = data[nameof(ContainerElement.Elements)]?.ToArray() ??
+ throw new JsonSerializationException($"Missing {nameof(ContainerElement.Elements)} property");
+ var elements = new object?[elementTokens.Length];
+ for (var i = 0; i < elementTokens.Length; i++)
+ {
+ var elementTokenReader = elementTokens[i].CreateReader();
+ elementTokenReader.Read();
+ elements[i] = ObjectContentConverter.Instance.ReadJson(elementTokenReader, typeof(object), null, serializer);
+ }
+
+ var style = (ContainerElementStyle)(data[nameof(ContainerElement.Style)]?.Value() ?? throw new JsonSerializationException());
+ return new ContainerElement(style, elements);
+ }
+ else
+ {
+ throw new JsonSerializationException("Expected start object or null tokens");
+ }
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ if (value is not ContainerElement containerElement)
+ {
+ writer.WriteNull();
+ }
+ else
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName(nameof(ContainerElement.Elements));
+ writer.WriteStartArray();
+ foreach (var run in containerElement.Elements)
+ {
+ ObjectContentConverter.Instance.WriteJson(writer, run, serializer);
+ }
+
+ writer.WriteEndArray();
+ writer.WritePropertyName(nameof(ContainerElement.Style));
+ writer.WriteValue(containerElement.Style);
+ writer.WritePropertyName(ObjectContentConverter.TypeProperty);
+ writer.WriteValue(nameof(ContainerElement));
+ writer.WriteEndObject();
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/DropProgressConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/DropProgressConverter.cs
new file mode 100644
index 0000000000000..868de33bddf28
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/DropProgressConverter.cs
@@ -0,0 +1,52 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Linq;
+ using Newtonsoft.Json;
+
+ ///
+ /// Converter used to deserialize objects dropping any property.
+ ///
+ internal class DropProgressConverter : JsonConverter
+ {
+ ///
+ public override bool CanWrite => true;
+
+ ///
+ /// Static method to get a containing a .
+ ///
+ /// object containing a .
+ public static JsonSerializer CreateSerializer()
+ {
+ var serializer = new JsonSerializer();
+ serializer.Converters.Add(new DropProgressConverter());
+ return serializer;
+ }
+
+ ///
+ public override bool CanConvert(Type objectType)
+ {
+ var isIProgressOfT = objectType.IsConstructedGenericType && objectType.GetGenericTypeDefinition().Equals(typeof(IProgress<>));
+ var implementsIProgressOfT = objectType.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition().Equals(typeof(IProgress<>)));
+
+ return isIProgressOfT || implementsIProgressOfT;
+ }
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ // We deserialize all IProgress objects as null.
+ return null;
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ writer.WriteNull();
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ImageElementConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ImageElementConverter.cs
new file mode 100644
index 0000000000000..cb8d549fe6f65
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ImageElementConverter.cs
@@ -0,0 +1,74 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System;
+using Roslyn.Core.Imaging;
+using Roslyn.Text.Adornments;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+///
+/// JsonConverter for serializing and deserializing .
+///
+internal class ImageElementConverter : JsonConverter
+{
+ ///
+ /// A reusable instance of the .
+ ///
+ public static readonly ImageElementConverter Instance = new();
+
+ ///
+ public override bool CanConvert(Type objectType) => objectType == typeof(ImageElement);
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ if (reader.TokenType == JsonToken.Null)
+ {
+ reader.Read();
+ return null;
+ }
+ else if (reader.TokenType == JsonToken.StartObject)
+ {
+ var data = JObject.Load(reader);
+ var typeProperty = data[ObjectContentConverter.TypeProperty];
+ if (typeProperty is not null && typeProperty.ToString() != nameof(ImageElement))
+ {
+ throw new JsonSerializationException($"Expected {ObjectContentConverter.TypeProperty} property value {nameof(ImageElement)}");
+ }
+
+ var imageTokenReader = data[nameof(ImageElement.ImageId)]?.CreateReader() ?? throw new JsonSerializationException();
+ imageTokenReader.Read();
+ var imageId = (ImageId)ImageIdConverter.Instance.ReadJson(imageTokenReader, typeof(ImageId), null, serializer)!;
+ var automationName = data[nameof(ImageElement.AutomationName)]?.Value();
+ return automationName is null ? new ImageElement(imageId) : new ImageElement(imageId, automationName);
+ }
+ else
+ {
+ throw new JsonSerializationException("Expected start object or null tokens");
+ }
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ if (value is not ImageElement imageElement)
+ {
+ writer.WriteNull();
+ }
+ else
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName(nameof(ImageElement.ImageId));
+ ImageIdConverter.Instance.WriteJson(writer, imageElement.ImageId, serializer);
+ writer.WritePropertyName(nameof(ImageElement.AutomationName));
+ writer.WriteValue(imageElement.AutomationName);
+ writer.WritePropertyName(ObjectContentConverter.TypeProperty);
+ writer.WriteValue(nameof(ImageElement));
+ writer.WriteEndObject();
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ImageIdConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ImageIdConverter.cs
new file mode 100644
index 0000000000000..825d98d413ea5
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ImageIdConverter.cs
@@ -0,0 +1,72 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol;
+
+using System;
+using Roslyn.Core.Imaging;
+using Roslyn.Text.Adornments;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+///
+/// JsonConverter for serializing and deserializing .
+///
+internal class ImageIdConverter : JsonConverter
+{
+ ///
+ /// A reusable instance of the .
+ ///
+ public static readonly ImageIdConverter Instance = new();
+
+ ///
+ public override bool CanConvert(Type objectType) => objectType == typeof(ImageId);
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ if (reader.TokenType == JsonToken.Null)
+ {
+ reader.Read();
+ return null;
+ }
+ else if (reader.TokenType == JsonToken.StartObject)
+ {
+ var data = JObject.Load(reader);
+ var typeProperty = data[ObjectContentConverter.TypeProperty];
+ if (typeProperty is not null && typeProperty.ToString() != nameof(ImageId))
+ {
+ throw new JsonSerializationException($"Expected {ObjectContentConverter.TypeProperty} property value {nameof(ImageId)}");
+ }
+
+ var guid = data[nameof(ImageId.Guid)]?.Value() ?? throw new JsonSerializationException();
+ var id = data[nameof(ImageId.Id)]?.Value() ?? throw new JsonSerializationException();
+ return new ImageId(new Guid(guid), id);
+ }
+ else
+ {
+ throw new JsonSerializationException("Expected start object or null tokens");
+ }
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ if (value is not ImageId imageId)
+ {
+ writer.WriteNull();
+ }
+ else
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName(nameof(ImageId.Guid));
+ writer.WriteValue(imageId.Guid);
+ writer.WritePropertyName(nameof(ImageId.Id));
+ writer.WriteValue(imageId.Id);
+ writer.WritePropertyName(ObjectContentConverter.TypeProperty);
+ writer.WriteValue(nameof(ImageId));
+ writer.WriteEndObject();
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ObjectContentConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ObjectContentConverter.cs
new file mode 100644
index 0000000000000..26e0886a0ee51
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/ObjectContentConverter.cs
@@ -0,0 +1,116 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using Roslyn.Core.Imaging;
+ using Roslyn.Text.Adornments;
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Linq;
+
+ ///
+ /// Object Content converter used to serialize and deserialize Text and Adornements from VS.
+ ///
+ /// This converts the following types:
+ ///
+ /// ,
+ /// ,
+ /// ,
+ /// ,
+ /// .
+ ///
+ /// Every other type is serialized as a string using the method.
+ ///
+ internal class ObjectContentConverter : JsonConverter
+ {
+ ///
+ /// The property name used to save the .NET Type name of the serialized object.
+ ///
+ public const string TypeProperty = "_vs_type";
+
+ ///
+ /// A reusable instance of the .
+ ///
+ public static readonly ObjectContentConverter Instance = new ObjectContentConverter();
+
+ ///
+ public override bool CanConvert(Type objectType)
+ {
+ return objectType == typeof(object);
+ }
+
+ ///
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ if (reader.TokenType == JsonToken.Null)
+ {
+ reader.Read();
+ return null;
+ }
+ else if (reader.TokenType == JsonToken.StartObject)
+ {
+ var data = JObject.Load(reader);
+ var type = data[TypeProperty]?.ToString() ?? throw new JsonSerializationException();
+
+ var tokenReader = data.CreateReader();
+ tokenReader.Read();
+ switch (type)
+ {
+ case nameof(ImageId):
+ return ImageIdConverter.Instance.ReadJson(tokenReader, typeof(ImageId), null, serializer);
+ case nameof(ImageElement):
+ return ImageElementConverter.Instance.ReadJson(tokenReader, typeof(ImageElement), null, serializer);
+ case nameof(ContainerElement):
+ return ContainerElementConverter.Instance.ReadJson(tokenReader, typeof(ContainerElementConverter), null, serializer);
+ case nameof(ClassifiedTextElement):
+ return ClassifiedTextElementConverter.Instance.ReadJson(tokenReader, typeof(ClassifiedTextElementConverter), null, serializer);
+ case nameof(ClassifiedTextRun):
+ return ClassifiedTextRunConverter.Instance.ReadJson(tokenReader, typeof(ClassifiedTextRunConverter), null, serializer);
+ default:
+ return data;
+ }
+ }
+ else
+ {
+ return serializer.Deserialize(reader);
+ }
+ }
+
+ ///
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ if (value is null)
+ {
+ writer.WriteNull();
+ return;
+ }
+
+ switch (value)
+ {
+ case ImageId:
+ ImageIdConverter.Instance.WriteJson(writer, value, serializer);
+ break;
+ case ImageElement:
+ ImageElementConverter.Instance.WriteJson(writer, value, serializer);
+ break;
+ case ContainerElement:
+ ContainerElementConverter.Instance.WriteJson(writer, value, serializer);
+ break;
+ case ClassifiedTextElement:
+ ClassifiedTextElementConverter.Instance.WriteJson(writer, value, serializer);
+ break;
+ case ClassifiedTextRun:
+ ClassifiedTextRunConverter.Instance.WriteJson(writer, value, serializer);
+ break;
+ default:
+ // According to the docs of ContainerElement point to https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.text.adornments.iviewelementfactoryservice
+ // which states that Editor supports ClassifiedTextElement, ContainerElement, ImageElement and that other objects would be presented using ToString unless an extender
+ // exports a IViewElementFactory for that type. So I will simply serialize unknown objects as strings.
+ writer.WriteValue(value.ToString());
+ break;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/RegexConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/RegexConverter.cs
new file mode 100644
index 0000000000000..1bd71cd566617
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/RegexConverter.cs
@@ -0,0 +1,49 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Text.RegularExpressions;
+
+ using Newtonsoft.Json;
+
+ ///
+ /// Similar to https://devdiv.visualstudio.com/DevDiv/_git/VS-Platform?path=/src/Productivity/TextMate/Core/LanguageConfiguration/Impl/FastRegexConverter.cs
+ /// to allow us to only compile the regex option once.
+ ///
+ internal class RegexConverter : JsonConverter
+ {
+ public override bool CanConvert(Type objectType)
+ {
+ // nameof is faster than typeof, so below is a fast path.
+ return objectType.Name == nameof(Regex) && objectType == typeof(Regex);
+ }
+
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
+ {
+ // Create a custom deserializer for regex as the default provided by newtonsoft doesn't
+ // specify the Compiled option.
+ var regexText = reader.Value as string;
+ if (string.IsNullOrEmpty(regexText))
+ {
+ return null;
+ }
+
+ return new Regex(regexText, RegexOptions.Compiled | RegexOptions.ECMAScript, matchTimeout: TimeSpan.FromMilliseconds(1000));
+ }
+
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ if (value is Regex valueAsRegex)
+ {
+ writer.WriteValue(valueAsRegex.ToString());
+ }
+ else
+ {
+ throw new ArgumentException($"{nameof(value)} must be of type {nameof(Regex)}");
+ }
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/VSInternalExtensionUtilities.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/VSInternalExtensionUtilities.cs
new file mode 100644
index 0000000000000..dea7f8218f125
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Converters/VSInternalExtensionUtilities.cs
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using Newtonsoft.Json;
+
+ ///
+ /// Utilities to aid work with the LSP Extensions.
+ ///
+ internal static class VSInternalExtensionUtilities
+ {
+ ///
+ /// Adds necessary to deserialize
+ /// JSON stream into objects which include VS-specific extensions.
+ ///
+ ///
+ /// If is used in parallel to execution of this method,
+ /// its access needs to be synchronized with this method call, to guarantee that
+ /// collection is not modified when in use.
+ ///
+ /// Instance of which is guaranteed to not work in parallel to this method call.
+ public static void AddVSInternalExtensionConverters(this JsonSerializer serializer)
+ {
+ VSExtensionUtilities.AddVSExtensionConverters(serializer);
+
+ // Reading the number of converters before we start adding new ones
+ var existingConvertersCount = serializer.Converters.Count;
+
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+ AddOrReplaceConverter();
+
+ void AddOrReplaceConverter()
+ where TExtension : TBase
+ {
+ for (var i = 0; i < existingConvertersCount; i++)
+ {
+ var existingConverterType = serializer.Converters[i].GetType();
+ if (existingConverterType.IsGenericType &&
+ existingConverterType.GetGenericTypeDefinition() == typeof(VSExtensionConverter<,>) &&
+ existingConverterType.GenericTypeArguments[0] == typeof(TBase))
+ {
+ serializer.Converters.RemoveAt(i);
+ existingConvertersCount--;
+ break;
+ }
+ }
+
+ serializer.Converters.Add(new VSExtensionConverter());
+ }
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticKind.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticKind.cs
new file mode 100644
index 0000000000000..05d65708fcfd3
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticKind.cs
@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.ComponentModel;
+ using System.Runtime.Serialization;
+
+ using Newtonsoft.Json;
+
+ ///
+ /// Value representing the kind of a diagnostic.
+ ///
+ [DataContract]
+ [JsonConverter(typeof(StringEnumConverter))]
+ [TypeConverter(typeof(StringEnumConverter.TypeConverter))]
+ internal readonly record struct VSInternalDiagnosticKind(string Value) : IStringEnum
+ {
+ ///
+ /// Task list diagnostic kind.
+ ///
+ public static readonly VSInternalDiagnosticKind Task = new("task");
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticOptions.cs
new file mode 100644
index 0000000000000..39c5a27db93a1
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticOptions.cs
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Server provided options for pull diagnostic requests.
+ ///
+ [DataContract]
+ internal class VSInternalDiagnosticOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a list of id's used to identify diagnostics that may be coming
+ /// from build systems instead of a language server.
+ ///
+ /// VS client will then use the information to do any merging logic in the Error List.
+ /// Maps to .
+ ///
+ [DataMember(Name = "_vs_buildOnlyDiagnosticIds")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string[]? BuildOnlyDiagnosticIds
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a list of diagnostic kinds used to query diagnostics in each context.
+ ///
+ [DataMember(Name = "_vs_diagnosticKinds")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalDiagnosticKind[]? DiagnosticKinds
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "_vs_workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticParams.cs
new file mode 100644
index 0000000000000..40e808078218a
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticParams.cs
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a diagnostic pull request parameter used.
+ ///
+ [DataContract]
+ internal class VSInternalDiagnosticParams
+ {
+ ///
+ /// Gets or sets the document for which diagnostics are desired.
+ ///
+ [DataMember(Name = "_vs_textDocument", IsRequired = true)]
+ public TextDocumentIdentifier? TextDocument { get; set; }
+
+ ///
+ /// Gets or sets a value indicating what kind of diagnostic this request is querying for.
+ ///
+ [DataMember(Name = "_vs_queryingDiagnosticKind")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalDiagnosticKind? QueryingDiagnosticKind { get; set; }
+
+ ///
+ /// Gets or sets the server-generated version number for the diagnostics.
+ ///
+ ///
+ ///
+ /// This is treated as a black box by the client: it is stored on the client
+ /// for each textDocument and sent back to the server when requesting
+ /// diagnostics. The server can use this result ID to avoid resending
+ /// diagnostics that had previously been sent.
+ ///
+ /// Note that if a client does request diagnostics that haven’t changed, the
+ /// language server should not reply with any diagnostics for that document.
+ /// If the client requests diagnostics for a file that has been renamed or
+ /// deleted, then the language service should respond with null for the
+ /// diagnostics.
+ /// Also, if a service is reporting multiple DiagnosticReports for the same
+ /// document, then all reports are expected to have the same
+ /// previousResultId.
+ ///
+ [DataMember(Name = "_vs_previousResultId")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? PreviousResultId { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticReport.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticReport.cs
new file mode 100644
index 0000000000000..29b96efd3f442
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticReport.cs
@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a diagnostic pull request report.
+ ///
+ [DataContract]
+ internal class VSInternalDiagnosticReport
+ {
+ ///
+ /// Gets or sets the server-generated version number for the diagnostics.
+ /// This is treated as a black box by the client: it is stored on the client
+ /// for each textDocument and sent back to the server when requesting
+ /// diagnostics.The server can use this result ID to avoid resending
+ /// diagnostics that had previously been sent.
+ ///
+ [DataMember(Name = "_vs_resultId")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? ResultId { get; set; }
+
+ ///
+ /// Gets or sets a (potentially incomplete) list of Diagnostics for the document.
+ /// Subsequent DiagnosticReports for the same document will be appended.
+ ///
+ ///
+ /// Is null if no changes in the diagnostics. Is empty if there is no diagnostic.
+ ///
+ [DataMember(Name = "_vs_diagnostics")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Diagnostic[]? Diagnostics { get; set; }
+
+ ///
+ /// Gets or sets an identifier associated with all the diagnostics in this report.
+ ///
+ /// If the property matches the supersedes property of another report,
+ /// entries tagged with will
+ /// be hidden in the editor.
+ ///
+ [DataMember(Name = "_vs_identifier")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public int? Identifier { get; set; }
+
+ ///
+ /// Gets or sets an indicator of which diagnostic report is superseded by this report.
+ ///
+ ///
+ /// Diagnostics in a superseded report will be hidden if they have the PotentialDuplicate VSDiagnosticTag.
+ ///
+ [DataMember(Name = "_vs_supersedes")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public int? Supersedes { get; set; }
+
+ ///
+ /// Gets or sets an optional key used to associate diagnostics with lines
+ /// of text in the output window(diagnostics can have an additional
+ /// outputId and the (outputKey, outputId) uniquely identify
+ /// a line of text in the output window).
+ ///
+ [DataMember(Name = "_vs_outputKey")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Guid? OutputKey { get; set; }
+
+ ///
+ /// Gets or sets the document version.
+ ///
+ [DataMember(Name = "_vs_version")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public int? Version { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDocumentDiagnosticsParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDocumentDiagnosticsParams.cs
new file mode 100644
index 0000000000000..8b61f2fbf6438
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDocumentDiagnosticsParams.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a diagnostic pull request for a specific document.
+ ///
+ [DataContract]
+ internal class VSInternalDocumentDiagnosticsParams : VSInternalDiagnosticParams, IPartialResultParams
+ {
+ ///
+ /// Gets or sets an optional token that a server can use to report work done progress.
+ ///
+ [DataMember(Name = Methods.WorkDoneTokenName)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public IProgress? WorkDoneToken { get; set; }
+
+ ///
+ /// Gets or sets an optional token that a server can use to report partial results (e.g. streaming) to the client.
+ ///
+ [DataMember(Name = Methods.PartialResultTokenName)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public IProgress? PartialResultToken { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticReport.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticReport.cs
new file mode 100644
index 0000000000000..b4841e7c41664
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticReport.cs
@@ -0,0 +1,21 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing a diagnostic pull request result for all documents.
+ ///
+ [DataContract]
+ internal class VSInternalWorkspaceDiagnosticReport : VSInternalDiagnosticReport
+ {
+ ///
+ /// Gets or sets the document for which diagnostics is returned.
+ ///
+ [DataMember(Name = "_vs_textDocument", IsRequired = true)]
+ public TextDocumentIdentifier? TextDocument { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticsParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticsParams.cs
new file mode 100644
index 0000000000000..1ddf9bd496914
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticsParams.cs
@@ -0,0 +1,45 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a diagnostic pull request for all documents.
+ ///
+ [DataContract]
+ internal class VSInternalWorkspaceDiagnosticsParams : IPartialResultParams
+ {
+ ///
+ /// Gets or sets the current state of the documents the client already has received.
+ ///
+ [DataMember(Name = "_vs_previousResults")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalDiagnosticParams[]? PreviousResults { get; set; }
+
+ ///
+ /// Gets or sets an optional token that a server can use to report work done progress.
+ ///
+ [DataMember(Name = Methods.WorkDoneTokenName)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public IProgress? WorkDoneToken { get; set; }
+
+ ///
+ /// Gets or sets an optional token that a server can use to report partial results (e.g. streaming) to the client.
+ ///
+ [DataMember(Name = Methods.PartialResultTokenName)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public IProgress? PartialResultToken { get; set; }
+
+ ///
+ /// Gets or sets a value indicating what kind of diagnostic this request is querying for.
+ ///
+ [DataMember(Name = "_vs_queryingDiagnosticKind")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalDiagnosticKind? QueryingDiagnosticKind { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Efficiency/OptimizedVSCompletionList.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Efficiency/OptimizedVSCompletionList.cs
new file mode 100644
index 0000000000000..f99efeba0bbea
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Efficiency/OptimizedVSCompletionList.cs
@@ -0,0 +1,43 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// A subclass of the VS LSP protocol extension that has a fast serialization path.
+ ///
+ [DataContract]
+ [JsonConverter(typeof(OptimizedVSCompletionListJsonConverter))]
+ internal sealed class OptimizedVSCompletionList : VSInternalCompletionList
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The completion list to wrap.
+ public OptimizedVSCompletionList(VSInternalCompletionList completionList)
+ {
+ this.Items = completionList.Items;
+ this.IsIncomplete = completionList.IsIncomplete;
+ this.SuggestionMode = completionList.SuggestionMode;
+ this.ContinueCharacters = completionList.ContinueCharacters;
+ this.Data = completionList.Data;
+ this.CommitCharacters = completionList.CommitCharacters;
+ this.ItemDefaults = completionList.ItemDefaults;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The completion list to wrap.
+ public OptimizedVSCompletionList(CompletionList completionList)
+ {
+ this.Items = completionList.Items;
+ this.IsIncomplete = completionList.IsIncomplete;
+ this.ItemDefaults = completionList.ItemDefaults;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Efficiency/OptimizedVSCompletionListJsonConverter.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Efficiency/OptimizedVSCompletionListJsonConverter.cs
new file mode 100644
index 0000000000000..8369864bfd38f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Efficiency/OptimizedVSCompletionListJsonConverter.cs
@@ -0,0 +1,267 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Collections.Concurrent;
+ using System.Collections.Generic;
+ using Roslyn.Core.Imaging;
+ using Newtonsoft.Json;
+
+ internal class OptimizedVSCompletionListJsonConverter : JsonConverter
+ {
+ public static readonly OptimizedVSCompletionListJsonConverter Instance = new OptimizedVSCompletionListJsonConverter();
+ private static readonly ConcurrentDictionary IconRawJson = new ConcurrentDictionary();
+
+ public override bool CanRead => false;
+
+ public override bool CanConvert(Type objectType) => typeof(OptimizedVSCompletionList) == objectType;
+
+ public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) => throw new NotImplementedException();
+
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
+ {
+ if (value is null)
+ {
+ writer.WriteNull();
+ return;
+ }
+
+ var completionList = (VSInternalCompletionList)value;
+
+ writer.WriteStartObject();
+
+ if (completionList.SuggestionMode)
+ {
+ writer.WritePropertyName(VSInternalCompletionList.SuggestionModeSerializedName);
+ writer.WriteValue(completionList.SuggestionMode);
+ }
+ else
+ {
+ // Default is "false" so no need to serialize
+ }
+
+ if (completionList.ContinueCharacters != null && completionList.ContinueCharacters.Length > 0)
+ {
+ writer.WritePropertyName(VSInternalCompletionList.ContinueCharactersSerializedName);
+ serializer.Serialize(writer, completionList.ContinueCharacters);
+ }
+
+ if (completionList.Data != null)
+ {
+ writer.WritePropertyName(VSInternalCompletionList.DataSerializedName);
+ serializer.Serialize(writer, completionList.Data);
+ }
+
+ if (completionList.CommitCharacters != null)
+ {
+ writer.WritePropertyName(VSInternalCompletionList.CommitCharactersSerializedName);
+ serializer.Serialize(writer, completionList.CommitCharacters);
+ }
+
+ if (completionList.IsIncomplete)
+ {
+ writer.WritePropertyName("isIncomplete");
+ writer.WriteValue(completionList.IsIncomplete);
+ }
+ else
+ {
+ // Default is "false" so no need to serialize
+ }
+
+ writer.WritePropertyName("items");
+ if (completionList.Items == null || completionList.Items.Length == 0)
+ {
+ writer.WriteRawValue("[]");
+ }
+ else
+ {
+ writer.WriteStartArray();
+
+ var itemRawJsonCache = new Dictionary(capacity: 1);
+
+ foreach (var completionItem in completionList.Items)
+ {
+ if (completionItem == null)
+ {
+ continue;
+ }
+
+ WriteCompletionItem(writer, completionItem, serializer, itemRawJsonCache);
+ }
+
+ writer.WriteEndArray();
+ }
+
+ if (completionList.ItemDefaults != null)
+ {
+ writer.WritePropertyName("itemDefaults");
+ serializer.Serialize(writer, completionList.ItemDefaults);
+ }
+
+ writer.WriteEndObject();
+ }
+
+ private static void WriteCompletionItem(JsonWriter writer, CompletionItem completionItem, JsonSerializer serializer, Dictionary itemRawJsonCache)
+ {
+ writer.WriteStartObject();
+
+ if (completionItem is VSInternalCompletionItem vsCompletionItem)
+ {
+ if (vsCompletionItem.Icon != null)
+ {
+ if (!IconRawJson.TryGetValue(vsCompletionItem.Icon.ImageId, out var jsonString))
+ {
+ jsonString = JsonConvert.SerializeObject(vsCompletionItem.Icon, Formatting.None, ImageElementConverter.Instance);
+ IconRawJson.TryAdd(vsCompletionItem.Icon.ImageId, jsonString);
+ }
+
+ writer.WritePropertyName(VSInternalCompletionItem.IconSerializedName);
+ writer.WriteRawValue(jsonString);
+ }
+
+ if (vsCompletionItem.Description != null)
+ {
+ writer.WritePropertyName(VSInternalCompletionItem.DescriptionSerializedName);
+ ClassifiedTextElementConverter.Instance.WriteJson(writer, vsCompletionItem.Description, serializer);
+ }
+
+ if (vsCompletionItem.VsCommitCharacters?.Value is string[] basicCommitCharacters
+ && basicCommitCharacters.Length > 0)
+ {
+ if (!itemRawJsonCache.TryGetValue(basicCommitCharacters, out var jsonString))
+ {
+ jsonString = JsonConvert.SerializeObject(basicCommitCharacters);
+ itemRawJsonCache.Add(basicCommitCharacters, jsonString);
+ }
+
+ writer.WritePropertyName(VSInternalCompletionItem.VsCommitCharactersSerializedName);
+ writer.WriteRawValue(jsonString);
+ }
+ else if (vsCompletionItem.VsCommitCharacters?.Value is VSInternalCommitCharacter[] augmentedCommitCharacters
+ && augmentedCommitCharacters.Length > 0)
+ {
+ if (!itemRawJsonCache.TryGetValue(augmentedCommitCharacters, out var jsonString))
+ {
+ jsonString = JsonConvert.SerializeObject(augmentedCommitCharacters);
+ itemRawJsonCache.Add(augmentedCommitCharacters, jsonString);
+ }
+
+ writer.WritePropertyName(VSInternalCompletionItem.VsCommitCharactersSerializedName);
+ writer.WriteRawValue(jsonString);
+ }
+
+ if (vsCompletionItem.VsResolveTextEditOnCommit)
+ {
+ writer.WritePropertyName(VSInternalCompletionItem.VsResolveTextEditOnCommitName);
+ writer.WriteValue(vsCompletionItem.VsResolveTextEditOnCommit);
+ }
+ }
+
+ var label = completionItem.Label;
+ if (label != null)
+ {
+ writer.WritePropertyName("label");
+ writer.WriteValue(label);
+ }
+
+ if (completionItem.LabelDetails != null)
+ {
+ writer.WritePropertyName("labelDetails");
+ serializer.Serialize(writer, completionItem.LabelDetails);
+ }
+
+ writer.WritePropertyName("kind");
+ writer.WriteValue(completionItem.Kind);
+
+ if (completionItem.Detail != null)
+ {
+ writer.WritePropertyName("detail");
+ writer.WriteValue(completionItem.Detail);
+ }
+
+ if (completionItem.Documentation != null)
+ {
+ writer.WritePropertyName("documentation");
+ serializer.Serialize(writer, completionItem.Documentation);
+ }
+
+ // Only render preselect if it's "true"
+ if (completionItem.Preselect)
+ {
+ writer.WritePropertyName("preselect");
+ writer.WriteValue(completionItem.Preselect);
+ }
+
+ if (completionItem.SortText != null && !string.Equals(completionItem.SortText, label, StringComparison.Ordinal))
+ {
+ writer.WritePropertyName("sortText");
+ writer.WriteValue(completionItem.SortText);
+ }
+
+ if (completionItem.FilterText != null && !string.Equals(completionItem.FilterText, label, StringComparison.Ordinal))
+ {
+ writer.WritePropertyName("filterText");
+ writer.WriteValue(completionItem.FilterText);
+ }
+
+ if (completionItem.InsertText != null && !string.Equals(completionItem.InsertText, label, StringComparison.Ordinal))
+ {
+ writer.WritePropertyName("insertText");
+ writer.WriteValue(completionItem.InsertText);
+ }
+
+ if (completionItem.InsertTextFormat != default && completionItem.InsertTextFormat != InsertTextFormat.Plaintext)
+ {
+ writer.WritePropertyName("insertTextFormat");
+ writer.WriteValue(completionItem.InsertTextFormat);
+ }
+
+ if (completionItem.TextEdit != null)
+ {
+ writer.WritePropertyName("textEdit");
+ serializer.Serialize(writer, completionItem.TextEdit);
+ }
+
+ if (completionItem.TextEditText != null)
+ {
+ writer.WritePropertyName("textEditText");
+ serializer.Serialize(writer, completionItem.TextEditText);
+ }
+
+ if (completionItem.AdditionalTextEdits != null && completionItem.AdditionalTextEdits.Length > 0)
+ {
+ writer.WritePropertyName("additionalTextEdits");
+ serializer.Serialize(writer, completionItem.AdditionalTextEdits);
+ }
+
+ if (completionItem.CommitCharacters != null && completionItem.CommitCharacters.Length > 0)
+ {
+ if (!itemRawJsonCache.TryGetValue(completionItem.CommitCharacters, out var jsonString))
+ {
+ jsonString = JsonConvert.SerializeObject(completionItem.CommitCharacters);
+ itemRawJsonCache.Add(completionItem.CommitCharacters, jsonString);
+ }
+
+ writer.WritePropertyName("commitCharacters");
+ writer.WriteRawValue(jsonString);
+ }
+
+ if (completionItem.Command != null)
+ {
+ writer.WritePropertyName("command");
+ serializer.Serialize(writer, completionItem.Command);
+ }
+
+ if (completionItem.Data != null)
+ {
+ writer.WritePropertyName("data");
+ serializer.Serialize(writer, completionItem.Data);
+ }
+
+ writer.WriteEndObject();
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ClassifiedTextElement.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ClassifiedTextElement.cs
new file mode 100644
index 0000000000000..e472d496076d0
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ClassifiedTextElement.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Immutable;
+using Roslyn.Text.Adornments;
+
+namespace Roslyn.Text.Adornments
+{
+ internal sealed class ClassifiedTextElement
+ {
+ public const string TextClassificationTypeName = "text";
+
+ public IEnumerable Runs { get; }
+
+ public ClassifiedTextElement(params ClassifiedTextRun[] runs)
+ {
+ Runs = runs?.ToImmutableList() ?? throw new ArgumentNullException("runs");
+ }
+
+ public ClassifiedTextElement(IEnumerable runs)
+ {
+ Runs = runs?.ToImmutableList() ?? throw new ArgumentNullException("runs");
+ }
+
+ public static ClassifiedTextElement CreateHyperlink(string text, string tooltip, Action navigationAction)
+ {
+ //Requires.NotNull(text, "text");
+ //Requires.NotNull(navigationAction, "navigationAction");
+ return new ClassifiedTextElement(new ClassifiedTextRun("text", text, navigationAction: navigationAction, tooltip: tooltip));
+ }
+
+ public static ClassifiedTextElement CreatePlainText(string text)
+ {
+ //Requires.NotNull(text, "text");
+ return new ClassifiedTextElement(new ClassifiedTextRun("text", text));
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ClassifiedTextRun.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ClassifiedTextRun.cs
new file mode 100644
index 0000000000000..e79d24774d717
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ClassifiedTextRun.cs
@@ -0,0 +1,23 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+
+namespace Roslyn.Text.Adornments;
+
+internal sealed class ClassifiedTextRun(
+ string classificationTypeName,
+ string text,
+ ClassifiedTextRunStyle style = ClassifiedTextRunStyle.Plain,
+ string? markerTagType = null,
+ Action? navigationAction = null,
+ string? tooltip = null)
+{
+ public string ClassificationTypeName { get; } = classificationTypeName ?? throw new ArgumentNullException(nameof(classificationTypeName));
+ public string Text { get; } = text ?? throw new ArgumentNullException(nameof(text));
+ public string? MarkerTagType { get; } = markerTagType;
+ public ClassifiedTextRunStyle Style { get; } = style;
+ public string? Tooltip { get; } = tooltip;
+ public Action? NavigationAction { get; } = navigationAction;
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ClassifiedTextRunStyle.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ClassifiedTextRunStyle.cs
new file mode 100644
index 0000000000000..7e03f2b16f477
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ClassifiedTextRunStyle.cs
@@ -0,0 +1,55 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+
+namespace Roslyn.Text.Adornments
+{
+ //
+ // Summary:
+ // The text style for a Microsoft.VisualStudio.Text.Adornments.ClassifiedTextRun.
+ //
+ // Remarks:
+ // By default, text is displayed using tooltip preferences, but colorized using
+ // text editor colors in order to make tooltips that look visually like UI, but
+ // match the semantic colorization of the code.
+ [Flags]
+ internal enum ClassifiedTextRunStyle
+ {
+ //
+ // Summary:
+ // Plain text.
+ Plain = 0x0,
+ //
+ // Summary:
+ // Bolded text.
+ Bold = 0x1,
+ //
+ // Summary:
+ // Italic text.
+ Italic = 0x2,
+ //
+ // Summary:
+ // Underlined text.
+ Underline = 0x4,
+ //
+ // Summary:
+ // Use the font specified by the classification.
+ //
+ // Remarks:
+ // If applied, the classification's code font is used instead of the default tooltip
+ // font.
+ UseClassificationFont = 0x8,
+ //
+ // Summary:
+ // Use the style specified by the classification.
+ //
+ // Remarks:
+ // If applied, the classification's bold, italic, and underline settings are used
+ // instead of the default tooltip style. Note that additional styles can be layered
+ // on top of the classification's style by adding Microsoft.VisualStudio.Text.Adornments.ClassifiedTextRunStyle.Bold,
+ // Microsoft.VisualStudio.Text.Adornments.ClassifiedTextRunStyle.Italic, or Microsoft.VisualStudio.Text.Adornments.ClassifiedTextRunStyle.Underline.
+ UseClassificationStyle = 0x10
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ContainerElement.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ContainerElement.cs
new file mode 100644
index 0000000000000..c9f140776da0c
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ContainerElement.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Immutable;
+
+namespace Roslyn.Text.Adornments
+{
+ internal sealed class ContainerElement
+ {
+ public IEnumerable Elements { get; }
+
+ public ContainerElementStyle Style { get; }
+
+ public ContainerElement(ContainerElementStyle style, IEnumerable elements)
+ {
+ Style = style;
+ Elements = elements?.ToImmutableList() ?? throw new ArgumentNullException("elements");
+ }
+
+ public ContainerElement(ContainerElementStyle style, params object[] elements)
+ {
+ Style = style;
+ Elements = elements?.ToImmutableList() ?? throw new ArgumentNullException("elements");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ContainerElementStyle.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ContainerElementStyle.cs
new file mode 100644
index 0000000000000..441741d13ab6a
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ContainerElementStyle.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+
+namespace Roslyn.Text.Adornments
+{
+ //
+ // Summary:
+ // The layout style for a Microsoft.VisualStudio.Text.Adornments.ContainerElement.
+ [Flags]
+ internal enum ContainerElementStyle
+ {
+ //
+ // Summary:
+ // Contents are end-to-end, and wrapped when the control becomes too wide.
+ Wrapped = 0x0,
+ //
+ // Summary:
+ // Contents are stacked vertically.
+ Stacked = 0x1,
+ //
+ // Summary:
+ // Additional padding above and below content.
+ VerticalPadding = 0x2
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ImageElement.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ImageElement.cs
new file mode 100644
index 0000000000000..bbd213a10f8bd
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ImageElement.cs
@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Roslyn.Core.Imaging;
+
+namespace Roslyn.Text.Adornments;
+
+internal sealed class ImageElement
+{
+ public static readonly ImageElement Empty = new(default, string.Empty);
+
+ public ImageId ImageId { get; }
+ public string? AutomationName { get; }
+
+ public ImageElement(ImageId imageId) : this(imageId, null)
+ {
+ }
+
+ public ImageElement(ImageId imageId, string? automationName)
+ {
+ ImageId = imageId;
+ AutomationName = automationName;
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ImageId.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ImageId.cs
new file mode 100644
index 0000000000000..9b226ebb2938a
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/Text/ImageId.cs
@@ -0,0 +1,104 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Globalization;
+
+namespace Roslyn.Core.Imaging
+{
+ //
+ // Summary:
+ // Unique identifier for Visual Studio image asset.
+ //
+ // Remarks:
+ // On Windows systems, Microsoft.VisualStudio.Core.Imaging.ImageId can be converted
+ // to and from various other image representations via the ImageIdExtensions extension
+ // methods.
+ internal struct ImageId : IEquatable
+ {
+ //
+ // Summary:
+ // The Microsoft.VisualStudio.Core.Imaging.ImageId.Guid identifying the group to
+ // which this image belongs.
+ public readonly Guid Guid;
+
+ //
+ // Summary:
+ // The System.Int32 identifying the particular image from the group that this id
+ // maps to.
+ public readonly int Id;
+
+ //
+ // Summary:
+ // Creates a new instance of ImageId.
+ //
+ // Parameters:
+ // guid:
+ // The Microsoft.VisualStudio.Core.Imaging.ImageId.Guid identifying the group to
+ // which this image belongs.
+ //
+ // id:
+ // The System.Int32 identifying the particular image from the group that this id
+ // maps to.
+ public ImageId(Guid guid, int id)
+ {
+ Guid = guid;
+ Id = id;
+ }
+
+ public override string ToString()
+ {
+ return ToString(CultureInfo.InvariantCulture);
+ }
+
+ public string ToString(IFormatProvider provider)
+ {
+ var guid = Guid;
+ var arg = guid.ToString("D", provider);
+ var id = Id;
+ return string.Format(provider, "{0} : {1}", arg, id.ToString(provider));
+ }
+
+ bool IEquatable.Equals(ImageId other)
+ {
+ var id = Id;
+ if (id.Equals(other.Id))
+ {
+ var guid = Guid;
+ return guid.Equals(other.Guid);
+ }
+
+ return false;
+ }
+
+ public override bool Equals(object other)
+ {
+ if (other is ImageId)
+ {
+ var other2 = (ImageId)other;
+ return ((IEquatable)this).Equals(other2);
+ }
+
+ return false;
+ }
+
+ public static bool operator ==(ImageId left, ImageId right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(ImageId left, ImageId right)
+ {
+ return !(left == right);
+ }
+
+ public override int GetHashCode()
+ {
+ var guid = Guid;
+ var hashCode = guid.GetHashCode();
+ var id = Id;
+ return hashCode ^ id.GetHashCode();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSFoldingRangeSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSFoldingRangeSetting.cs
new file mode 100644
index 0000000000000..a7d46e257f83e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSFoldingRangeSetting.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class used to extend to add internal capabilities.
+ ///
+ internal class VSFoldingRangeSetting : FoldingRangeSetting
+ {
+ ///
+ /// Gets or sets a value indicating whether if client only supports entire line folding only.
+ ///
+ [DataMember(Name = "_vs_refreshSupport")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool RefreshSupport
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalClientCapabilities.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalClientCapabilities.cs
new file mode 100644
index 0000000000000..476b1bbc3238e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalClientCapabilities.cs
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Extension class for ClientCapabilities with fields specific to Visual Studio.
+ ///
+ [DataContract]
+ internal class VSInternalClientCapabilities : ClientCapabilities
+ {
+ ///
+ /// Gets or sets a value indicating whether client supports Visual Studio extensions.
+ ///
+ [DataMember(Name = "_vs_supportsVisualStudioExtensions")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool SupportsVisualStudioExtensions
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating what level of snippet support is available from Visual Studio Client.
+ /// v1.0 refers to only default tab stop support i.e. support for $0 which manipualtes the cursor position.
+ ///
+ [DataMember(Name = "_vs_supportedSnippetVersion")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalSnippetSupportLevel? SupportedSnippetVersion
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether client supports omitting document text in textDocument/didOpen notifications.
+ ///
+ [DataMember(Name = "_vs_supportsNotIncludingTextInTextDocumentDidOpen")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool SupportsNotIncludingTextInTextDocumentDidOpen
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the client supports string based response kinds
+ /// instead of enum based response kinds.
+ ///
+ [DataMember(Name = "_vs_supportsIconExtensions")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool SupportsIconExtensions
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the client provides support for diagnostic pull requests.
+ ///
+ [DataMember(Name = "_vs_supportsDiagnosticRequests")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool SupportsDiagnosticRequests
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalClipboardContent.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalClipboardContent.cs
new file mode 100644
index 0000000000000..eb25ceed3c90f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalClipboardContent.cs
@@ -0,0 +1,35 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents content to be sent to the clipboard.
+ ///
+ [DataContract]
+ internal class VSInternalClipboardContent
+ {
+ ///
+ /// Gets or sets a string that describes clipboard format types, for example, "text/plain".
+ ///
+ [DataMember(Name = "_vs_mime", IsRequired = true)]
+ public string MimeType
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the content of the clipboard.
+ ///
+ [DataMember(Name = "_vs_content", IsRequired = true)]
+ public string Content
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeAction.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeAction.cs
new file mode 100644
index 0000000000000..2daba780549e6
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeAction.cs
@@ -0,0 +1,72 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class used to extend to add the data field for codeAction/_ms_resolve support.
+ ///
+ [DataContract]
+ internal class VSInternalCodeAction : CodeAction
+ {
+ ///
+ /// Gets or sets the group this CodeAction belongs to.
+ ///
+ [DataMember(Name = "_vs_group")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? Group
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the priority level of the code action.
+ ///
+ [DataMember(Name = "_vs_priority")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalPriorityLevel? Priority
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the range of the span this action is applicable to.
+ ///
+ [DataMember(Name = "_vs_applicableRange")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Range? ApplicableRange
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the children of this action.
+ ///
+ [DataMember(Name = "_vs_children")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalCodeAction[]? Children
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the telemetry id of this action.
+ ///
+ [DataMember(Name = "_vs_telemetryId")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Guid? TelemetryId
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionContext.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionContext.cs
new file mode 100644
index 0000000000000..93a48ed25cbc6
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionContext.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the parameters sent from the client to the server for the textDocument/codeAction request.
+ ///
+ [DataContract]
+ internal class VSInternalCodeActionContext : CodeActionContext
+ {
+ ///
+ /// Gets or sets the range of the current selection in the document for which the command was invoked.
+ /// If there is no selection this would be a Zero-length range for the caret position.
+ ///
+ [DataMember(Name = "_vs_selectionRange")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Range? SelectionRange
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionGroup.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionGroup.cs
new file mode 100644
index 0000000000000..109f98d7b85fb
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionGroup.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Enum which represents the various kinds of code actions.
+ ///
+ internal static class VSInternalCodeActionGroup
+ {
+ ///
+ /// Code action is a quick fix.
+ ///
+ public const string QuickFix = "quickfix";
+
+ ///
+ /// Code action is a refactor.
+ ///
+ public const string Refactor = "refactor";
+
+ ///
+ /// Code action is a refactor for extracting methods, functions, variables, etc.
+ ///
+ public const string RefactorExtract = "refactor.extract";
+
+ ///
+ /// Code action is a refactor for inlining methods, constants, etc.
+ ///
+ public const string RefactorInline = "refactor.inline";
+
+ ///
+ /// Code action is a refactor for rewrite actions, such as making methods static.
+ ///
+ public const string RefactorRewrite = "refactor.rewrite";
+
+ ///
+ /// Code action applies to the entire file.
+ ///
+ public const string Source = "source";
+
+ ///
+ /// Code actions is for organizing imports.
+ ///
+ public const string SourceOrganizeImports = "source.organizeImports";
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionGroupSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionGroupSetting.cs
new file mode 100644
index 0000000000000..8bd608dbd27fe
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionGroupSetting.cs
@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class containing the set of code action default groups that are supported.
+ ///
+ [DataContract]
+ internal class VSInternalCodeActionGroupSetting
+ {
+ ///
+ /// Gets or sets the code actions default group names the client supports.
+ ///
+ [DataMember(Name = "_vs_valueSet")]
+ public string[] ValueSet
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionLiteralSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionLiteralSetting.cs
new file mode 100644
index 0000000000000..58da67255fd31
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCodeActionLiteralSetting.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing support for code action literals.
+ ///
+ [DataContract]
+ internal class VSInternalCodeActionLiteralSetting : CodeActionLiteralSetting
+ {
+ ///
+ /// Gets or sets a value indicating what code action default groups are supported.
+ ///
+ [DataMember(Name = "_vs_codeActionGroup")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalCodeActionGroupSetting? CodeActionGroup
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCommitCharacter.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCommitCharacter.cs
new file mode 100644
index 0000000000000..9e9b8ab8cebf2
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCommitCharacter.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Extension class for CompletionItem with fields specific to Visual Studio functionalities.
+ ///
+ [DataContract]
+ internal class VSInternalCommitCharacter
+ {
+ ///
+ /// Gets or sets the commit character.
+ ///
+ [DataMember(Name = "_vs_character")]
+ public string Character { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether the commit character should be inserted or not.
+ ///
+ [DataMember(Name = "_vs_insert")]
+ public bool Insert { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionContext.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionContext.cs
new file mode 100644
index 0000000000000..fc0b92a2fe216
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionContext.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.ComponentModel;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Extension class for with properties specific to Visual Studio.
+ ///
+ [DataContract]
+ internal class VSInternalCompletionContext : CompletionContext
+ {
+ ///
+ /// Gets or sets the indicating how the completion was triggered.
+ ///
+ [DataMember(Name = "_vs_invokeKind")]
+ [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")]
+ [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1500:BracesForMultiLineStatementsShouldNotShareLine", Justification = "There are no issues with this code")]
+ [DefaultValue(VSInternalCompletionInvokeKind.Explicit)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public VSInternalCompletionInvokeKind InvokeKind
+ {
+ get;
+ set;
+ } = VSInternalCompletionInvokeKind.Explicit;
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionInvokeKind.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionInvokeKind.cs
new file mode 100644
index 0000000000000..a8bd492e3ebd2
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionInvokeKind.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Provides value for which specifies
+ /// how completion was invoked.
+ ///
+ [DataContract]
+ internal enum VSInternalCompletionInvokeKind
+ {
+ ///
+ /// Completion was triggered by explicit user's gesture (e.g. Ctrl+Space, Ctr+J) or via API.
+ ///
+ Explicit = 0,
+
+ ///
+ /// Completion was triggered by typing an identifier.
+ ///
+ Typing = 1,
+
+ ///
+ /// Completion was triggered by deletion (e.g. Backspace or Delete keys).
+ ///
+ Deletion = 2,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionItem.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionItem.cs
new file mode 100644
index 0000000000000..7edcd8403e1ef
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionItem.cs
@@ -0,0 +1,56 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Roslyn.Text.Adornments;
+ using Newtonsoft.Json;
+
+ ///
+ /// Extension class for CompletionItem with fields specific to Visual Studio functionalities.
+ ///
+ [DataContract]
+ internal class VSInternalCompletionItem : CompletionItem
+ {
+ internal const string IconSerializedName = "_vs_icon";
+ internal const string DescriptionSerializedName = "_vs_description";
+ internal const string VsCommitCharactersSerializedName = "_vs_commitCharacters";
+ internal const string VsResolveTextEditOnCommitName = "_vs_resolveTextEditOnCommit";
+
+ ///
+ /// Gets or sets the icon to show for the completion item. In VS, this is more extensive than the completion kind.
+ ///
+ [DataMember(Name = IconSerializedName)]
+ [JsonConverter(typeof(ImageElementConverter))]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public ImageElement? Icon { get; set; }
+
+ ///
+ /// Gets or sets the description for a completion item.
+ ///
+ [DataMember(Name = DescriptionSerializedName)]
+ [JsonConverter(typeof(ClassifiedTextElementConverter))]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public ClassifiedTextElement? Description { get; set; }
+
+ ///
+ /// Gets or sets the set of characters that will commit completion when this is selected.
+ /// Allows customization of commit behavior.
+ /// If present, client will use this value instead of .
+ /// If absent, client will default to .
+ ///
+ [DataMember(Name = VsCommitCharactersSerializedName)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public SumType? VsCommitCharacters { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether the client should call to
+ /// get the value of the text edit to commit.
+ ///
+ [DataMember(Name = VsResolveTextEditOnCommitName)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool VsResolveTextEditOnCommit { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionList.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionList.cs
new file mode 100644
index 0000000000000..e6984d8584a40
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionList.cs
@@ -0,0 +1,66 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// A subclass of the LSP protocol that contains extensions specific to Visual Studio.
+ ///
+ [DataContract]
+ internal class VSInternalCompletionList : CompletionList
+ {
+ internal const string SuggestionModeSerializedName = "_vs_suggestionMode";
+ internal const string ContinueCharactersSerializedName = "_vs_continueCharacters";
+ internal const string DataSerializedName = "_vs_data";
+ internal const string CommitCharactersSerializedName = "_vs_commitCharacters";
+
+ ///
+ /// Gets or sets a value indicating whether the completion list should use suggestion mode. In suggestion mode items are "soft-selected" by default.
+ ///
+ [DataMember(Name = SuggestionModeSerializedName)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public bool SuggestionMode
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the continue characters for the completion list.
+ ///
+ [DataMember(Name = ContinueCharactersSerializedName)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public SumType[]? ContinueCharacters
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the default used for completion items.
+ ///
+ [DataMember(Name = DataSerializedName)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? Data
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the default or used for completion items.
+ ///
+ ///
+ /// If set, overrides .
+ ///
+ [DataMember(Name = CommitCharactersSerializedName)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public SumType? CommitCharacters { get; set; }
+
+ // NOTE: Any changes that are added to this file may need to be reflected in its "optimized" counterparts JsonConverter (OptomizedVSCompletionListJsonConverter).
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionListSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionListSetting.cs
new file mode 100644
index 0000000000000..4f613cd4e478a
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionListSetting.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents initialization setting for completion list.
+ ///
+ [DataContract]
+ internal class VSInternalCompletionListSetting
+ {
+ ///
+ /// Gets or sets a value indicating whether completion lists can have Data bags. These data bags get propagated
+ /// onto underlying completion items unless they have their own data bags.
+ ///
+ [DataMember(Name = "_vs_data")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public bool Data
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether completion lists can have VSCommitCharacters. These commit characters get propagated
+ /// onto underlying valid completion items unless they have their own commit characters.
+ ///
+ [DataMember(Name = "_vs_commitCharacters")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public bool CommitCharacters
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionSetting.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionSetting.cs
new file mode 100644
index 0000000000000..41cd0d069d8cb
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalCompletionSetting.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents initialization setting for VS completion.
+ ///
+ [DataContract]
+ internal class VSInternalCompletionSetting : CompletionSetting
+ {
+ ///
+ /// Gets or sets completion list setting.
+ ///
+ [DataMember(Name = "_vs_completionList")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalCompletionListSetting? CompletionList
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalContinueCharacterClass.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalContinueCharacterClass.cs
new file mode 100644
index 0000000000000..dbfacba1f2cf3
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalContinueCharacterClass.cs
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a unicode character class for completion continuation.
+ ///
+ [DataContract]
+ internal class VSInternalContinueCharacterClass
+ {
+ ///
+ /// Gets the type value.
+ ///
+ [DataMember(Name = "_vs_type")]
+ [JsonProperty(Required = Required.Always)]
+ public const string Type = "unicodeClass";
+
+ ///
+ /// Gets or sets the unicode class.
+ ///
+ [DataMember(Name = "_vs_unicodeClass")]
+ [JsonProperty(Required = Required.Always)]
+ public string UnicodeClass { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalContinueCharacterRange.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalContinueCharacterRange.cs
new file mode 100644
index 0000000000000..46bc21e6ba34f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalContinueCharacterRange.cs
@@ -0,0 +1,37 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing range of characters for completion continuation.
+ ///
+ [DataContract]
+ internal class VSInternalContinueCharacterRange
+ {
+ ///
+ /// Gets the type value.
+ ///
+ [DataMember(Name = "_vs_type")]
+ [JsonProperty(Required = Required.Always)]
+ public const string Type = "charRange";
+
+ ///
+ /// Gets or sets the first completion character of the range.
+ ///
+ [DataMember(Name = "_vs_start")]
+ [JsonProperty(Required = Required.Always)]
+ public string Start { get; set; }
+
+ ///
+ /// Gets or sets the last completion character of the range.
+ ///
+ [DataMember(Name = "_vs_end")]
+ [JsonProperty(Required = Required.Always)]
+ public string End { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalContinueCharacterSingle.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalContinueCharacterSingle.cs
new file mode 100644
index 0000000000000..233e1e82129e2
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalContinueCharacterSingle.cs
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing single continue character for completion.
+ ///
+ [DataContract]
+ internal class VSInternalContinueCharacterSingle
+ {
+ ///
+ /// Gets the type value.
+ ///
+ [DataMember(Name = "_vs_type")]
+ [JsonProperty(Required = Required.Always)]
+ public const string Type = "singleChar";
+
+ ///
+ /// Gets or sets the completion character.
+ ///
+ [DataMember(Name = "_vs_char")]
+ [JsonProperty(Required = Required.Always)]
+ public string Character { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentOnAutoInsertOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentOnAutoInsertOptions.cs
new file mode 100644
index 0000000000000..785e96b9decad
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentOnAutoInsertOptions.cs
@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the options for on auto insert.
+ ///
+ [DataContract]
+ internal class VSInternalDocumentOnAutoInsertOptions
+ {
+ ///
+ /// Gets or sets trigger characters for on auto insert.
+ ///
+ [DataMember(Name = "_vs_triggerCharacters")]
+ public string[] TriggerCharacters
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentOnAutoInsertParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentOnAutoInsertParams.cs
new file mode 100644
index 0000000000000..4fe5d9c1897a7
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentOnAutoInsertParams.cs
@@ -0,0 +1,55 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the parameters sent for a textDocument/_ms_onAutoInsert request.
+ ///
+ [DataContract]
+ internal class VSInternalDocumentOnAutoInsertParams : ITextDocumentPositionParams
+ {
+ ///
+ /// Gets or sets the representing the document to format.
+ ///
+ [DataMember(Name = "_vs_textDocument")]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the at which the request was sent.
+ ///
+ [DataMember(Name = "_vs_position")]
+ public Position Position
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the character that was typed.
+ ///
+ [DataMember(Name = "_vs_ch")]
+ public string Character
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the for the request.
+ ///
+ [DataMember(Name = "_vs_options")]
+ public FormattingOptions Options
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentOnAutoInsertResponseItem.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentOnAutoInsertResponseItem.cs
new file mode 100644
index 0000000000000..d9b52602383c3
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentOnAutoInsertResponseItem.cs
@@ -0,0 +1,43 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.ComponentModel;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the response of an AutoInsert response.
+ ///
+ [DataContract]
+ internal class VSInternalDocumentOnAutoInsertResponseItem
+ {
+ ///
+ /// Gets or sets the insert text format of the primary text edit. for supported formats.
+ ///
+ [DataMember(Name = "_vs_textEditFormat")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [DefaultValue(InsertTextFormat.Plaintext)]
+ [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")]
+ [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1500:BracesForMultiLineStatementsShouldNotShareLine", Justification = "There are no issues with this code")]
+ public InsertTextFormat TextEditFormat
+ {
+ get;
+ set;
+ } = InsertTextFormat.Plaintext;
+
+ ///
+ /// Gets or sets the text edit.
+ ///
+ [DataMember(Name = "_vs_textEdit")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public TextEdit TextEdit
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentSpellCheckableParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentSpellCheckableParams.cs
new file mode 100644
index 0000000000000..2bee314d31fa6
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalDocumentSpellCheckableParams.cs
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.Serialization;
+ using System.Text;
+ using Newtonsoft.Json;
+
+ ///
+ /// Parameter for tD/_vs_spellCheckableRanges.
+ ///
+ [DataContract]
+ internal class VSInternalDocumentSpellCheckableParams : VSInternalStreamingParams, IPartialResultParams
+ {
+ ///
+ /// Gets or sets an optional token that a server can use to report partial results (e.g. streaming) to the client.
+ ///
+ [DataMember(Name = Methods.PartialResultTokenName)]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public IProgress? PartialResultToken
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalExecuteCommandClientCapabilities.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalExecuteCommandClientCapabilities.cs
new file mode 100644
index 0000000000000..ba2abd3e80a02
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalExecuteCommandClientCapabilities.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing settings for well-known Visual Studio's code action command.
+ ///
+ [DataContract]
+ internal class VSInternalExecuteCommandClientCapabilities : DynamicRegistrationSetting
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public VSInternalExecuteCommandClientCapabilities()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Value indicating whether the setting can be dynamically registered.
+ public VSInternalExecuteCommandClientCapabilities(bool value)
+ : base(value)
+ {
+ }
+
+ ///
+ /// Gets or sets a set of well-known commands name the given VS-LSP client supports.
+ ///
+ [DataMember(Name = "_vs_supportedCommands")]
+ public string[] SupportedCommands
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalHover.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalHover.cs
new file mode 100644
index 0000000000000..ea9a5ec9094f6
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalHover.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Extension to Hover which adds additional data for colorization.
+ ///
+ internal class VSInternalHover : Hover
+ {
+ ///
+ /// Gets or sets the value which represents the hover content as a tree
+ /// of objects from the Microsoft.VisualStudio.Text.Adornments namespace,
+ /// such as ContainerElements, ClassifiedTextElements and ClassifiedTextRuns.
+ ///
+ [DataMember(Name = "_vs_rawContent")]
+ [JsonConverter(typeof(ObjectContentConverter))]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? RawContent
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalIconMapping.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalIconMapping.cs
new file mode 100644
index 0000000000000..aaf0fe7a8517a
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalIconMapping.cs
@@ -0,0 +1,132 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Response class when asking server to resolve the rendering information of a string kind.
+ ///
+ [DataContract]
+ internal class VSInternalIconMapping : IEquatable
+ {
+ ///
+ /// Gets or sets the ImageElements for a certain kind.
+ ///
+ [DataMember(Name = "_vs_images")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSImageId[]? Images
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the tags for a certain kind. To be used in the absence of ImageIds.
+ ///
+ [DataMember(Name = "_vs_tags")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string[]? Tags
+ {
+ get;
+ set;
+ }
+
+ ///
+ public override bool Equals(object? obj)
+ {
+ return this.Equals(obj as VSInternalIconMapping);
+ }
+
+ ///
+ public bool Equals(VSInternalIconMapping? other)
+ {
+ if (other == null)
+ {
+ return false;
+ }
+
+ return CheckImagesAreEqual(this.Images, other.Images) && CheckTagsAreEqual(this.Tags, other.Tags);
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ var hashCode = 1825600323;
+
+ if (this.Images != null)
+ {
+ for (var i = 0; i < this.Images.Length; i++)
+ {
+ hashCode = (hashCode * -1521134295) + this.Images[i].Guid.GetHashCode();
+ hashCode = (hashCode * -1521134295) + this.Images[i].Id.GetHashCode();
+ }
+ }
+
+ if (this.Tags != null)
+ {
+ for (var i = 0; i < this.Tags.Length; i++)
+ {
+ hashCode = (hashCode * -1521134295) + StringComparer.Ordinal.GetHashCode(this.Tags[i]);
+ }
+ }
+
+ return hashCode;
+ }
+
+ private static bool CheckImagesAreEqual(VSImageId[]? current, VSImageId[]? other)
+ {
+ if (current == null ^ other == null)
+ {
+ return false;
+ }
+
+ if (current != null &&
+ other != null &&
+ current.Length == other.Length)
+ {
+ for (var i = 0; i < current.Length; i++)
+ {
+ if (current[i].Id != other[i].Id)
+ {
+ return false;
+ }
+
+ if (current[i].Guid != other[i].Guid)
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private static bool CheckTagsAreEqual(string[]? current, string[]? other)
+ {
+ if (current == null ^ other == null)
+ {
+ return false;
+ }
+
+ if (current != null &&
+ other != null &&
+ current.Length == other.Length)
+ {
+ for (var i = 0; i < current.Length; i++)
+ {
+ if (!string.Equals(current[i], other[i], StringComparison.Ordinal))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionContext.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionContext.cs
new file mode 100644
index 0000000000000..284ffa5d505ae
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionContext.cs
@@ -0,0 +1,33 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.ComponentModel;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Context for inline completion request.
+ /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L27.
+ ///
+ internal class VSInternalInlineCompletionContext
+ {
+ ///
+ /// Gets or sets how completion was triggered.
+ ///
+ [DataMember(Name = "_vs_triggerKind")]
+ [JsonProperty(Required = Required.Always)]
+ public VSInternalInlineCompletionTriggerKind TriggerKind { get; set; } = VSInternalInlineCompletionTriggerKind.Explicit;
+
+ ///
+ /// Gets or sets information about the currently selected item in the autocomplete widget, if visible.
+ ///
+ /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L45.
+ ///
+ [DataMember(Name = "_vs_selectedCompletionInfo")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public VSInternalSelectedCompletionInfo? SelectedCompletionInfo { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionItem.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionItem.cs
new file mode 100644
index 0000000000000..73fb5c5285852
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionItem.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.ComponentModel;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// A single inline completion item response.
+ ///
+ /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L78.
+ ///
+ internal class VSInternalInlineCompletionItem
+ {
+ ///
+ /// Gets or sets the text to replace the range with.
+ ///
+ [DataMember(Name = "_vs_text")]
+ [JsonProperty(Required = Required.Always)]
+ public string Text { get; set; }
+
+ ///
+ /// Gets or sets the range to replace.
+ ///
+ /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L94.
+ ///
+ [DataMember(Name = "_vs_range")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public Range? Range { get; set; }
+
+ ///
+ /// Gets or sets the command that is executed after inserting this completion item.
+ ///
+ [DataMember(Name = "_vs_command")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public Command? Command { get; set; }
+
+ ///
+ /// Gets or sets the format of the insert text.
+ ///
+ [DataMember(Name = "_vs_insertTextFormat")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public InsertTextFormat? TextFormat { get; set; } = InsertTextFormat.Plaintext;
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionList.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionList.cs
new file mode 100644
index 0000000000000..62f4b20ba0d07
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionList.cs
@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Response for an inline completions request.
+ ///
+ /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L72.
+ ///
+ internal class VSInternalInlineCompletionList
+ {
+ ///
+ /// Gets or sets the inline completion items.
+ ///
+ [DataMember(Name = "_vs_items")]
+ [JsonProperty(Required = Required.Always)]
+ public VSInternalInlineCompletionItem[] Items { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionOptions.cs
new file mode 100644
index 0000000000000..b73012d5900e8
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionOptions.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using System.Text.RegularExpressions;
+
+ using Newtonsoft.Json;
+
+ ///
+ /// The options for inline completion.
+ ///
+ [DataContract]
+ internal class VSInternalInlineCompletionOptions
+ {
+ ///
+ /// Gets or sets a regex used by the client to determine when to ask the server for snippets.
+ ///
+ [DataMember(Name = "_vs_pattern")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonConverter(typeof(RegexConverter))]
+ public Regex Pattern { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionRequest.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionRequest.cs
new file mode 100644
index 0000000000000..fe3840400b762
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionRequest.cs
@@ -0,0 +1,44 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// The request data for an inline completions request.
+ ///
+ /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L24.
+ ///
+ internal class VSInternalInlineCompletionRequest : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the text document.
+ ///
+ [DataMember(Name = "_vs_textDocument")]
+ [JsonProperty(Required = Required.Always)]
+ public TextDocumentIdentifier TextDocument { get; set; }
+
+ ///
+ /// Gets or sets the position where inline completions are being requested.
+ ///
+ [DataMember(Name = "_vs_position")]
+ [JsonProperty(Required = Required.Always)]
+ public Position Position { get; set; }
+
+ ///
+ /// Gets or sets the context for the inline completions request.
+ ///
+ [DataMember(Name = "_vs_context")]
+ [JsonProperty(Required = Required.Always)]
+ public VSInternalInlineCompletionContext Context { get; set; }
+
+ ///
+ /// Gets or sets the for the request.
+ ///
+ [DataMember(Name = "_vs_options")]
+ public FormattingOptions Options { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionTriggerKind.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionTriggerKind.cs
new file mode 100644
index 0000000000000..476a038b93d7f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionTriggerKind.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// How the inline completion request was triggered.
+ /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L58.
+ ///
+ [DataContract]
+ internal enum VSInternalInlineCompletionTriggerKind
+ {
+ ///
+ /// Inline completions were triggered automatically while editing.
+ ///
+ Automatic = 0,
+
+ ///
+ /// Completion was triggered explicitly by a user gesture.
+ ///
+ Explicit = 1,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalItemOrigin.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalItemOrigin.cs
new file mode 100644
index 0000000000000..fe79f9bdd6561
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalItemOrigin.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Enum which represents the origin of an item.
+ ///
+ internal enum VSInternalItemOrigin
+ {
+ ///
+ /// The entry is contained in exact code.
+ ///
+ Exact = 0,
+
+ ///
+ /// The entry is contained in metadata generated from exact information.
+ ///
+ ExactMetadata = 1000,
+
+ ///
+ /// The entry is contained in indexed code.
+ ///
+ Indexed = 2000,
+
+ ///
+ /// The entry is contained in indexed code in the repo where the request originated.
+ ///
+ IndexedInRepo = 2100,
+
+ ///
+ /// The entry is contained in indexed code in the same organization but different repo where the request originated.
+ ///
+ IndexedInOrganization = 2200,
+
+ ///
+ /// The entry is contained in indexed code in a different organization and repo where request originated.
+ ///
+ IndexedInThirdParty = 2300,
+
+ ///
+ /// The entry is of lesser quality than all other choices.
+ ///
+ Other = int.MaxValue,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalKindAndModifier.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalKindAndModifier.cs
new file mode 100644
index 0000000000000..6167f1ff419e3
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalKindAndModifier.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class that contains the base kind and modifiers used to describe a response item.
+ ///
+ [DataContract]
+ internal class VSInternalKindAndModifier : IEquatable
+ {
+ ///
+ /// Gets or sets the ImageIds for a certain kind.
+ ///
+ [DataMember(Name = "_vs_kind")]
+ public string Kind
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the modifier of the kind.
+ ///
+ [DataMember(Name = "_vs_modifier")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string[]? Modifier
+ {
+ get;
+ set;
+ }
+
+ public static bool operator ==(VSInternalKindAndModifier? value1, VSInternalKindAndModifier? value2)
+ {
+ if (ReferenceEquals(value1, value2))
+ {
+ return true;
+ }
+
+ // Is null?
+ if (ReferenceEquals(null, value2))
+ {
+ return false;
+ }
+
+ return value1?.Equals(value2) ?? false;
+ }
+
+ public static bool operator !=(VSInternalKindAndModifier? value1, VSInternalKindAndModifier? value2)
+ {
+ return !(value1 == value2);
+ }
+
+ ///
+ public override bool Equals(object obj)
+ {
+ return this.Equals(obj as VSInternalKindAndModifier);
+ }
+
+ ///
+ public bool Equals(VSInternalKindAndModifier? other)
+ {
+ return other != null &&
+ string.Equals(this.Kind, other.Kind, StringComparison.Ordinal) &&
+ this.CheckModifierEquality(other.Modifier);
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ var hashCode = 1850642763;
+ hashCode = (hashCode * -1521134295) + (this.Kind == null ? 0 : StringComparer.Ordinal.GetHashCode(this.Kind));
+ if (this.Modifier != null)
+ {
+ for (var i = 0; i < this.Modifier.Length; i++)
+ {
+ if (this.Modifier[i] != null)
+ {
+ hashCode = (hashCode * -1521134295) + StringComparer.Ordinal.GetHashCode(this.Modifier[i]);
+ }
+ }
+ }
+
+ return hashCode;
+ }
+
+ private bool CheckModifierEquality(string[]? modifiers)
+ {
+ if (modifiers == null ^ this.Modifier == null)
+ {
+ return false;
+ }
+
+ if (modifiers != null &&
+ this.Modifier != null &&
+ modifiers.Length == this.Modifier.Length)
+ {
+ for (var i = 0; i < modifiers.Length; i++)
+ {
+ if (!string.Equals(modifiers[i], this.Modifier[i], StringComparison.Ordinal))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalKnownKindModifiers.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalKnownKindModifiers.cs
new file mode 100644
index 0000000000000..336ebbd50976e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalKnownKindModifiers.cs
@@ -0,0 +1,75 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Collections.Generic;
+
+ ///
+ /// Known VS response kind modifiers.
+ ///
+ internal static class VSInternalKnownKindModifiers
+ {
+ ///
+ /// Response kind modifier string for 'public'.
+ ///
+ public const string Public = "public";
+
+ ///
+ /// Response kind modifier string for 'private'.
+ ///
+ public const string Private = "private";
+
+ ///
+ /// Response kind modifier string for 'protected'.
+ ///
+ public const string Protected = "protected";
+
+ ///
+ /// Response kind modifier string for 'internal'.
+ ///
+ public const string Internal = "internal";
+
+ ///
+ /// Response kind modifier string for 'sealed'.
+ ///
+ public const string Sealed = "sealed";
+
+ ///
+ /// Response kind modifier string for 'shortcut'.
+ ///
+ public const string Shortcut = "shortcut";
+
+ ///
+ /// Response kind modifier string for 'snippet'.
+ ///
+ public const string Snippet = "snippet";
+
+ ///
+ /// Response kind modifier string for 'friend'.
+ ///
+ public const string Friend = "friend";
+
+ ///
+ /// Response kind modifier string for 'declaration'.
+ ///
+ public const string Declaration = "declaration";
+
+ ///
+ /// Collection of known response kind modifier strings.
+ ///
+ public static readonly IReadOnlyCollection AllModifiers = new[]
+ {
+ Public,
+ Private,
+ Protected,
+ Internal,
+ Sealed,
+ Shortcut,
+ Snippet,
+ Friend,
+ Declaration,
+ };
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalKnownKinds.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalKnownKinds.cs
new file mode 100644
index 0000000000000..8e629a148331b
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalKnownKinds.cs
@@ -0,0 +1,267 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Collections.Generic;
+
+ ///
+ /// Known VS response kinds.
+ ///
+ internal static class VSInternalKnownKinds
+ {
+ ///
+ /// Response kind string for 'text'.
+ ///
+ public const string Text = "text";
+
+ ///
+ /// Response kind string for 'method'.
+ ///
+ public const string Method = "method";
+
+ ///
+ /// Response kind string for 'function'.
+ ///
+ public const string Function = "function";
+
+ ///
+ /// Response kind string for 'constructor'.
+ ///
+ public const string Constructor = "constructor";
+
+ ///
+ /// Response kind string for 'field'.
+ ///
+ public const string Field = "field";
+
+ ///
+ /// Response kind string for 'variable'.
+ ///
+ public const string Variable = "variable";
+
+ ///
+ /// Response kind string for 'class'.
+ ///
+ public const string Class = "class";
+
+ ///
+ /// Response kind string for 'interface'.
+ ///
+ public const string Interface = "interface";
+
+ ///
+ /// Response kind string for 'module'.
+ ///
+ public const string Module = "module";
+
+ ///
+ /// Response kind string for 'property'.
+ ///
+ public const string Property = "property";
+
+ ///
+ /// Response kind string for 'unit'.
+ ///
+ public const string Unit = "unit";
+
+ ///
+ /// Response kind string for 'value'.
+ ///
+ public const string Value = "value";
+
+ ///
+ /// Response kind string for 'enum'.
+ ///
+ public const string Enum = "enum";
+
+ ///
+ /// Response kind string for 'keyword'.
+ ///
+ public const string Keyword = "keyword";
+
+ ///
+ /// Response kind string for 'snippet'.
+ ///
+ public const string Snippet = "snippet";
+
+ ///
+ /// Response kind string for 'color'.
+ ///
+ public const string Color = "color";
+
+ ///
+ /// Response kind string for 'file'.
+ ///
+ public const string File = "file";
+
+ ///
+ /// Response kind string for 'reference'.
+ ///
+ public const string Reference = "reference";
+
+ ///
+ /// Response kind string for 'folder'.
+ ///
+ public const string Folder = "folder";
+
+ ///
+ /// Response kind string for 'enumMember'.
+ ///
+ public const string EnumMember = "enumMember";
+
+ ///
+ /// Response kind string for 'constant'.
+ ///
+ public const string Constant = "constant";
+
+ ///
+ /// Response kind string for 'struct'.
+ ///
+ public const string Struct = "struct";
+
+ ///
+ /// Response kind string for 'event'.
+ ///
+ public const string Event = "event";
+
+ ///
+ /// Response kind string for 'operator'.
+ ///
+ public const string Operator = "operator";
+
+ ///
+ /// Response kind string for 'typeParameter'.
+ ///
+ public const string TypeParameter = "typeParameter";
+
+ ///
+ /// Response kind string for 'namespace'.
+ ///
+ public const string Namespace = "namespace";
+
+ ///
+ /// Response kind string for 'package'.
+ ///
+ public const string Package = "package";
+
+ ///
+ /// Response kind string for 'string'.
+ ///
+ public const string StringKind = "string";
+
+ ///
+ /// Response kind string for 'number'.
+ ///
+ public const string Number = "number";
+
+ ///
+ /// Response kind string for 'boolean'.
+ ///
+ public const string Boolean = "boolean";
+
+ ///
+ /// Response kind string for 'array'.
+ ///
+ public const string Array = "array";
+
+ ///
+ /// Response kind string for 'object'.
+ ///
+ public const string ObjectKind = "object";
+
+ ///
+ /// Response kind string for 'key'.
+ ///
+ public const string Key = "key";
+
+ ///
+ /// Response kind string for 'null'.
+ ///
+ public const string Null = "null";
+
+ ///
+ /// Response kind string for 'macro'.
+ ///
+ public const string Macro = "macro";
+
+ ///
+ /// Response kind string for 'template'.
+ ///
+ public const string Template = "template";
+
+ ///
+ /// Response kind string for 'typedef'.
+ ///
+ public const string Typedef = "typedef";
+
+ ///
+ /// Response kind string for 'union'.
+ ///
+ public const string Union = "union";
+
+ ///
+ /// Response kind string for 'delegate'.
+ ///
+ public const string Delegate = "delegate";
+
+ ///
+ /// Response kind string for 'tag'.
+ ///
+ public const string Tag = "tag";
+
+ ///
+ /// Response kind string for 'attribute'.
+ ///
+ public const string Attribute = "attribute";
+
+ ///
+ /// Collection of response kind strings.
+ ///
+ public static readonly IReadOnlyCollection AllKinds = new[]
+ {
+ Text,
+ Method,
+ Function,
+ Constructor,
+ Field,
+ Variable,
+ Class,
+ Interface,
+ Module,
+ Property,
+ Unit,
+ Value,
+ Enum,
+ Keyword,
+ Snippet,
+ Color,
+ File,
+ Reference,
+ Folder,
+ EnumMember,
+ Constant,
+ Struct,
+ Event,
+ Operator,
+ TypeParameter,
+ Namespace,
+ Package,
+ StringKind,
+ Number,
+ Boolean,
+ Array,
+ ObjectKind,
+ Key,
+ Null,
+ Macro,
+ Template,
+ Typedef,
+ Union,
+ Delegate,
+ Tag,
+ Attribute,
+ };
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalLocation.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalLocation.cs
new file mode 100644
index 0000000000000..4c62c6fb74ec5
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalLocation.cs
@@ -0,0 +1,46 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Roslyn.Text.Adornments;
+ using Newtonsoft.Json;
+
+ ///
+ /// Extension class for . Used to relay reference text information with colorization.
+ ///
+ [DataContract]
+ internal class VSInternalLocation : VSLocation
+ {
+ private object? textValue = null;
+
+ ///
+ /// Gets or sets the text value for a location reference. Must be of type or or or .
+ ///
+ [DataMember(Name = "_vs_text")]
+ [JsonConverter(typeof(ObjectContentConverter))]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? Text
+ {
+ get
+ {
+ return this.textValue;
+ }
+
+ set
+ {
+ if (value is ImageElement || value is ContainerElement || value is ClassifiedTextElement || value is string)
+ {
+ this.textValue = value;
+ }
+ else
+ {
+ throw new InvalidOperationException($"{value?.GetType()} is an invalid type.");
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalMethods.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalMethods.cs
new file mode 100644
index 0000000000000..8f5fc764f2de3
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalMethods.cs
@@ -0,0 +1,122 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Class which contains the string values for all Language Server Protocol Visual Studio specific methods.
+ ///
+ internal static class VSInternalMethods
+ {
+ ///
+ /// Method name for 'textDocument/foldingRange/_vs_refresh'.
+ ///
+ public const string DocumentFoldingRangeRefreshName = "textDocument/foldingRange/_vs_refresh";
+
+ ///
+ /// Method name for 'textDocument/_vs_references'.
+ ///
+ public const string DocumentReferencesName = "textDocument/_vs_references";
+
+ ///
+ /// Method name for 'textDocument/_vs_onAutoInsert'.
+ ///
+ public const string OnAutoInsertName = "textDocument/_vs_onAutoInsert";
+
+ ///
+ /// Method name for 'textDocument/_vs_iconMappingResolve'.
+ ///
+ public const string TextDocumentIconMappingResolveName = "textDocument/_vs_iconMappingResolve";
+
+ ///
+ /// Method name for 'textdocument/_vs_diagnostic'.
+ ///
+ public const string DocumentPullDiagnosticName = "textdocument/_vs_diagnostic";
+
+ ///
+ /// Method name for 'workspace/_vs_diagnostic'.
+ ///
+ public const string WorkspacePullDiagnosticName = "workspace/_vs_diagnostic";
+
+ ///
+ /// Method name for 'textDocument/_vs_validateBreakableRange'.
+ ///
+ public const string TextDocumentValidateBreakableRangeName = "textDocument/_vs_validateBreakableRange";
+
+ ///
+ /// Method name for 'textDocument/_vs_inlineCompletion'.
+ ///
+ public const string TextDocumentInlineCompletionName = "textDocument/_vs_inlineCompletion";
+
+ ///
+ /// Method name for 'textDocument/_vs_spellCheckableRanges'.
+ ///
+ public const string TextDocumentSpellCheckableRangesName = "textDocument/_vs_spellCheckableRanges";
+
+ ///
+ /// Method name for 'textDocument/_vs_uriPresentation'.
+ ///
+ public const string TextDocumentUriPresentationName = "textDocument/_vs_uriPresentation";
+
+ ///
+ /// Method name for 'textDocument/_vs_textPresentation'.
+ ///
+ public const string TextDocumentTextPresentationName = "textDocument/_vs_textPresentation";
+
+ ///
+ /// Method name for 'workspace/_vs_spellCheckableRanges'.
+ ///
+ public const string WorkspaceSpellCheckableRangesName = "workspace/_vs_spellCheckableRanges";
+
+ ///
+ /// Strongly typed message object for 'textDocument/_vs_onAutoInsert'.
+ ///
+ public static readonly LspRequest OnAutoInsert = new LspRequest(OnAutoInsertName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/_vs_iconMappingResolve'.
+ ///
+ public static readonly LspRequest TextDocumentIconMappingResolve = new LspRequest(TextDocumentIconMappingResolveName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/_vs_diagnostic'.
+ ///
+ public static readonly LspRequest DocumentPullDiagnostic = new LspRequest(DocumentPullDiagnosticName);
+
+ ///
+ /// Strongly typed message object for 'workspace/_vs_diagnostic'.
+ ///
+ public static readonly LspRequest WorkspacePullDiagnostic = new LspRequest(WorkspacePullDiagnosticName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/_vs_validateBreakableRange'.
+ ///
+ public static readonly LspRequest TextDocumentValidateBreakableRange = new LspRequest(TextDocumentValidateBreakableRangeName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/inlineCompletion'.
+ ///
+ public static readonly LspRequest TextDocumentInlineCompletion = new LspRequest(TextDocumentInlineCompletionName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/_vs_uriPresentation'.
+ ///
+ public static readonly LspRequest TextDocumentUriPresentation = new LspRequest(TextDocumentUriPresentationName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/_vs_textPresentation'.
+ ///
+ public static readonly LspRequest TextDocumentTextPresentation = new LspRequest(TextDocumentTextPresentationName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/_vs_spellCheckableRanges'.
+ ///
+ public static readonly LspRequest TextDocumentSpellCheckableRanges = new LspRequest(TextDocumentSpellCheckableRangesName);
+
+ ///
+ /// Strongly typed message object for 'workspace/_vs_spellCheckableRanges'.
+ ///
+ public static readonly LspRequest WorkspaceSpellCheckableRanges = new LspRequest(WorkspaceSpellCheckableRangesName);
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalMultipleContextFeatures.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalMultipleContextFeatures.cs
new file mode 100644
index 0000000000000..54b2578b76c25
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalMultipleContextFeatures.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Lists the features that support sending off feature requests for all available project contexts instead of the default active one.
+ ///
+ [DataContract]
+ internal class VSInternalMultipleContextFeatures
+ {
+ ///
+ /// Gets or sets a value indicating whether the server provides support for sending diagnostics requests for all project contexts.
+ ///
+ [DataMember(Name = "_vs_SupportsMultipleContextDiagnostics")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool SupportsMultipleContextsDiagnostics
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalPriorityLevel.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalPriorityLevel.cs
new file mode 100644
index 0000000000000..c13a7e297b072
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalPriorityLevel.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Enum which represents the various reference kinds.
+ ///
+ internal enum VSInternalPriorityLevel
+ {
+ ///
+ /// Lowest priority.
+ ///
+ Lowest = 0,
+
+ ///
+ /// Low priority.
+ ///
+ Low = 1,
+
+ ///
+ /// Medium priority.
+ ///
+ Normal = 2,
+
+ ///
+ /// High priority.
+ ///
+ High = 3,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalProjectContext.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalProjectContext.cs
new file mode 100644
index 0000000000000..4334c1b2aff26
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalProjectContext.cs
@@ -0,0 +1,81 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class for a project context.
+ ///
+ [DataContract]
+ internal class VSInternalProjectContext : VSProjectContext, IEquatable
+ {
+ ///
+ /// Gets or sets the string context kind of the project context.
+ ///
+ [DataMember(Name = "_vs_vsKind")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalKindAndModifier? VSKind
+ {
+ get;
+ set;
+ }
+
+ public static bool operator ==(VSInternalProjectContext? value1, VSInternalProjectContext? value2)
+ {
+ if (ReferenceEquals(value1, value2))
+ {
+ return true;
+ }
+
+ if (value2 is null)
+ {
+ return false;
+ }
+
+ return value1?.Equals(value2) ?? false;
+ }
+
+ public static bool operator !=(VSInternalProjectContext? value1, VSInternalProjectContext? value2)
+ {
+ return !(value1 == value2);
+ }
+
+ ///
+ public bool Equals(VSInternalProjectContext other)
+ {
+ return base.Equals(other)
+ && this.VSKind == other.VSKind;
+ }
+
+ ///
+ public override bool Equals(VSProjectContext other)
+ {
+ return this.Equals((object)other);
+ }
+
+ ///
+ public override bool Equals(object obj)
+ {
+ if (obj is VSInternalProjectContext other)
+ {
+ return this.Equals(other);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ return base.GetHashCode()
+ ^ (this.VSKind == null ? 13 : this.VSKind.GetHashCode() * 79);
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceItem.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceItem.cs
new file mode 100644
index 0000000000000..cf551ec93172e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceItem.cs
@@ -0,0 +1,195 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Roslyn.Text.Adornments;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents references information.
+ ///
+ [DataContract]
+ internal class VSInternalReferenceItem
+ {
+ private object? definitionTextValue = null;
+ private object? textValue = null;
+
+ ///
+ /// Gets or sets the reference id.
+ ///
+ [DataMember(Name = "_vs_id", IsRequired = true)]
+ public int Id
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the reference location.
+ ///
+ [DataMember(Name = "_vs_location")]
+ public Location Location
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the definition Id.
+ ///
+ [DataMember(Name = "_vs_definitionId")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public int? DefinitionId
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the definition text displayed as a header when references are grouped by Definition.
+ /// Must be of type , , and .
+ ///
+ ///
+ /// This element should colorize syntax, but should not contain highlighting, e.g.
+ /// embedded within should not define .
+ ///
+ [DataMember(Name = "_vs_definitionText")]
+ [JsonConverter(typeof(ObjectContentConverter))]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? DefinitionText
+ {
+ get
+ {
+ return this.definitionTextValue;
+ }
+
+ set
+ {
+ if (value == null || // Null is accepted since for non-definition references
+ (value is ImageElement || value is ContainerElement || value is ClassifiedTextElement || value is string))
+ {
+ this.definitionTextValue = value;
+ }
+ else
+ {
+ throw new InvalidOperationException($"{value.GetType()} is an invalid type.");
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the resolution status.
+ ///
+ [DataMember(Name = "_vs_resolutionStatus")]
+ public VSInternalResolutionStatusKind ResolutionStatus
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the reference kind.
+ ///
+ [DataMember(Name = "_vs_kind")]
+ public VSInternalReferenceKind[] Kind
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the document name to be displayed to user when needed.This can be used in cases where URI doesn't have a user friendly file name or it is a remote URI.
+ ///
+ [DataMember(Name = "_vs_documentName")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? DocumentName { get; set; }
+
+ ///
+ /// Gets or sets the project name.
+ ///
+ [DataMember(Name = "_vs_projectName")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? ProjectName { get; set; }
+
+ ///
+ /// Gets or sets the containing type.
+ ///
+ [DataMember(Name = "_vs_containingType")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? ContainingType { get; set; }
+
+ ///
+ /// Gets or sets the containing member.
+ ///
+ [DataMember(Name = "_vs_containingMember")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? ContainingMember { get; set; }
+
+ ///
+ /// Gets or sets the text value for a location reference.
+ /// Must be of type or or or .
+ ///
+ ///
+ ///
+ /// This element should colorize syntax and highlight the range containing the reference.
+ /// Highlighting can be achieved by setting
+ /// on embedded within .
+ ///
+ ///
+ /// Encouraged values for are:
+ /// "MarkerFormatDefinition/HighlightedReference" for read references,
+ /// "MarkerFormatDefinition/HighlightedWrittenReference" for write references,
+ /// "MarkerFormatDefinition/HighlightedDefinition" for definitions.
+ ///
+ ///
+ [DataMember(Name = "_vs_text")]
+ [JsonConverter(typeof(ObjectContentConverter))]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public object? Text
+ {
+ get
+ {
+ return this.textValue;
+ }
+
+ set
+ {
+ if (value is ImageElement || value is ContainerElement || value is ClassifiedTextElement || value is string)
+ {
+ this.textValue = value;
+ }
+ else
+ {
+ throw new InvalidOperationException($"{value?.GetType()} is an invalid type.");
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the text value for display path.This would be a friendly display name for scenarios where the actual path on disk may be confusing for users.
+ /// This doesn't have to correspond to a real file path, but does need to be parsable by the various Path.GetFileName() methods.
+ ///
+ [DataMember(Name = "_vs_displayPath")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? DisplayPath { get; set; }
+
+ ///
+ /// Gets or sets the origin of the item.The origin is used to filter remote results.
+ ///
+ [DataMember(Name = "_vs_origin")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalItemOrigin? Origin { get; set; }
+
+ ///
+ /// Gets or sets the icon to show for the definition header.
+ ///
+ [DataMember(Name = "_vs_definitionIcon")]
+ [JsonConverter(typeof(ImageElementConverter))]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public ImageElement? DefinitionIcon { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceKind.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceKind.cs
new file mode 100644
index 0000000000000..b511340956f5c
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceKind.cs
@@ -0,0 +1,104 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Diagnostics.CodeAnalysis;
+
+ ///
+ /// Enum which represents the various reference kinds.
+ ///
+ internal enum VSInternalReferenceKind
+ {
+ ///
+ /// Reference in inactive code block.
+ ///
+ Inactive,
+
+ ///
+ /// Reference in comment.
+ ///
+ Comment,
+
+ ///
+ /// Reference in a string.
+ ///
+ String,
+
+ ///
+ /// Read operation on the reference.
+ ///
+ Read,
+
+ ///
+ /// Write operation on the reference.
+ ///
+ Write,
+
+ ///
+ /// Reference.
+ ///
+ Reference,
+
+ ///
+ /// Name.
+ ///
+ Name,
+
+ ///
+ /// Qualified.
+ ///
+ Qualified,
+
+ ///
+ /// Type Argument.
+ ///
+ TypeArgument,
+
+ ///
+ /// Type Constraint.
+ ///
+ TypeConstraint,
+
+ ///
+ /// Base Type.
+ ///
+ BaseType,
+
+ ///
+ /// Construct.
+ ///
+ Constructor,
+
+ ///
+ /// Destructor.
+ ///
+ Destructor,
+
+ ///
+ /// Import.
+ ///
+ Import,
+
+ ///
+ /// Declaration.
+ ///
+ Declaration,
+
+ ///
+ /// Address of.
+ ///
+ AddressOf,
+
+ ///
+ /// Not a reference.
+ ///
+ NotReference,
+
+ ///
+ /// Unknown.
+ ///
+ Unknown,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceParams.cs
new file mode 100644
index 0000000000000..a302b2baeb3ce
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceParams.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents extensions of passed as parameter of find reference requests.
+ ///
+ internal class VSInternalReferenceParams : ReferenceParams
+ {
+ ///
+ /// Gets or sets a value indicating the scope of returned items.
+ ///
+ [DataMember(Name = "_vs_scope")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalItemOrigin? Scope
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameOptionSelection.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameOptionSelection.cs
new file mode 100644
index 0000000000000..4fe711ae387b5
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameOptionSelection.cs
@@ -0,0 +1,38 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the user configuration (as defined in ) for a rename request.
+ ///
+ [DataContract]
+ internal class VSInternalRenameOptionSelection
+ {
+ ///
+ /// Gets or sets the name that identifies the option.
+ ///
+ [DataMember(Name = "_vs_name")]
+ [JsonProperty(Required = Required.Always)]
+ public string Name
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the user selected the option.
+ ///
+ [DataMember(Name = "_vs_value")]
+ [JsonProperty(Required = Required.Always)]
+ public bool Value
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameOptionSupport.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameOptionSupport.cs
new file mode 100644
index 0000000000000..4614f862c3eb2
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameOptionSupport.cs
@@ -0,0 +1,49 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a renaming option for customizing the edit in the 'textDocument/rename' request.
+ ///
+ [DataContract]
+ internal class VSInternalRenameOptionSupport
+ {
+ ///
+ /// Gets or sets the name that identifies the option.
+ ///
+ [DataMember(Name = "_vs_name")]
+ [JsonProperty(Required = Required.Always)]
+ public string Name
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the user-facing option label.
+ ///
+ [DataMember(Name = "_vs_label")]
+ [JsonProperty(Required = Required.Always)]
+ public string Label
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the option has a default value of true.
+ ///
+ [DataMember(Name = "_vs_default")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool Default
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameParams.cs
new file mode 100644
index 0000000000000..969228507d1b8
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameParams.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the parameters (together with extra VS-specific options) sent for the
+ /// 'textDocument/rename' request.
+ ///
+ [DataContract]
+ internal class VSInternalRenameParams : RenameParams
+ {
+ ///
+ /// Gets or sets the rename option values as selected by the user.
+ ///
+ [DataMember(Name = "_vs_optionSelections")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalRenameOptionSelection[]? OptionSelections
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameRange.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameRange.cs
new file mode 100644
index 0000000000000..092944a6dadae
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalRenameRange.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents a possible result value of the 'textDocument/prepareRename' request,
+ /// together with extra VS-specific options.
+ ///
+ [DataContract]
+ internal class VSInternalRenameRange : RenameRange
+ {
+ ///
+ /// Gets or sets the supported options for the rename request.
+ ///
+ [DataMember(Name = "_vs_supportedOptions")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalRenameOptionSupport[]? SupportedOptions
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalResolutionStatusKind.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalResolutionStatusKind.cs
new file mode 100644
index 0000000000000..871001c9ad550
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalResolutionStatusKind.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Enum which represents the various resolutions for a reference entry.
+ ///
+ internal enum VSInternalResolutionStatusKind
+ {
+ ///
+ /// Entry has been processed and confirmed as a reference.
+ ///
+ ConfirmedAsReference,
+
+ ///
+ /// Entry has been processed and confimed as not a reference.
+ ///
+ ConfirmedAsNotReference,
+
+ ///
+ /// Entry has been processed but could not be confirmed.
+ ///
+ NotConfirmed,
+
+ ///
+ /// Entry has not been processed.
+ ///
+ NotProcessed,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSelectedCompletionInfo.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSelectedCompletionInfo.cs
new file mode 100644
index 0000000000000..566acebde174c
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSelectedCompletionInfo.cs
@@ -0,0 +1,45 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Information about the selected completion item for .
+ ///
+ /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L48.
+ ///
+ internal class VSInternalSelectedCompletionInfo
+ {
+ ///
+ /// Gets or sets the range of the selected completion item.
+ ///
+ [DataMember(Name = "_vs_range")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public Range Range { get; set; }
+
+ ///
+ /// Gets or sets the text of the selected completion item.
+ ///
+ [DataMember(Name = "_vs_text")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public string Text { get; set; }
+
+ ///
+ /// Gets or sets the completion item kind of the selected completion item.
+ ///
+ [DataMember(Name = "_vs_completionKind")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public CompletionItemKind CompletionKind { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether the completion item is a snippet.
+ ///
+ [DataMember(Name = "_vs_isSnippetText")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool IsSnippetText { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalServerCapabilities.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalServerCapabilities.cs
new file mode 100644
index 0000000000000..644a6a437fd46
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalServerCapabilities.cs
@@ -0,0 +1,168 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ using Newtonsoft.Json;
+
+ ///
+ /// Extension class for ServerCapabilities with fields specific to Visual Studio.
+ ///
+ [DataContract]
+ internal class VSInternalServerCapabilities : VSServerCapabilities
+ {
+ ///
+ /// Gets or sets a value indicating whether or not GoTo's integration with
+ /// 'workspace/symbol' and the deprecated 16.3 'workspace/beginSymbol' messages
+ /// should be disabled.
+ ///
+ ///
+ /// This is provided to facilitate transition from in-proc to OOP for teams that
+ /// currently own both a Language Server for Ctrl+Q and a GoTo provider.
+ ///
+ [DataMember(Name = "_vs_disableGoToWorkspaceSymbols")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool DisableGoToWorkspaceSymbols
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether document/_ms_references is supported.
+ ///
+ [DataMember(Name = "_vs_ReferencesProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool MSReferencesProvider
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server supports OnAutoInsert.
+ ///
+ [DataMember(Name = "_vs_onAutoInsertProvider")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalDocumentOnAutoInsertOptions? OnAutoInsertProvider
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server requires document text to be included in textDocument/didOpen notifications.
+ ///
+ /// This capability is not intended to be included into the official LSP, hence _ms_ prefix.
+ [DataMember(Name = "_vs_doNotIncludeTextInTextDocumentDidOpen")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool DoNotIncludeTextInTextDocumentDidOpen
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server provides support to resolve string based response kinds.
+ ///
+ [DataMember(Name = "_vs_KindDescriptionResolveProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool KindDescriptionResolveProvider
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server provides support for diagnostic pull requests.
+ ///
+ [DataMember(Name = "_vs_supportsDiagnosticRequests")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool SupportsDiagnosticRequests
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets server specified options for diagnostic pull requests.
+ ///
+ [DataMember(Name = "_vs_diagnosticProvider")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalDiagnosticOptions? DiagnosticProvider
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server provides support for multiple context requests.
+ ///
+ [DataMember(Name = "_vs_MultipleContextSupportProvider")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalMultipleContextFeatures? MultipleContextSupportProvider
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server provides support for inline completion requests.
+ ///
+ [DataMember(Name = "_vs_inlineCompletionOptions")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalInlineCompletionOptions? InlineCompletionOptions
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server provides support for spell checking.
+ ///
+ [DataMember(Name = "_vs_spellCheckingProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool SpellCheckingProvider
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server supports validating breakable ranges.
+ ///
+ [DataMember(Name = "_vs_breakableRangeProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool BreakableRangeProvider
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server supports uri presentation.
+ ///
+ [DataMember(Name = "_vs_uriPresentationProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool UriPresentationProvider
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the server supports text presentation.
+ ///
+ [DataMember(Name = "_vs_textPresentationProvider")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool TextPresentationProvider
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSignatureInformation.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSignatureInformation.cs
new file mode 100644
index 0000000000000..74ca607565159
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSignatureInformation.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Roslyn.Text.Adornments;
+ using Newtonsoft.Json;
+
+ ///
+ /// Extension class for signature help information which contains colorized label information.
+ ///
+ [DataContract]
+ internal class VSInternalSignatureInformation : SignatureInformation
+ {
+ ///
+ /// Gets or sets the value representing the colorized label.
+ ///
+ [DataMember(Name = "_vs_colorizedLabel")]
+ [JsonConverter(typeof(ClassifiedTextElementConverter))]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public ClassifiedTextElement? ColorizedLabel
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSnippetSupportLevel.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSnippetSupportLevel.cs
new file mode 100644
index 0000000000000..7bf24583957e9
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSnippetSupportLevel.cs
@@ -0,0 +1,22 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// The version of support that is available from the client.
+ ///
+ internal enum VSInternalSnippetSupportLevel
+ {
+ ///
+ /// Only default tab stops ($0) are supported.
+ ///
+ DefaultTabStop = 1,
+
+ ///
+ /// Complete snippet support is available.
+ ///
+ Complete = 99,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSpellCheckableRangeKind.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSpellCheckableRangeKind.cs
new file mode 100644
index 0000000000000..d3c3022366495
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSpellCheckableRangeKind.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Enum to represent the spell checkable region kinds.
+ ///
+ internal enum VSInternalSpellCheckableRangeKind
+ {
+ ///
+ /// Represents a span of a string.
+ ///
+ String = 0,
+
+ ///
+ /// Represents a span of a comment.
+ ///
+ Comment = 1,
+
+ ///
+ /// Represents a span of an identifier declaration.
+ ///
+ Identifier = 2,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSpellCheckableRangeReport.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSpellCheckableRangeReport.cs
new file mode 100644
index 0000000000000..ca3264b7e8c30
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSpellCheckableRangeReport.cs
@@ -0,0 +1,67 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ using Newtonsoft.Json;
+
+ ///
+ /// Report of spell checkable ranges.
+ ///
+ [DataContract]
+ internal class VSInternalSpellCheckableRangeReport
+ {
+ ///
+ /// Gets or sets the server-generated version number for the spell checkable ranges.
+ /// This is treated as a black box by the client: it is stored on the client
+ /// for each textDocument and sent back to the server when requesting
+ /// spell checkable ranges. The server can use this result ID to avoid resending
+ /// spell checkable ranges that had previously been sent.
+ ///
+ [DataMember(Name = "_vs_resultId")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? ResultId { get; set; }
+
+ ///
+ /// Gets or sets an array containing encoded ranges to spell check.
+ ///
+ ///
+ /// The data structure is as the following:
+ /// 1. property can contain multiple spans to spell check.
+ /// 2. Each span is defined by a set of 3 ordered integers in the property.
+ /// 3. The span's ordered information are the following:
+ /// 1. A kind, corresponding to the numeric value of .
+ /// 2. A start position, which is the character index where the span starts in the document buffer.
+ /// The start position should be the relative offset from the end of the previous span, regardless of whether that span is the same range
+ /// or a prior range.
+ /// 3. The length of the span.
+ /// 4. Spans should be ordered by their absolute start position in the document buffer.
+ ///
+ ///
+ /// [
+ /// /* ---- First span in the document, admitting this is the first report returned. ---- */
+ /// 1, // The kind of the span. Equivalent to .
+ /// 123, // This is the very first span's start position. The position is relative to the beginning of the document buffer.
+ /// 5, // Span length
+ /// /* ---- Second span in the document ---- */
+ /// 0, // Equivalent to .
+ /// 6, // Start position relative to the first span in the document. Absolute span position is therefore (123 + 5) + 6 = 134.
+ /// 4, // Span length
+ /// /* ---- Third span in the document ---- */
+ /// 0, // Equivalent to .
+ /// 12, // Start position relative to the second span. Absolute span position is therefore (134 + 4) + 12 = 150
+ /// 5 // Span length
+ /// ]
+ ///
+ [DataMember(Name = "_vs_ranges")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public int[]? Ranges
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalStreamingParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalStreamingParams.cs
new file mode 100644
index 0000000000000..3b0e082213ebe
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalStreamingParams.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a streaming pull request parameter used.
+ ///
+ /// TODO: Deprecate VSInternalDiagnosticParams.cs to use this merged param instead.
+ ///
+ [DataContract]
+ internal class VSInternalStreamingParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the document for which the feature is being requested for.
+ ///
+ [DataMember(Name = "_vs_textDocument", IsRequired = true)]
+ public TextDocumentIdentifier TextDocument { get; set; }
+
+ ///
+ /// Gets or sets the server-generated version number for the feature request.
+ ///
+ ///
+ ///
+ /// This is treated as a black box by the client: it is stored on the client
+ /// for each textDocument and sent back to the server when requesting
+ /// the feature. The server can use this result ID to avoid resending
+ /// feature results that had previously been sent.
+ ///
+ /// Note that if a client does request results that haven’t changed, the
+ /// language server should not reply with any results for that document.
+ /// If the client requests results for a file that has been renamed or
+ /// deleted, then the language service should respond with null for the
+ /// results.
+ /// Also, if a service is reporting multiple reports for the same
+ /// document, then all reports are expected to have the same
+ /// previousResultId.
+ ///
+ [DataMember(Name = "_vs_previousResultId")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? PreviousResultId { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSymbolInformation.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSymbolInformation.cs
new file mode 100644
index 0000000000000..7e241f9b91960
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSymbolInformation.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Extension class for SymbolInformation with fields specific to Visual Studio functionalities.
+ ///
+ ///
+ /// This is a temporary protocol and should not be used.
+ ///
+ [DataContract]
+ internal class VSInternalSymbolInformation : VSSymbolInformation
+ {
+ ///
+ /// Gets or sets the string kind used for icons.
+ ///
+ [DataMember(Name = "_vs_vsKind")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalKindAndModifier? VSKind { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextDocumentClientCapabilities.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextDocumentClientCapabilities.cs
new file mode 100644
index 0000000000000..1ae592269a85e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextDocumentClientCapabilities.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Text document capabilities specific to Visual Studio.
+ ///
+ internal class VSInternalTextDocumentClientCapabilities : TextDocumentClientCapabilities
+ {
+ ///
+ /// Gets or sets the setting which determines if on auto insert can be dynamically registered.
+ ///
+ [DataMember(Name = "_vs_onAutoInsert")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public DynamicRegistrationSetting? OnAutoInsert
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextDocumentRegistrationOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextDocumentRegistrationOptions.cs
new file mode 100644
index 0000000000000..e73b246d01f2e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextDocumentRegistrationOptions.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// / Class representing the options for registering textDocument/_vs_OnAutoInsert support.
+ ///
+ [DataContract]
+ internal class VSInternalTextDocumentRegistrationOptions : TextDocumentRegistrationOptions
+ {
+ ///
+ /// Gets or sets trigger characters for on auto insert.
+ ///
+ [DataMember(Name = "_vs_triggerCharacters")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string[]? TriggerCharacters
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextPresentationParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextPresentationParams.cs
new file mode 100644
index 0000000000000..3ec280d525972
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextPresentationParams.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the parameters sent for a textDocument/_vs_textPresentation request.
+ ///
+ [DataContract]
+ internal class VSInternalTextPresentationParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the identifier for the text document to be operate on.
+ ///
+ [DataMember(Name = "_vs_textDocument")]
+ [JsonProperty(Required = Required.Always)]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the range.
+ ///
+ [DataMember(Name = "_vs_range")]
+ [JsonProperty(Required = Required.Always)]
+ public Range Range
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the text.
+ ///
+ [DataMember(Name = "_vs_text")]
+ public string? Text
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalUriPresentationParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalUriPresentationParams.cs
new file mode 100644
index 0000000000000..3736b48506e1e
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalUriPresentationParams.cs
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the parameters sent for a textDocument/_vs_uriPresentation request.
+ ///
+ [DataContract]
+ internal class VSInternalUriPresentationParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the identifier for the text document to be operate on.
+ ///
+ [DataMember(Name = "_vs_textDocument")]
+ [JsonProperty(Required = Required.Always)]
+ public TextDocumentIdentifier TextDocument
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the range.
+ ///
+ [DataMember(Name = "_vs_range")]
+ [JsonProperty(Required = Required.Always)]
+ public Range Range
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the URI values. Valid for DropKind.Uris.
+ ///
+ [DataMember(Name = "_vs_uris")]
+ [JsonProperty(ItemConverterType = typeof(DocumentUriConverter))]
+ public Uri[]? Uris
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalValidateBreakableRangeParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalValidateBreakableRangeParams.cs
new file mode 100644
index 0000000000000..f9a4464b2e282
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalValidateBreakableRangeParams.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the parameters sent for the textDocument/validateBreakableRange request.
+ ///
+ [DataContract]
+ internal class VSInternalValidateBreakableRangeParams : ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the for the request.
+ ///
+ [DataMember(Name = "_vs_textDocument")]
+ public TextDocumentIdentifier TextDocument { get; set; }
+
+ ///
+ /// Gets or sets the at which the request was sent.
+ ///
+ [DataMember(Name = "_vs_range")]
+ public Range Range { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalWellKnownCodeActionCommands.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalWellKnownCodeActionCommands.cs
new file mode 100644
index 0000000000000..3dabb55e89dfe
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalWellKnownCodeActionCommands.cs
@@ -0,0 +1,22 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Class which contains the string values for all well-known Visual Studion LSP code action commands.
+ ///
+ internal static class VSInternalWellKnownCodeActionCommands
+ {
+ ///
+ /// Command name for '_ms_setClipboard'.
+ ///
+ public const string SetClipboard = "_ms_setClipboard";
+
+ ///
+ /// Command name for '_ms_openUrl'.
+ ///
+ public const string OpenUrl = "_ms_openUrl";
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalWorkspaceSpellCheckableParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalWorkspaceSpellCheckableParams.cs
new file mode 100644
index 0000000000000..516eb1c8218ea
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalWorkspaceSpellCheckableParams.cs
@@ -0,0 +1,37 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.Serialization;
+ using System.Text;
+ using Newtonsoft.Json;
+
+ ///
+ /// Parameter for workspace/_vs_spellCheckableRanges.
+ ///
+ [DataContract]
+ internal class VSInternalWorkspaceSpellCheckableParams : IPartialResultParams
+ {
+ ///
+ /// Gets or sets the current state of the documents the client already has received.
+ ///
+ [DataMember(Name = "_vs_previousResults")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public VSInternalStreamingParams[]? PreviousResults { get; set; }
+
+ ///
+ /// Gets or sets an optional token that a server can use to report partial results (e.g. streaming) to the client.
+ ///
+ [DataMember(Name = "_vs_partialResultToken")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public IProgress? PartialResultToken
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalWorkspaceSpellCheckableReport.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalWorkspaceSpellCheckableReport.cs
new file mode 100644
index 0000000000000..a844892b092b1
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalWorkspaceSpellCheckableReport.cs
@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.Serialization;
+ using System.Text;
+
+ ///
+ /// Report for workspace spell checkable range request.
+ ///
+ [DataContract]
+ internal class VSInternalWorkspaceSpellCheckableReport : VSInternalSpellCheckableRangeReport, ITextDocumentParams
+ {
+ ///
+ /// Gets or sets the document for which the spell checkable ranges are returned.
+ ///
+ [DataMember(Name = "_vs_textDocument", IsRequired = true)]
+ public TextDocumentIdentifier TextDocument { get; set; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/LanguageServer.Protocol.csproj b/src/Features/LanguageServer/Protocol/Protocol/LanguageServer.Protocol.csproj
new file mode 100644
index 0000000000000..bba922bb53a16
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/LanguageServer.Protocol.csproj
@@ -0,0 +1,59 @@
+
+
+ Microsoft.VisualStudio.LanguageServer.Protocol
+
+
+
+
+
+
+ Microsoft.VisualStudio.LanguageServer.Protocol
+ netstandard2.0
+ true
+ LanguageServer.Protocol.ruleset
+ false
+ true
+ true
+
+
+ true
+ A .NET implementation of the Language Server Protocol
+ $(Summary)
+ false
+ true
+ true
+ Microsoft VisualStudio LanguageServer Language Server Protocol VSSDK
+ $(PackageOutputPath)\nuget-public
+ true
+ RS0037,SA1011,1591,8618,CA1704
+ en-US
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+
+
diff --git a/src/Features/LanguageServer/Protocol/Protocol/LanguageServer.Protocol.ruleset b/src/Features/LanguageServer/Protocol/Protocol/LanguageServer.Protocol.ruleset
new file mode 100644
index 0000000000000..05183f019ae27
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/LanguageServer.Protocol.ruleset
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/LinkedEditingRangeOptions.cs b/src/Features/LanguageServer/Protocol/Protocol/LinkedEditingRangeOptions.cs
new file mode 100644
index 0000000000000..0afeffb82a826
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/LinkedEditingRangeOptions.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class which represents linked editing range capabilities.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class LinkedEditingRangeOptions : IWorkDoneProgressOptions
+ {
+ ///
+ /// Gets or sets a value indicating whether work done progress is supported.
+ ///
+ [DataMember(Name = "workDoneProgress")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public bool WorkDoneProgress
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/LinkedEditingRangeParams.cs b/src/Features/LanguageServer/Protocol/Protocol/LinkedEditingRangeParams.cs
new file mode 100644
index 0000000000000..d24bfd158ddd3
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/LinkedEditingRangeParams.cs
@@ -0,0 +1,18 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing the parameters sent for a textDocument/linkedEditingRange request.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class LinkedEditingRangeParams : TextDocumentPositionParams
+ {
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/LinkedEditingRanges.cs b/src/Features/LanguageServer/Protocol/Protocol/LinkedEditingRanges.cs
new file mode 100644
index 0000000000000..9c0b78fd5c768
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/LinkedEditingRanges.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing the response of an LinkedEditingRanges response.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class LinkedEditingRanges
+ {
+ ///
+ /// Gets or sets the ranges for the type rename.
+ ///
+ [DataMember(Name = "ranges")]
+ public Range[] Ranges
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the word pattern for the type rename.
+ ///
+ [DataMember(Name = "wordPattern")]
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public string? WordPattern
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Location.cs b/src/Features/LanguageServer/Protocol/Protocol/Location.cs
new file mode 100644
index 0000000000000..e91082e4441dd
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Location.cs
@@ -0,0 +1,64 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing a location in a document.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class Location : IEquatable
+ {
+ ///
+ /// Gets or sets the URI for the document the location belongs to.
+ ///
+ [DataMember(Name = "uri")]
+ [JsonConverter(typeof(DocumentUriConverter))]
+ public Uri Uri
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the range of the location in the document.
+ ///
+ [DataMember(Name = "range")]
+ public Range Range
+ {
+ get;
+ set;
+ }
+
+ ///
+ public override bool Equals(object obj)
+ {
+ return this.Equals(obj as Location);
+ }
+
+ ///
+ public bool Equals(Location? other)
+ {
+ return other != null && this.Uri != null && other.Uri != null &&
+ this.Uri.Equals(other.Uri) &&
+ EqualityComparer.Default.Equals(this.Range, other.Range);
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ var hashCode = 1486144663;
+ hashCode = (hashCode * -1521134295) + EqualityComparer.Default.GetHashCode(this.Uri);
+ hashCode = (hashCode * -1521134295) + EqualityComparer.Default.GetHashCode(this.Range);
+ return hashCode;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/LogMessageParams.cs b/src/Features/LanguageServer/Protocol/Protocol/LogMessageParams.cs
new file mode 100644
index 0000000000000..8d80b156e99a5
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/LogMessageParams.cs
@@ -0,0 +1,37 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represents parameter sent with window/logMessage requests.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class LogMessageParams
+ {
+ ///
+ /// Gets or sets the type of message.
+ ///
+ [DataMember(Name = "type")]
+ public MessageType MessageType
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the message.
+ ///
+ [DataMember(Name = "message")]
+ public string Message
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/LspNotification.cs b/src/Features/LanguageServer/Protocol/Protocol/LspNotification.cs
new file mode 100644
index 0000000000000..6466578c0a0ba
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/LspNotification.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Strongly typed object used to specify a LSP notification's parameter type.
+ ///
+ /// The parameter type.
+ internal class LspNotification
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The name of the JSON-RPC notification.
+ public LspNotification(string name)
+ {
+ this.Name = name;
+ }
+
+ ///
+ /// Gets the name of the JSON-RPC notification.
+ ///
+ public string Name { get; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/LspRequest.cs b/src/Features/LanguageServer/Protocol/Protocol/LspRequest.cs
new file mode 100644
index 0000000000000..17a0cf2c97441
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/LspRequest.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Strongly typed object used to specify a LSP requests's parameter and return types.
+ ///
+ /// The parameter type.
+ /// The return type.
+ internal class LspRequest
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The name of the JSON-RPC request.
+ public LspRequest(string name)
+ {
+ this.Name = name;
+ }
+
+ ///
+ /// Gets the name of the JSON-RPC request.
+ ///
+ public string Name { get; }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/MarkedString.cs b/src/Features/LanguageServer/Protocol/Protocol/MarkedString.cs
new file mode 100644
index 0000000000000..62c6b0d8a16d1
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/MarkedString.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Class representing human readable text that should be rendered.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class MarkedString
+ {
+ ///
+ /// Gets or sets the language of the code stored in .
+ ///
+ [DataMember(Name = "language")]
+ [JsonProperty(Required = Required.Always)]
+ public string Language
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the code.
+ ///
+ [DataMember(Name = "value")]
+ [JsonProperty(Required = Required.Always)]
+ public string Value
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/MarkupContent.cs b/src/Features/LanguageServer/Protocol/Protocol/MarkupContent.cs
new file mode 100644
index 0000000000000..ce92eda072808
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/MarkupContent.cs
@@ -0,0 +1,37 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class representing text and an associated format that should be rendered.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class MarkupContent
+ {
+ ///
+ /// Gets or sets the representing the text's format.
+ ///
+ [DataMember(Name = "kind")]
+ public MarkupKind Kind
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the text that should be rendered.
+ ///
+ [DataMember(Name = "value")]
+ public string Value
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/MarkupKind.cs b/src/Features/LanguageServer/Protocol/Protocol/MarkupKind.cs
new file mode 100644
index 0000000000000..29dda1ba997c7
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/MarkupKind.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.ComponentModel;
+ using System.Runtime.Serialization;
+ using Newtonsoft.Json;
+
+ ///
+ /// Value representing the various formats of markup text.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ [JsonConverter(typeof(StringEnumConverter))]
+ [TypeConverter(typeof(StringEnumConverter.TypeConverter))]
+ internal readonly record struct MarkupKind(string Value) : IStringEnum
+ {
+ ///
+ /// Markup type is plain text.
+ ///
+ public static readonly MarkupKind PlainText = new("plaintext");
+
+ ///
+ /// Markup type is Markdown.
+ ///
+ public static readonly MarkupKind Markdown = new("markdown");
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/MessageActionItem.cs b/src/Features/LanguageServer/Protocol/Protocol/MessageActionItem.cs
new file mode 100644
index 0000000000000..4dc981f6f1827
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/MessageActionItem.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class which represent an action the user performs after a window/showMessageRequest request is sent.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal class MessageActionItem
+ {
+ ///
+ /// Gets or sets the title.
+ ///
+ [DataMember(Name = "title")]
+ public string Title
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LanguageServer/Protocol/Protocol/MessageType.cs b/src/Features/LanguageServer/Protocol/Protocol/MessageType.cs
new file mode 100644
index 0000000000000..3b243d8a2f55f
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/MessageType.cs
@@ -0,0 +1,37 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ using System.Runtime.Serialization;
+
+ ///
+ /// Message type enum.
+ ///
+ /// See the Language Server Protocol specification for additional information.
+ ///
+ [DataContract]
+ internal enum MessageType
+ {
+ ///
+ /// Error message.
+ ///
+ Error = 1,
+
+ ///
+ /// Warning message.
+ ///
+ Warning = 2,
+
+ ///
+ /// Info message.
+ ///
+ Info = 3,
+
+ ///
+ /// Log message.
+ ///
+ Log = 4,
+ }
+}
diff --git a/src/Features/LanguageServer/Protocol/Protocol/Methods.cs b/src/Features/LanguageServer/Protocol/Protocol/Methods.cs
new file mode 100644
index 0000000000000..0bf3fd4109733
--- /dev/null
+++ b/src/Features/LanguageServer/Protocol/Protocol/Methods.cs
@@ -0,0 +1,603 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Roslyn.LanguageServer.Protocol
+{
+ ///
+ /// Class which contains the string values for all common language protocol methods.
+ ///
+ internal static class Methods
+ {
+ ///
+ /// Method name for 'initialize'.
+ ///
+ public const string InitializeName = "initialize";
+
+ ///
+ /// Method name for 'initialized'.
+ ///
+ public const string InitializedName = "initialized";
+
+ ///
+ /// Method name for '$/progress' notifications.
+ ///
+ public const string ProgressNotificationName = "$/progress";
+
+ ///
+ /// Name of the progress token in the request.
+ ///
+ public const string PartialResultTokenName = "partialResultToken";
+
+ ///
+ /// Name of the progress token in the request.
+ ///
+ public const string PartialResultTokenPropertyName = "PartialResultToken";
+
+ ///
+ /// Name of the work done token in the request.
+ ///
+ public const string WorkDoneTokenName = "workDoneToken";
+
+ ///
+ /// Name of the progress token in the $/progress notification.
+ ///
+ public const string ProgressNotificationTokenName = "token";
+
+ ///
+ /// Method name for 'textDocument/codeAction'.
+ ///
+ public const string TextDocumentCodeActionName = "textDocument/codeAction";
+
+ ///
+ /// Method name for 'textDocument/codeLens'.
+ ///
+ public const string TextDocumentCodeLensName = "textDocument/codeLens";
+
+ ///
+ /// Method name for 'codeAction/resolve'.
+ ///
+ public const string CodeActionResolveName = "codeAction/resolve";
+
+ ///
+ /// Method name for 'codeLens/resolve'.
+ ///
+ public const string CodeLensResolveName = "codeLens/resolve";
+
+ ///
+ /// Method name for 'textDocument/completion'.
+ ///
+ public const string TextDocumentCompletionName = "textDocument/completion";
+
+ ///
+ /// Method name for 'completionItem/resolve'.
+ ///
+ public const string TextDocumentCompletionResolveName = "completionItem/resolve";
+
+ ///
+ /// Method name for 'textDocument/definition'.
+ ///
+ public const string TextDocumentDefinitionName = "textDocument/definition";
+
+ ///
+ /// Method name for 'textDocument/diagnostic'.
+ ///
+ public const string TextDocumentDiagnosticName = "textDocument/diagnostic";
+
+ ///
+ /// Method name for 'textDocument/didOpen'.
+ ///
+ public const string TextDocumentDidOpenName = "textDocument/didOpen";
+
+ ///
+ /// Method name for 'textDocument/didClose'.
+ ///
+ public const string TextDocumentDidCloseName = "textDocument/didClose";
+
+ ///
+ /// Method name for 'textDocument/didChange'.
+ ///
+ public const string TextDocumentDidChangeName = "textDocument/didChange";
+
+ ///
+ /// Method name for 'textDocument/didSave'.
+ ///
+ public const string TextDocumentDidSaveName = "textDocument/didSave";
+
+ ///
+ /// Method name for 'textDocument/documentHighlight'.
+ ///
+ public const string TextDocumentDocumentHighlightName = "textDocument/documentHighlight";
+
+ ///
+ /// Method name for 'textDocument/documentLink'.
+ ///
+ public const string TextDocumentDocumentLinkName = "textDocument/documentLink";
+
+ ///
+ /// Method name for 'documentLink/resolve'.
+ ///
+ public const string DocumentLinkResolveName = "documentLink/resolve";
+
+ ///
+ /// Method name for 'textDocument/documentColor'.
+ ///
+ public const string TextDocumentDocumentColorName = "textDocument/documentColor";
+
+ ///
+ /// Method name for 'textDocument/documentSymbol'.
+ ///
+ public const string TextDocumentDocumentSymbolName = "textDocument/documentSymbol";
+
+ ///
+ /// Method name for 'textDocument/foldingRange'.
+ ///
+ public const string TextDocumentFoldingRangeName = "textDocument/foldingRange";
+
+ ///
+ /// Method name for 'textDocument/formatting'.
+ ///
+ public const string TextDocumentFormattingName = "textDocument/formatting";
+
+ ///
+ /// Method name for 'textDocument/hover'.
+ ///
+ public const string TextDocumentHoverName = "textDocument/hover";
+
+ ///
+ /// Method name for 'textDocument/onTypeFormatting'.
+ ///
+ public const string TextDocumentOnTypeFormattingName = "textDocument/onTypeFormatting";
+
+ ///
+ /// Method name for 'textDocument/rangeFormatting'.
+ ///
+ public const string TextDocumentRangeFormattingName = "textDocument/rangeFormatting";
+
+ ///
+ /// Method name for 'textDocument/publishDiagnostics'.
+ ///
+ public const string TextDocumentPublishDiagnosticsName = "textDocument/publishDiagnostics";
+
+ ///
+ /// Method name for 'textDocument/implementation'.
+ ///
+ public const string TextDocumentImplementationName = "textDocument/implementation";
+
+ ///
+ /// Method name for 'textDocument/inlayHint'.
+ ///
+ public const string TextDocumentInlayHintName = "textDocument/inlayHint";
+
+ ///
+ /// Method name for 'inlayHint/resolve'.
+ ///
+ public const string InlayHintResolveName = "inlayHint/resolve";
+
+ ///
+ /// Method name for 'textDocument/typeDefinition'.
+ ///
+ public const string TextDocumentTypeDefinitionName = "textDocument/typeDefinition";
+
+ ///
+ /// Method name for 'textDocument/references'.
+ ///
+ public const string TextDocumentReferencesName = "textDocument/references";
+
+ ///
+ /// Method name for 'textDocument/rename'.
+ ///
+ public const string TextDocumentRenameName = "textDocument/rename";
+
+ ///
+ /// Method name for 'textDocument/prepareRename'.
+ ///
+ public const string TextDocumentPrepareRenameName = "textDocument/prepareRename";
+
+ ///
+ /// Method name for 'textDocument/semanticTokens/full'.
+ ///
+ public const string TextDocumentSemanticTokensFullName = "textDocument/semanticTokens/full";
+
+ ///
+ /// Method name for 'textDocument/semanticTokens/range'.
+ ///
+ public const string TextDocumentSemanticTokensRangeName = "textDocument/semanticTokens/range";
+
+ ///
+ /// Method name for 'textDocument/semanticTokens/full/delta'.
+ ///
+ public const string TextDocumentSemanticTokensFullDeltaName = "textDocument/semanticTokens/full/delta";
+
+ ///
+ /// Method name for 'textDocument/signatureHelp'.
+ ///
+ public const string TextDocumentSignatureHelpName = "textDocument/signatureHelp";
+
+ ///
+ /// Method name for 'textDocument/willSave'.
+ ///
+ public const string TextDocumentWillSaveName = "textDocument/willSave";
+
+ ///
+ /// Method name for 'textDocument/willSaveWaitUntil'.
+ ///
+ public const string TextDocumentWillSaveWaitUntilName = "textDocument/willSaveWaitUntil";
+
+ ///
+ /// Method name for 'textDocument/linkedEditingRange'.
+ ///
+ public const string TextDocumentLinkedEditingRangeName = "textDocument/linkedEditingRange";
+
+ ///
+ /// Method name for 'window/logMessage'.
+ ///
+ public const string WindowLogMessageName = "window/logMessage";
+
+ ///
+ /// Method name for 'window/showMessage'.
+ ///
+ public const string WindowShowMessageName = "window/showMessage";
+
+ ///
+ /// Method name for 'window/showMessageRequest'.
+ ///
+ public const string WindowShowMessageRequestName = "window/showMessageRequest";
+
+ ///
+ /// Method name for 'workspace/applyEdit'.
+ ///
+ public const string WorkspaceApplyEditName = "workspace/applyEdit";
+
+ ///
+ /// Method name for 'workspace/semanticTokens/refresh'.
+ ///
+ public const string WorkspaceSemanticTokensRefreshName = "workspace/semanticTokens/refresh";
+
+ ///
+ /// Method name for 'workspace/configuration'.
+ ///
+ public const string WorkspaceConfigurationName = "workspace/configuration";
+
+ ///
+ /// Method name for 'workspace/diagnostic'.
+ ///
+ public const string WorkspaceDiagnosticName = "workspace/diagnostic";
+
+ ///
+ /// Method name for 'workspace/diagnostic/refresh'.
+ ///
+ public const string WorkspaceDiagnosticRefreshName = "workspace/diagnostic/refresh";
+
+ ///
+ /// Method name for 'workspace/didChangeConfiguration'.
+ ///
+ public const string WorkspaceDidChangeConfigurationName = "workspace/didChangeConfiguration";
+
+ ///
+ /// Method name for 'workspace/executeCommand'.
+ ///
+ public const string WorkspaceExecuteCommandName = "workspace/executeCommand";
+
+ ///
+ /// Method name for 'workspace/symbol'.
+ ///
+ public const string WorkspaceSymbolName = "workspace/symbol";
+
+ ///
+ /// Method name for 'workspace/didChangeWatchedFiles'.
+ ///
+ public const string WorkspaceDidChangeWatchedFilesName = "workspace/didChangeWatchedFiles";
+
+ ///
+ /// Method name for 'workspace/codeLens/refresh'.
+ ///
+ public const string WorkspaceCodeLensRefreshName = "workspace/codeLens/refresh";
+
+ ///
+ /// Method name for 'workspace/inlayHint/refresh'.
+ ///
+ public const string WorkspaceInlayHintRefreshName = "workspace/inlayHint/refresh";
+
+ ///
+ /// Method name for 'shutdown'.
+ ///
+ public const string ShutdownName = "shutdown";
+
+ ///
+ /// Method name for 'exit'.
+ ///
+ public const string ExitName = "exit";
+
+ ///
+ /// Method name for 'telemetry/event'.
+ ///
+ public const string TelemetryEventName = "telemetry/event";
+
+ ///
+ /// Method name for 'client/registerCapability'.
+ ///
+ public const string ClientRegisterCapabilityName = "client/registerCapability";
+
+ ///
+ /// Method name for 'client/unregisterCapability'.
+ ///
+ public const string ClientUnregisterCapabilityName = "client/unregisterCapability";
+
+ ///
+ /// Strongly typed message object for 'initialize'.
+ ///
+ public static readonly LspRequest Initialize = new LspRequest(InitializeName);
+
+ ///
+ /// Strongly typed message object for 'initialized'.
+ ///
+ public static readonly LspNotification Initialized = new LspNotification(InitializedName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/codeAction'.
+ ///
+ public static readonly LspRequest[]?> TextDocumentCodeAction = new LspRequest[]?>(TextDocumentCodeActionName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/codeLens'.
+ ///
+ public static readonly LspRequest TextDocumentCodeLens = new LspRequest(TextDocumentCodeLensName);
+
+ ///
+ /// Strongly typed message object for 'codeAction/resolve'.
+ ///
+ public static readonly LspRequest CodeActionResolve = new LspRequest(CodeActionResolveName);
+
+ ///
+ /// Strongly typed message object for 'codeLens/resolve'.
+ ///
+ public static readonly LspRequest CodeLensResolve = new LspRequest(CodeLensResolveName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/completion'.
+ ///
+ public static readonly LspRequest?> TextDocumentCompletion = new LspRequest?>(TextDocumentCompletionName);
+
+ ///
+ /// Strongly typed message object for 'completionItem/resolve'.
+ ///
+ public static readonly LspRequest TextDocumentCompletionResolve = new LspRequest(TextDocumentCompletionResolveName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/definition'.
+ ///
+ public static readonly LspRequest?> TextDocumentDefinition = new LspRequest?>(TextDocumentDefinitionName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/didOpen'.
+ ///
+ public static readonly LspNotification TextDocumentDidOpen = new LspNotification(TextDocumentDidOpenName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/didClose'.
+ ///
+ public static readonly LspNotification TextDocumentDidClose = new LspNotification(TextDocumentDidCloseName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/didChange'.
+ ///
+ public static readonly LspNotification TextDocumentDidChange = new LspNotification(TextDocumentDidChangeName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/didSave'.
+ ///
+ public static readonly LspNotification TextDocumentDidSave = new LspNotification(TextDocumentDidSaveName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/documentHighlight'.
+ ///
+ public static readonly LspRequest TextDocumentDocumentHighlight = new LspRequest(TextDocumentDocumentHighlightName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/documentLink'.
+ ///
+ public static readonly LspRequest TextDocumentDocumentLink = new LspRequest(TextDocumentDocumentLinkName);
+
+ ///
+ /// Strongly typed message object for 'documentLink/resolve'.
+ ///
+ public static readonly LspRequest DocumentLinkResolve = new LspRequest(DocumentLinkResolveName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/documentColor'.
+ ///
+ public static readonly LspRequest DocumentColorRequest = new LspRequest(TextDocumentDocumentColorName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/documentSymbol'.
+ ///
+ public static readonly LspRequest TextDocumentDocumentSymbol = new LspRequest(TextDocumentDocumentSymbolName);
+
+ ///
+ /// Stronly typed message object for 'textDocument/foldingRange'.
+ ///
+ public static readonly LspRequest TextDocumentFoldingRange = new LspRequest(TextDocumentFoldingRangeName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/formatting'.
+ ///
+ public static readonly LspRequest TextDocumentFormatting = new LspRequest(TextDocumentFormattingName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/hover'.
+ ///
+ public static readonly LspRequest TextDocumentHover = new LspRequest(TextDocumentHoverName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/onTypeFormatting'.
+ ///
+ public static readonly LspRequest TextDocumentOnTypeFormatting = new LspRequest(TextDocumentOnTypeFormattingName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/rangeFormatting'.
+ ///
+ public static readonly LspRequest TextDocumentRangeFormatting = new LspRequest(TextDocumentRangeFormattingName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/publishDiagnostics'.
+ ///
+ public static readonly LspNotification TextDocumentPublishDiagnostics = new LspNotification(TextDocumentPublishDiagnosticsName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/implementation'.
+ ///
+ public static readonly LspRequest?> TextDocumentImplementation = new LspRequest?>(TextDocumentImplementationName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/inlayHint'.
+ ///
+ public static readonly LspRequest TextDocumentInlayHint = new LspRequest(TextDocumentInlayHintName);
+
+ ///
+ /// Strongly typed message object for 'inlayHint/resolve'.
+ ///
+ public static readonly LspRequest InlayHintResolve = new LspRequest(InlayHintResolveName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/typeDefinition'.
+ ///
+ public static readonly LspRequest?> TextDocumentTypeDefinition = new LspRequest?>(TextDocumentTypeDefinitionName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/references'.
+ ///
+ public static readonly LspRequest TextDocumentReferences = new LspRequest(TextDocumentReferencesName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/rename'.
+ ///
+ public static readonly LspRequest TextDocumentRename = new LspRequest(TextDocumentRenameName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/prepareRename'.
+ ///
+ public static readonly LspRequest?> TextDocumentPrepareRename = new LspRequest?>(TextDocumentPrepareRenameName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/signatureHelp'.
+ ///
+ public static readonly LspRequest TextDocumentSignatureHelp = new LspRequest(TextDocumentSignatureHelpName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/willSave'.
+ ///
+ public static readonly LspNotification TextDocumentWillSave = new LspNotification(TextDocumentWillSaveName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/willSaveWaitUntil'.
+ ///
+ public static readonly LspRequest TextDocumentWillSaveWaitUntil = new LspRequest(TextDocumentWillSaveWaitUntilName);
+
+ ///
+ /// Strongly typed message object for 'textDocument/linkedEditingRange'.
+ ///
+ public static readonly LspRequest TextDocumentLinkedEditingRange = new LspRequest(TextDocumentLinkedEditingRangeName);
+
+ ///
+ /// Strongly typed message object for 'window/logMessage'.
+ ///
+ public static readonly LspNotification WindowLogMessage = new LspNotification(WindowLogMessageName);
+
+ ///
+ /// Strongly typed message object for 'window/showMessage'.
+ ///
+ public static readonly LspNotification WindowShowMessage = new LspNotification(WindowShowMessageName);
+
+ ///
+ /// Strongly typed message object for 'window/showMessageRequest'.
+ ///
+ public static readonly LspRequest WindowShowMessageRequest = new LspRequest(WindowShowMessageRequestName);
+
+ ///
+ /// Strongly typed message object for 'workspace/applyEdit'.
+ ///
+ public static readonly LspRequest WorkspaceApplyEdit = new LspRequest(WorkspaceApplyEditName);
+
+ ///
+ /// Strongly typed message object for 'workspace/semanticTokens/refresh'.
+ ///
+ public static readonly LspRequest WorkspaceSemanticTokensRefresh = new LspRequest(WorkspaceSemanticTokensRefreshName);
+
+ ///
+ /// Strongly typed message object for 'workspace/configuration'.
+ ///
+ public static readonly LspRequest WorkspaceConfiguration = new LspRequest(WorkspaceConfigurationName);
+
+ ///
+ /// Strongly typed message object for 'workspace/didChangeConfiguration'.
+ ///
+ public static readonly LspNotification WorkspaceDidChangeConfiguration = new LspNotification(WorkspaceDidChangeConfigurationName);
+
+ ///
+ /// Strongly typed message object for 'workspace/executeCommand'.
+ ///
+ public static readonly LspRequest WorkspaceExecuteCommand = new LspRequest(WorkspaceExecuteCommandName);
+
+ ///