Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet committed Jul 16, 2024
1 parent 1fe4dd7 commit 40a7559
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ internal abstract partial class AbstractInProcLanguageClient(
ILspServiceLoggerFactory lspLoggerFactory,
IThreadingContext threadingContext,
ExportProvider exportProvider,
AbstractLanguageClientMiddleLayer? middleLayer = null) : ILanguageClient, ILanguageServerFactory, ICapabilitiesProvider, ILanguageClientCustomMessage2, IPropertyOwner
AbstractLanguageClientMiddleLayer? middleLayer = null)
: ILanguageClient, ILanguageServerFactory, ICapabilitiesProvider, ILanguageClientCustomMessage2, IPropertyOwner
{
private readonly IThreadingContext _threadingContext = threadingContext;
private readonly ILanguageClientMiddleLayer2<JsonElement>? _middleLayer = middleLayer;
Expand Down Expand Up @@ -101,6 +102,10 @@ internal abstract partial class AbstractInProcLanguageClient(
/// </summary>
public IEnumerable<string>? FilesToWatch { get; }

/// <summary>
/// Property collection used by the client.
/// This is where we set the property to enable the use of client side System.Text.Json serialization.
/// </summary>
public PropertyCollection Properties { get; } = CreateStjPropertyCollection();

public event AsyncEventHandler<EventArgs>? StartAsync;
Expand Down Expand Up @@ -271,6 +276,7 @@ public virtual AbstractLanguageServer<RequestContext> Create(
private static PropertyCollection CreateStjPropertyCollection()
{
var collection = new PropertyCollection();
// These are well known property names used by the LSP client to enable STJ client side serialization.
collection.AddProperty("lsp-serialization", "stj");
return collection;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.VisualStudio.LanguageServer.Client;
using Newtonsoft.Json.Linq;

namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient;

#pragma warning disable CS0618 // Type or member is obsolete - blocked on Razor switching to new APIs for STJ - https://github.com/dotnet/roslyn/issues/73317
internal abstract class AbstractLanguageClientMiddleLayer : ILanguageClientMiddleLayer2<JsonElement>
#pragma warning restore CS0618 // Type or member is obsolete
{
public abstract bool CanHandle(string methodName);

Expand Down

0 comments on commit 40a7559

Please sign in to comment.