diff --git a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/contentFiles/.editorconfig b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/contentFiles/.editorconfig
index 43cb3d22d6e6..e10491047f54 100644
--- a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/contentFiles/.editorconfig
+++ b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/contentFiles/.editorconfig
@@ -11,4 +11,8 @@ generated_code = true
# The above configurations don't apply to compiler warnings. Requiring all params to be documented
# is not something we require for this project, so suppressing it directly here.
-dotnet_diagnostic.CS1573.severity = none
\ No newline at end of file
+dotnet_diagnostic.CS1573.severity = none
+
+# As above, we need to specifically disable compiler warnings that we don't want to break downstream
+# builds
+dotnet_diagnostic.IDE0005.severity = none
\ No newline at end of file
diff --git a/src/LanguageServer/Protocol/WellKnownLspServerKinds.cs b/src/LanguageServer/Protocol/WellKnownLspServerKinds.cs
index da3f8390d0ac..a837cd105e93 100644
--- a/src/LanguageServer/Protocol/WellKnownLspServerKinds.cs
+++ b/src/LanguageServer/Protocol/WellKnownLspServerKinds.cs
@@ -57,7 +57,6 @@ public static string ToUserVisibleString(this WellKnownLspServerKinds server)
{
return server switch
{
- WellKnownLspServerKinds.RazorCohostServer => "Razor Cohost Language Server Client",
WellKnownLspServerKinds.RazorLspServer => "Razor C# Language Server Client",
WellKnownLspServerKinds.LiveShareLspServer => "Live Share C#/Visual Basic Language Server Client",
WellKnownLspServerKinds.AlwaysActiveVSLspServer => "Roslyn Language Server Client",
@@ -75,8 +74,6 @@ public static string ToTelemetryString(this WellKnownLspServerKinds server)
{
return server switch
{
- WellKnownLspServerKinds.RazorCohostServer => "RazorCohostLanguageClient",
-
// Telemetry was previously reported as RazorInProcLanguageClient.GetType().Name
WellKnownLspServerKinds.RazorLspServer => "RazorInProcLanguageClient",
@@ -104,7 +101,6 @@ public static string GetContractName(this WellKnownLspServerKinds server)
{
return server switch
{
- WellKnownLspServerKinds.RazorCohostServer => ProtocolConstants.RazorCohostContract,
WellKnownLspServerKinds.RazorLspServer => ProtocolConstants.RoslynLspLanguagesContract,
WellKnownLspServerKinds.LiveShareLspServer => ProtocolConstants.RoslynLspLanguagesContract,
WellKnownLspServerKinds.AlwaysActiveVSLspServer => ProtocolConstants.RoslynLspLanguagesContract,
diff --git a/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorLspService.cs b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorLspService.cs
index fe2161116ec4..0b5225952f94 100644
--- a/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorLspService.cs
+++ b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorLspService.cs
@@ -7,7 +7,7 @@
namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost;
///
-/// Base class for services that need to live in Razor but be exported using
+/// Base class for services that need to live in Razor but cannot be exported using
/// since those services must implement but the Razor code doesn't have IVT to it.
///
internal abstract class AbstractRazorLspService : ILspService
diff --git a/src/Tools/ExternalAccess/Razor/Cohost/Constants.cs b/src/Tools/ExternalAccess/Razor/Cohost/Constants.cs
index 71a70b2de65d..7998718ced3d 100644
--- a/src/Tools/ExternalAccess/Razor/Cohost/Constants.cs
+++ b/src/Tools/ExternalAccess/Razor/Cohost/Constants.cs
@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
-using System.Collections.Immutable;
using Microsoft.CodeAnalysis.LanguageServer;
namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost;
@@ -12,12 +11,6 @@ internal static class Constants
{
public const string RazorLanguageName = LanguageInfoProvider.RazorLanguageName;
- public const string RazorLSPContentType = "Razor";
-
- public const string RazorLanguageContract = ProtocolConstants.RazorCohostContract;
-
- public static readonly ImmutableArray RazorLanguage = ImmutableArray.Create("Razor");
-
// The UI context is provided by Razor, so this guid must match the one in https://github.com/dotnet/razor/blob/main/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/RazorConstants.cs
public static readonly Guid RazorCohostingUIContext = new Guid("6d5b86dc-6b8a-483b-ae30-098a3c7d6774");
}
diff --git a/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorLspServiceFactoryAttribute.cs b/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorLspServiceFactoryAttribute.cs
deleted file mode 100644
index 8c23bcce2509..000000000000
--- a/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorLspServiceFactoryAttribute.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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.Composition;
-using Microsoft.CodeAnalysis.LanguageServer;
-
-namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost;
-
-[AttributeUsage(AttributeTargets.Class), MetadataAttribute]
-internal class ExportRazorLspServiceFactoryAttribute(Type handlerType) : ExportLspServiceFactoryAttribute(handlerType, Constants.RazorLanguageContract, WellKnownLspServerKinds.RazorCohostServer)
-{
-}
diff --git a/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorStatelessLspServiceAttribute.cs b/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorStatelessLspServiceAttribute.cs
deleted file mode 100644
index 3728932cce87..000000000000
--- a/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorStatelessLspServiceAttribute.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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.Composition;
-using Microsoft.CodeAnalysis.LanguageServer;
-
-namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost;
-
-[AttributeUsage(AttributeTargets.Class), MetadataAttribute]
-internal class ExportRazorStatelessLspServiceAttribute(Type handlerType) : ExportStatelessLspServiceAttribute(handlerType, Constants.RazorLanguageContract, WellKnownLspServerKinds.RazorCohostServer)
-{
-}
diff --git a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostCapabilitiesProvider.cs b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostCapabilitiesProvider.cs
deleted file mode 100644
index 1679c16c6165..000000000000
--- a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostCapabilitiesProvider.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-// 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 Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost;
-
-internal interface IRazorCohostCapabilitiesProvider
-{
- string GetCapabilities(string clientCapabilities);
-}
diff --git a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostLanguageClientActivationService.cs b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostLanguageClientActivationService.cs
deleted file mode 100644
index 4b1a3fc34067..000000000000
--- a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostLanguageClientActivationService.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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 Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost;
-
-internal interface IRazorCohostLanguageClientActivationService
-{
- ///
- /// Returns whether the Razor cohost server should activate
- ///
- bool ShouldActivateCohostServer();
-}
diff --git a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostTextDocumentSyncHandler.cs b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostTextDocumentSyncHandler.cs
deleted file mode 100644
index 7c897daaae63..000000000000
--- a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostTextDocumentSyncHandler.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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.Threading;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis.LanguageServer.Handler;
-using Microsoft.CommonLanguageServerProtocol.Framework;
-using Roslyn.LanguageServer.Protocol;
-
-namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost;
-
-internal interface IRazorCohostTextDocumentSyncHandler
-{
- Task HandleAsync(int version, RazorCohostRequestContext context, CancellationToken cancellationToken);
-}
-
-internal static class IRazorCohostTextDocumentSyncHandlerExtensions
-{
- public static async Task NotifyRazorAsync(this IRazorCohostTextDocumentSyncHandler? openOrChangeHandler, Uri uri, int version, RequestContext context, CancellationToken cancellationToken)
- {
- if (openOrChangeHandler is null)
- return;
-
- // Razor is a little special here, because when a .razor or .cshtml document is opened/changed, which is what this request is for,
- // they need to generate a C# and/or Html document. To do this they use the Razor Source Generator, but to run the generator they
- // need a TextDocument for the Razor file that this request is for. To facilitate that need we create a RequestContext here
- // and pass it to Razor, which is essentially the same as the RequestContext they would get on the next request, but by providing it
- // early here, they can do their generation before the didOpen/didChange/didClose mutating request is finished.
- // This is a little hacky, but it's the best we can do for now. In future hopefully we can switch to a pull model where the source
- // generator just provides C# source to the project/compilation as normal. Whether we need to maintain this system for the Html
- // generated documents remains to be seen.
- var clientCapabilitiesManager = context.GetRequiredService();
- var clientCapabilities = clientCapabilitiesManager.TryGetClientCapabilities();
- var logger = context.GetRequiredService();
- var serverInfoProvider = context.GetRequiredService();
- var supportedLanguages = serverInfoProvider.SupportedLanguages;
- var lspServices = context.GetRequiredService();
-
- var newContext = await RequestContext.CreateAsync(false, true, new TextDocumentIdentifier() { Uri = uri }, LanguageServer.WellKnownLspServerKinds.RazorCohostServer, clientCapabilities, supportedLanguages, lspServices, logger, context.Method, cancellationToken).ConfigureAwait(false);
-
- var razorContext = new RazorCohostRequestContext(newContext);
-
- await openOrChangeHandler.HandleAsync(version, razorContext, cancellationToken).ConfigureAwait(false);
- }
-}
diff --git a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCustomMessageTarget.cs b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCustomMessageTarget.cs
index 28e11a4a5cad..0f2a881500ed 100644
--- a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCustomMessageTarget.cs
+++ b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCustomMessageTarget.cs
@@ -2,8 +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;
+
namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost;
+[Obsolete("This should no longer be used")]
internal interface IRazorCustomMessageTarget
{
}
diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs
deleted file mode 100644
index c700b9b2d155..000000000000
--- a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// 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.Composition;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis.Host.Mef;
-using Microsoft.CodeAnalysis.LanguageServer;
-using Microsoft.CodeAnalysis.LanguageServer.Handler;
-using Microsoft.CodeAnalysis.Text;
-using Roslyn.LanguageServer.Protocol;
-
-namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost;
-
-[RazorMethod(Methods.TextDocumentDidChangeName)]
-[ExportRazorStatelessLspService(typeof(RazorCohostDidChangeEndpoint)), Shared]
-[method: ImportingConstructor]
-[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
-internal sealed class RazorCohostDidChangeEndpoint(
- [Import(AllowDefault = true)] IRazorCohostTextDocumentSyncHandler? razorDocSyncHandler)
- : ILspServiceDocumentRequestHandler
-{
- public bool MutatesSolutionState => true;
- public bool RequiresLSPSolution => false;
-
- public TextDocumentIdentifier GetTextDocumentIdentifier(DidChangeTextDocumentParams request)
- => request.TextDocument;
-
- public async Task