From f7a2fef5e2e07d7dd3873b062d829b1e47ee752c Mon Sep 17 00:00:00 2001 From: David Barbet Date: Mon, 22 Jul 2019 17:22:43 -0700 Subject: [PATCH] Modify liveshare handlers to export based on language. --- .../Impl/ClassificationsHandler.Exports.cs | 29 ++++++++++ .../LiveShare/Impl/ClassificationsHandler.cs | 1 - .../Impl/DiagnosticHandler.Exports.cs | 38 +++++++++++++ .../Impl/FindAllReferencesHandler.Exports.cs | 47 ++++++++++++++++ .../Impl/FindAllReferencesHandler.cs | 5 +- .../GoToDefintionWithFarHandler.Exports.cs | 47 ++++++++++++++++ .../Impl/GoToDefintionWithFarHandler.cs | 2 - .../LiveShare/Impl/LiveShareConstants.cs | 4 ++ .../LiveShare/Impl/LoadHandler.cs | 23 +++++++- .../Impl/PreviewCodeActionsHandler.Exports.cs | 48 +++++++++++++++++ .../Impl/PreviewCodeActionsHandler.cs | 4 -- .../LiveShare/Impl/ProjectsHandler.Exports.cs | 29 ++++++++++ .../LiveShare/Impl/ProjectsHandler.cs | 3 -- .../LiveShare/Impl/RenameHandler.Exports.cs | 47 ++++++++++++++++ .../LiveShare/Impl/RenameHandler.cs | 4 -- .../Impl/RunCodeActionsHandler.Exports.cs | 53 +++++++++++++++++++ .../LiveShare/Impl/RunCodeActionsHandler.cs | 3 -- .../Impl/Shims/CodeActionsHandlerShim.cs | 41 ++++++++++++-- .../Impl/Shims/CompletionHandlerShim.cs | 41 ++++++++++++-- .../Shims/CompletionResolverHandlerShim.cs | 41 ++++++++++++-- .../Shims/DocumentHighlightHandlerShim.cs | 41 ++++++++++++-- .../Impl/Shims/DocumentSymbolsHandlerShim.cs | 41 ++++++++++++-- .../Shims/FindImplementationsHandlerShim.cs | 41 ++++++++++++-- .../Impl/Shims/FormatDocumentHandlerShim.cs | 41 ++++++++++++-- .../Shims/FormatDocumentOnTypeHandlerShim.cs | 41 ++++++++++++-- .../Shims/FormatDocumentRangeHandlerShim.cs | 41 ++++++++++++-- .../Impl/Shims/InitializeHandlerShim.cs | 41 ++++++++++++-- .../Impl/Shims/SignatureHelpHandlerShim.cs | 41 ++++++++++++-- .../Impl/Shims/WorkspaceSymbolsHandlerShim.cs | 41 ++++++++++++-- 29 files changed, 821 insertions(+), 58 deletions(-) create mode 100644 src/VisualStudio/LiveShare/Impl/ClassificationsHandler.Exports.cs create mode 100644 src/VisualStudio/LiveShare/Impl/FindAllReferencesHandler.Exports.cs create mode 100644 src/VisualStudio/LiveShare/Impl/GoToDefintionWithFarHandler.Exports.cs create mode 100644 src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.Exports.cs create mode 100644 src/VisualStudio/LiveShare/Impl/ProjectsHandler.Exports.cs create mode 100644 src/VisualStudio/LiveShare/Impl/RenameHandler.Exports.cs create mode 100644 src/VisualStudio/LiveShare/Impl/RunCodeActionsHandler.Exports.cs diff --git a/src/VisualStudio/LiveShare/Impl/ClassificationsHandler.Exports.cs b/src/VisualStudio/LiveShare/Impl/ClassificationsHandler.Exports.cs new file mode 100644 index 00000000000..79b2a60407c --- /dev/null +++ b/src/VisualStudio/LiveShare/Impl/ClassificationsHandler.Exports.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol; +using Microsoft.VisualStudio.LiveShare.LanguageServices; + +namespace Microsoft.VisualStudio.LanguageServices.LiveShare +{ + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, RoslynMethods.ClassificationsName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynClassificationsHandler : ClassificationsHandler + { + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, RoslynMethods.ClassificationsName)] + internal class CSharpClassificationsHandler : ClassificationsHandler + { + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, RoslynMethods.ClassificationsName)] + internal class VisualBasicClassificationsHandler : ClassificationsHandler + { + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, RoslynMethods.ClassificationsName)] + internal class TypeScriptClassificationsHandler : ClassificationsHandler + { + } +} diff --git a/src/VisualStudio/LiveShare/Impl/ClassificationsHandler.cs b/src/VisualStudio/LiveShare/Impl/ClassificationsHandler.cs index 7d0a0b8db42..357e22cc84d 100644 --- a/src/VisualStudio/LiveShare/Impl/ClassificationsHandler.cs +++ b/src/VisualStudio/LiveShare/Impl/ClassificationsHandler.cs @@ -19,7 +19,6 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare /// Note, this must return object instead of ClassificationSpan b/c liveshare uses dynamic to convert handler results. /// Unfortunately, ClassificationSpan is an internal type and cannot be defined in the external access layer. /// - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, RoslynMethods.ClassificationsName)] internal class ClassificationsHandler : ILspRequestHandler { public async Task HandleAsync(ClassificationParams request, RequestContext requestContext, CancellationToken cancellationToken) diff --git a/src/VisualStudio/LiveShare/Impl/DiagnosticHandler.Exports.cs b/src/VisualStudio/LiveShare/Impl/DiagnosticHandler.Exports.cs index a9cf1480f7b..5b1061a8c6c 100644 --- a/src/VisualStudio/LiveShare/Impl/DiagnosticHandler.Exports.cs +++ b/src/VisualStudio/LiveShare/Impl/DiagnosticHandler.Exports.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.VisualStudio.LiveShare.LanguageServices; @@ -9,6 +10,7 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { [Export(LiveShareConstants.RoslynContractName, typeof(ILspNotificationProvider))] [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.GetDocumentDiagnosticsName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] internal class RoslynDiagnosticsHandler : DiagnosticsHandler { [ImportingConstructor] @@ -18,6 +20,42 @@ public RoslynDiagnosticsHandler(IDiagnosticService diagnosticService) } } + [Export(LiveShareConstants.CSharpContractName, typeof(ILspNotificationProvider))] + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.GetDocumentDiagnosticsName)] + internal class CSharpDiagnosticsHandler : DiagnosticsHandler + { + [ImportingConstructor] + public CSharpDiagnosticsHandler(IDiagnosticService diagnosticService) + : base(diagnosticService) + { + } + } + + [Export(LiveShareConstants.VisualBasicContractName, typeof(ILspNotificationProvider))] + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.GetDocumentDiagnosticsName)] + internal class VisualBasicDiagnosticsHandler : DiagnosticsHandler + { + [ImportingConstructor] + public VisualBasicDiagnosticsHandler(IDiagnosticService diagnosticService) + : base(diagnosticService) + { + } + } + + [Export(LiveShareConstants.TypeScriptContractName, typeof(ILspNotificationProvider))] + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.GetDocumentDiagnosticsName)] + internal class TypeScriptDiagnosticsHandler : DiagnosticsHandler + { + [ImportingConstructor] + public TypeScriptDiagnosticsHandler(IDiagnosticService diagnosticService) + : base(diagnosticService) + { + } + } + + /// + /// is only used for typescript. + /// [Export(LiveShareConstants.RoslynLSPSDKContractName, typeof(ILspNotificationProvider))] [ExportLspRequestHandler(LiveShareConstants.RoslynLSPSDKContractName, Methods.GetDocumentDiagnosticsName)] internal class RoslynLSPSDKDiagnosticsHandler : DiagnosticsHandler diff --git a/src/VisualStudio/LiveShare/Impl/FindAllReferencesHandler.Exports.cs b/src/VisualStudio/LiveShare/Impl/FindAllReferencesHandler.Exports.cs new file mode 100644 index 00000000000..4269707c22d --- /dev/null +++ b/src/VisualStudio/LiveShare/Impl/FindAllReferencesHandler.Exports.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.ComponentModel.Composition; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.LiveShare.LanguageServices; + +namespace Microsoft.VisualStudio.LanguageServices.LiveShare +{ + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentReferencesName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynFindAllReferencesHandler : FindAllReferencesHandler + { + [ImportingConstructor] + public RoslynFindAllReferencesHandler(IThreadingContext threadingContext) : base(threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentReferencesName)] + internal class CSharpFindAllReferencesHandler : FindAllReferencesHandler + { + [ImportingConstructor] + public CSharpFindAllReferencesHandler(IThreadingContext threadingContext) : base(threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentReferencesName)] + internal class VisualBasicFindAllReferencesHandler : FindAllReferencesHandler + { + [ImportingConstructor] + public VisualBasicFindAllReferencesHandler(IThreadingContext threadingContext) : base(threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentReferencesName)] + internal class TypeScriptFindAllReferencesHandler : FindAllReferencesHandler + { + [ImportingConstructor] + public TypeScriptFindAllReferencesHandler(IThreadingContext threadingContext) : base(threadingContext) + { + } + } +} diff --git a/src/VisualStudio/LiveShare/Impl/FindAllReferencesHandler.cs b/src/VisualStudio/LiveShare/Impl/FindAllReferencesHandler.cs index f1424a9f25a..1093cb21aab 100644 --- a/src/VisualStudio/LiveShare/Impl/FindAllReferencesHandler.cs +++ b/src/VisualStudio/LiveShare/Impl/FindAllReferencesHandler.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; -using System.ComponentModel.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -20,12 +19,10 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, LSP.Methods.TextDocumentReferencesName)] internal class FindAllReferencesHandler : ILspRequestHandler { private readonly IThreadingContext _threadingContext; - [ImportingConstructor] public FindAllReferencesHandler(IThreadingContext threadingContext) { _threadingContext = threadingContext; @@ -50,7 +47,7 @@ public async Task HandleAsync(LSP.ReferenceParams request, RequestCont // This is not great for us and ideally we should ask for a Roslyn API where we can make this call without blocking the UI. if (VsTaskLibraryHelper.ServiceInstance != null) { - await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); } await findUsagesService.FindReferencesAsync(document, position, context).ConfigureAwait(false); diff --git a/src/VisualStudio/LiveShare/Impl/GoToDefintionWithFarHandler.Exports.cs b/src/VisualStudio/LiveShare/Impl/GoToDefintionWithFarHandler.Exports.cs new file mode 100644 index 00000000000..3404ad4d65c --- /dev/null +++ b/src/VisualStudio/LiveShare/Impl/GoToDefintionWithFarHandler.Exports.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.ComponentModel.Composition; +using Microsoft.VisualStudio.LiveShare.LanguageServices; +using Microsoft.CodeAnalysis.Editor; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using System; + +namespace Microsoft.VisualStudio.LanguageServices.LiveShare +{ + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentDefinitionName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynGoToDefinitionWithFarHandler : GotoDefinitionHandler + { + [ImportingConstructor] + public RoslynGoToDefinitionWithFarHandler([Import(AllowDefault = true)] IMetadataAsSourceFileService metadataAsSourceService) : base(metadataAsSourceService) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentDefinitionName)] + internal class CSharpGoToDefinitionWithFarHandler : GotoDefinitionHandler + { + [ImportingConstructor] + public CSharpGoToDefinitionWithFarHandler([Import(AllowDefault = true)] IMetadataAsSourceFileService metadataAsSourceService) : base(metadataAsSourceService) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentDefinitionName)] + internal class VisualBasicGoToDefinitionWithFarHandler : GotoDefinitionHandler + { + [ImportingConstructor] + public VisualBasicGoToDefinitionWithFarHandler([Import(AllowDefault = true)] IMetadataAsSourceFileService metadataAsSourceService) : base(metadataAsSourceService) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentDefinitionName)] + internal class TypeScriptGoToDefinitionWithFarHandler : GotoDefinitionHandler + { + [ImportingConstructor] + public TypeScriptGoToDefinitionWithFarHandler([Import(AllowDefault = true)] IMetadataAsSourceFileService metadataAsSourceService) : base(metadataAsSourceService) + { + } + } +} diff --git a/src/VisualStudio/LiveShare/Impl/GoToDefintionWithFarHandler.cs b/src/VisualStudio/LiveShare/Impl/GoToDefintionWithFarHandler.cs index ccd171de8ea..1b76adbbc66 100644 --- a/src/VisualStudio/LiveShare/Impl/GoToDefintionWithFarHandler.cs +++ b/src/VisualStudio/LiveShare/Impl/GoToDefintionWithFarHandler.cs @@ -23,7 +23,6 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare /// cone to the vslsexternal scheme. /// This lives in external access because it has a dependency on FAR, which requires the UI thread. /// - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, LSP.Methods.TextDocumentDefinitionName)] internal class GotoDefinitionHandler : ILspRequestHandler { private readonly IMetadataAsSourceFileService _metadataAsSourceService; @@ -31,7 +30,6 @@ internal class GotoDefinitionHandler : ILspRequestHandler { public Task HandleAsync(object request, RequestContext requestContext, CancellationToken cancellationToken) @@ -15,4 +15,25 @@ public Task HandleAsync(object request, RequestContext requestContext, C return Task.FromResult(null); } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.LoadName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynLoadHandler : LoadHandler + { + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.LoadName)] + internal class CSharpLoadHandler : LoadHandler + { + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.LoadName)] + internal class VisualBasicLoadHandler : LoadHandler + { + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.LoadName)] + internal class TypeScriptLoadHandler : LoadHandler + { + } } diff --git a/src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.Exports.cs b/src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.Exports.cs new file mode 100644 index 00000000000..7b762485bd1 --- /dev/null +++ b/src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.Exports.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.ComponentModel.Composition; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.CodeRefactorings; +using Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol; +using Microsoft.VisualStudio.LiveShare.LanguageServices; + +namespace Microsoft.VisualStudio.LanguageServices.LiveShare +{ + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, RoslynMethods.CodeActionPreviewName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynPreviewCodeActionsHandler : PreviewCodeActionsHandler + { + [ImportingConstructor] + public RoslynPreviewCodeActionsHandler(ICodeFixService codeFixService, ICodeRefactoringService codeRefactoringService) : base(codeFixService, codeRefactoringService) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, RoslynMethods.CodeActionPreviewName)] + internal class CSharpPreviewCodeActionsHandler : PreviewCodeActionsHandler + { + [ImportingConstructor] + public CSharpPreviewCodeActionsHandler(ICodeFixService codeFixService, ICodeRefactoringService codeRefactoringService) : base(codeFixService, codeRefactoringService) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, RoslynMethods.CodeActionPreviewName)] + internal class VisualBasicPreviewCodeActionsHandler : PreviewCodeActionsHandler + { + [ImportingConstructor] + public VisualBasicPreviewCodeActionsHandler(ICodeFixService codeFixService, ICodeRefactoringService codeRefactoringService) : base(codeFixService, codeRefactoringService) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, RoslynMethods.CodeActionPreviewName)] + internal class TypeScriptPreviewCodeActionsHandler : PreviewCodeActionsHandler + { + [ImportingConstructor] + public TypeScriptPreviewCodeActionsHandler(ICodeFixService codeFixService, ICodeRefactoringService codeRefactoringService) : base(codeFixService, codeRefactoringService) + { + } + } +} diff --git a/src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.cs b/src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.cs index 57d3b94d782..c019e5ed5d2 100644 --- a/src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.cs +++ b/src/VisualStudio/LiveShare/Impl/PreviewCodeActionsHandler.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.ComponentModel.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -12,16 +11,13 @@ using Microsoft.CodeAnalysis.LanguageServer.CustomProtocol; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol; using Microsoft.VisualStudio.LiveShare.LanguageServices; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, RoslynMethods.CodeActionPreviewName)] internal class PreviewCodeActionsHandler : CodeActionsHandlerBase, ILspRequestHandler { - [ImportingConstructor] public PreviewCodeActionsHandler(ICodeFixService codeFixService, ICodeRefactoringService codeRefactoringService) : base(codeFixService, codeRefactoringService) { diff --git a/src/VisualStudio/LiveShare/Impl/ProjectsHandler.Exports.cs b/src/VisualStudio/LiveShare/Impl/ProjectsHandler.Exports.cs new file mode 100644 index 00000000000..f143ab7e86d --- /dev/null +++ b/src/VisualStudio/LiveShare/Impl/ProjectsHandler.Exports.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol; +using Microsoft.VisualStudio.LiveShare.LanguageServices; + +namespace Microsoft.VisualStudio.LanguageServices.LiveShare +{ + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, RoslynMethods.ProjectsName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynProjectsHandler : ProjectsHandler + { + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, RoslynMethods.ProjectsName)] + internal class CSharpProjectsHandler : ProjectsHandler + { + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, RoslynMethods.ProjectsName)] + internal class VisualBasicProjectsHandler : ProjectsHandler + { + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, RoslynMethods.ProjectsName)] + internal class TypeScriptProjectsHandler : ProjectsHandler + { + } +} diff --git a/src/VisualStudio/LiveShare/Impl/ProjectsHandler.cs b/src/VisualStudio/LiveShare/Impl/ProjectsHandler.cs index b9d438e4459..005b998e4c1 100644 --- a/src/VisualStudio/LiveShare/Impl/ProjectsHandler.cs +++ b/src/VisualStudio/LiveShare/Impl/ProjectsHandler.cs @@ -1,13 +1,11 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol; using Microsoft.VisualStudio.LiveShare.LanguageServices; namespace Microsoft.VisualStudio.LanguageServices.LiveShare @@ -15,7 +13,6 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare /// /// TODO - Move to lower layer once the protocol converter is figured out. /// - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, RoslynMethods.ProjectsName)] internal class ProjectsHandler : ILspRequestHandler { public async Task HandleAsync(object param, RequestContext requestContext, CancellationToken cancellationToken) diff --git a/src/VisualStudio/LiveShare/Impl/RenameHandler.Exports.cs b/src/VisualStudio/LiveShare/Impl/RenameHandler.Exports.cs new file mode 100644 index 00000000000..a5875814f7f --- /dev/null +++ b/src/VisualStudio/LiveShare/Impl/RenameHandler.Exports.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.ComponentModel.Composition; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.LiveShare.LanguageServices; + +namespace Microsoft.VisualStudio.LanguageServices.LiveShare +{ + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentRenameName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynRenameHandler : RenameHandler + { + [ImportingConstructor] + public RoslynRenameHandler(IThreadingContext threadingContext) : base(threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentRenameName)] + internal class CSharpRenameHandler : RenameHandler + { + [ImportingConstructor] + public CSharpRenameHandler(IThreadingContext threadingContext) : base(threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentRenameName)] + internal class VisualBasicRenameHandler : RenameHandler + { + [ImportingConstructor] + public VisualBasicRenameHandler(IThreadingContext threadingContext) : base(threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentRenameName)] + internal class TypeScriptRenameHandler : RenameHandler + { + [ImportingConstructor] + public TypeScriptRenameHandler(IThreadingContext threadingContext) : base(threadingContext) + { + } + } +} diff --git a/src/VisualStudio/LiveShare/Impl/RenameHandler.cs b/src/VisualStudio/LiveShare/Impl/RenameHandler.cs index 4a245f0da4a..2c223aac371 100644 --- a/src/VisualStudio/LiveShare/Impl/RenameHandler.cs +++ b/src/VisualStudio/LiveShare/Impl/RenameHandler.cs @@ -1,7 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Collections.Generic; -using System.ComponentModel.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -15,12 +13,10 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentRenameName)] internal class RenameHandler : ILspRequestHandler { private readonly IThreadingContext _threadingContext; - [ImportingConstructor] public RenameHandler(IThreadingContext threadingContext) { _threadingContext = threadingContext; diff --git a/src/VisualStudio/LiveShare/Impl/RunCodeActionsHandler.Exports.cs b/src/VisualStudio/LiveShare/Impl/RunCodeActionsHandler.Exports.cs new file mode 100644 index 00000000000..7183305f24b --- /dev/null +++ b/src/VisualStudio/LiveShare/Impl/RunCodeActionsHandler.Exports.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.ComponentModel.Composition; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.CodeRefactorings; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.LiveShare.LanguageServices; + +namespace Microsoft.VisualStudio.LanguageServices.LiveShare +{ + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.WorkspaceExecuteCommandName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynRunCodeActionsHandler : RunCodeActionsHandler + { + [ImportingConstructor] + public RoslynRunCodeActionsHandler(ICodeFixService codeFixService, ICodeRefactoringService codeRefactoringService, IThreadingContext threadingContext) + : base(codeFixService, codeRefactoringService, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.WorkspaceExecuteCommandName)] + internal class CSharpRunCodeActionsHandler : RunCodeActionsHandler + { + [ImportingConstructor] + public CSharpRunCodeActionsHandler(ICodeFixService codeFixService, ICodeRefactoringService codeRefactoringService, IThreadingContext threadingContext) + : base(codeFixService, codeRefactoringService, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.WorkspaceExecuteCommandName)] + internal class VisualBasicRunCodeActionsHandler : RunCodeActionsHandler + { + [ImportingConstructor] + public VisualBasicRunCodeActionsHandler(ICodeFixService codeFixService, ICodeRefactoringService codeRefactoringService, IThreadingContext threadingContext) + : base(codeFixService, codeRefactoringService, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.WorkspaceExecuteCommandName)] + internal class TypeScriptRunCodeActionsHandler : RunCodeActionsHandler + { + [ImportingConstructor] + public TypeScriptRunCodeActionsHandler(ICodeFixService codeFixService, ICodeRefactoringService codeRefactoringService, IThreadingContext threadingContext) + : base(codeFixService, codeRefactoringService, threadingContext) + { + } + } +} diff --git a/src/VisualStudio/LiveShare/Impl/RunCodeActionsHandler.cs b/src/VisualStudio/LiveShare/Impl/RunCodeActionsHandler.cs index 3ec14d3156d..2dae0293496 100644 --- a/src/VisualStudio/LiveShare/Impl/RunCodeActionsHandler.cs +++ b/src/VisualStudio/LiveShare/Impl/RunCodeActionsHandler.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.ComponentModel.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -20,12 +19,10 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare /// Run code actions handler. Called when lightbulb invoked. /// TODO - Move to CodeAnalysis.LanguageServer once the UI thread dependency is removed. /// - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, LSP.Methods.WorkspaceExecuteCommandName)] internal class RunCodeActionsHandler : CodeActionsHandlerBase, ILspRequestHandler { private readonly IThreadingContext _threadingContext; - [ImportingConstructor] public RunCodeActionsHandler(ICodeFixService codeFixService, ICodeRefactoringService codeRefactoringService, IThreadingContext threadingContext) : base(codeFixService, codeRefactoringService) { diff --git a/src/VisualStudio/LiveShare/Impl/Shims/CodeActionsHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/CodeActionsHandlerShim.cs index 3bb27e7809b..57468d7d2bc 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/CodeActionsHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/CodeActionsHandlerShim.cs @@ -14,11 +14,9 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentCodeActionName)] internal class CodeActionsHandlerShim : AbstractLiveShareHandlerShim { - [ImportingConstructor] - public CodeActionsHandlerShim([ImportMany] IEnumerable> requestHandlers) + public CodeActionsHandlerShim(IEnumerable> requestHandlers) : base(requestHandlers, Methods.TextDocumentCodeActionName) { } @@ -59,4 +57,41 @@ static LiveShareCodeAction GetLiveShareCodeAction(CodeAction codeAction) } } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentCodeActionName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynCodeActionsHandlerShim : CodeActionsHandlerShim + { + [ImportingConstructor] + public RoslynCodeActionsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentCodeActionName)] + internal class CSharpCodeActionsHandlerShim : CodeActionsHandlerShim + { + [ImportingConstructor] + public CSharpCodeActionsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentCodeActionName)] + internal class VisualBasicCodeActionsHandlerShim : CodeActionsHandlerShim + { + [ImportingConstructor] + public VisualBasicCodeActionsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentCodeActionName)] + internal class TypeScriptCodeActionsHandlerShim : CodeActionsHandlerShim + { + [ImportingConstructor] + public TypeScriptCodeActionsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } } diff --git a/src/VisualStudio/LiveShare/Impl/Shims/CompletionHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/CompletionHandlerShim.cs index c61afac61e9..b56a2faa4fa 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/CompletionHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/CompletionHandlerShim.cs @@ -9,13 +9,48 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentCompletionName)] internal class CompletionHandlerShim : AbstractLiveShareHandlerShim { - [ImportingConstructor] - public CompletionHandlerShim([ImportMany] IEnumerable> requestHandlers) + public CompletionHandlerShim(IEnumerable> requestHandlers) : base(requestHandlers, Methods.TextDocumentCompletionName) { } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentCompletionName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynCompletionHandlerShim : CompletionHandlerShim + { + [ImportingConstructor] + public RoslynCompletionHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentCompletionName)] + internal class CSharpCompletionHandlerShim : CompletionHandlerShim + { + [ImportingConstructor] + public CSharpCompletionHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentCompletionName)] + internal class VisualBasicCompletionHandlerShim : CompletionHandlerShim + { + [ImportingConstructor] + public VisualBasicCompletionHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentCompletionName)] + internal class TypeScriptCompletionHandlerShim : CompletionHandlerShim + { + [ImportingConstructor] + public TypeScriptCompletionHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } } diff --git a/src/VisualStudio/LiveShare/Impl/Shims/CompletionResolverHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/CompletionResolverHandlerShim.cs index ff8ea740d46..1ff56320a4d 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/CompletionResolverHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/CompletionResolverHandlerShim.cs @@ -9,13 +9,48 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentCompletionResolveName)] internal class CompletionResolverHandlerShim : AbstractLiveShareHandlerShim { - [ImportingConstructor] - public CompletionResolverHandlerShim([ImportMany] IEnumerable> requestHandlers) + public CompletionResolverHandlerShim(IEnumerable> requestHandlers) : base(requestHandlers, Methods.TextDocumentCompletionResolveName) { } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentCompletionResolveName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynCompletionResolverHandlerShim : CompletionResolverHandlerShim + { + [ImportingConstructor] + public RoslynCompletionResolverHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentCompletionResolveName)] + internal class CSharpCompletionResolverHandlerShim : CompletionResolverHandlerShim + { + [ImportingConstructor] + public CSharpCompletionResolverHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentCompletionResolveName)] + internal class VisualBasicCompletionResolverHandlerShim : CompletionResolverHandlerShim + { + [ImportingConstructor] + public VisualBasicCompletionResolverHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentCompletionResolveName)] + internal class TypeScriptCompletionResolverHandlerShim : CompletionResolverHandlerShim + { + [ImportingConstructor] + public TypeScriptCompletionResolverHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } } diff --git a/src/VisualStudio/LiveShare/Impl/Shims/DocumentHighlightHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/DocumentHighlightHandlerShim.cs index dc2f81ce755..f0507e13ea5 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/DocumentHighlightHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/DocumentHighlightHandlerShim.cs @@ -9,13 +9,48 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentDocumentHighlightName)] internal class DocumentHighlightHandlerShim : AbstractLiveShareHandlerShim { - [ImportingConstructor] - public DocumentHighlightHandlerShim([ImportMany] IEnumerable> requestHandlers) + public DocumentHighlightHandlerShim(IEnumerable> requestHandlers) : base(requestHandlers, Methods.TextDocumentDocumentHighlightName) { } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentDocumentHighlightName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynDocumentHighlightHandlerShim : DocumentHighlightHandlerShim + { + [ImportingConstructor] + public RoslynDocumentHighlightHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentDocumentHighlightName)] + internal class CSharpDocumentHighlightHandlerShim : DocumentHighlightHandlerShim + { + [ImportingConstructor] + public CSharpDocumentHighlightHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentDocumentHighlightName)] + internal class VisualBasicDocumentHighlightHandlerShim : DocumentHighlightHandlerShim + { + [ImportingConstructor] + public VisualBasicDocumentHighlightHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentDocumentHighlightName)] + internal class TypeScriptDocumentHighlightHandlerShim : DocumentHighlightHandlerShim + { + [ImportingConstructor] + public TypeScriptDocumentHighlightHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } } diff --git a/src/VisualStudio/LiveShare/Impl/Shims/DocumentSymbolsHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/DocumentSymbolsHandlerShim.cs index 5b9e5a652dd..83a419cb04b 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/DocumentSymbolsHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/DocumentSymbolsHandlerShim.cs @@ -13,11 +13,9 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentDocumentSymbolName)] internal class DocumentSymbolsHandlerShim : AbstractLiveShareHandlerShim { - [ImportingConstructor] - public DocumentSymbolsHandlerShim([ImportMany] IEnumerable> requestHandlers) + public DocumentSymbolsHandlerShim(IEnumerable> requestHandlers) : base(requestHandlers, Methods.TextDocumentDocumentSymbolName) { } @@ -38,4 +36,41 @@ public override async Task HandleAsync(DocumentSymbolParams return response?.Select(obj => (SymbolInformation)obj).ToArray(); } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentDocumentSymbolName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynDocumentSymbolsHandlerShim : DocumentSymbolsHandlerShim + { + [ImportingConstructor] + public RoslynDocumentSymbolsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentDocumentSymbolName)] + internal class CSharpDocumentSymbolsHandlerShim : DocumentSymbolsHandlerShim + { + [ImportingConstructor] + public CSharpDocumentSymbolsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentDocumentSymbolName)] + internal class VisualBasicDocumentSymbolsHandlerShim : DocumentSymbolsHandlerShim + { + [ImportingConstructor] + public VisualBasicDocumentSymbolsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentDocumentSymbolName)] + internal class TypeScriptDocumentSymbolsHandlerShim : DocumentSymbolsHandlerShim + { + [ImportingConstructor] + public TypeScriptDocumentSymbolsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } } diff --git a/src/VisualStudio/LiveShare/Impl/Shims/FindImplementationsHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/FindImplementationsHandlerShim.cs index 5b2cc957347..9db55e70959 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/FindImplementationsHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/FindImplementationsHandlerShim.cs @@ -13,13 +13,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentImplementationName)] internal class FindImplementationsHandlerShim : AbstractLiveShareHandlerShim { private readonly IThreadingContext _threadingContext; - [ImportingConstructor] - public FindImplementationsHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) + public FindImplementationsHandlerShim(IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, Methods.TextDocumentImplementationName) { _threadingContext = threadingContext; @@ -32,4 +30,41 @@ public override async Task HandleAsync(TextDocumentPositionParams param, return await base.HandleAsync(param, requestContext, cancellationToken).ConfigureAwait(false); } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentImplementationName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynFindImplementationsHandlerShim : FindImplementationsHandlerShim + { + [ImportingConstructor] + public RoslynFindImplementationsHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentImplementationName)] + internal class CSharpFindImplementationsHandlerShim : FindImplementationsHandlerShim + { + [ImportingConstructor] + public CSharpFindImplementationsHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentImplementationName)] + internal class VisualBasicFindImplementationsHandlerShim : FindImplementationsHandlerShim + { + [ImportingConstructor] + public VisualBasicFindImplementationsHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentImplementationName)] + internal class TypeScriptFindImplementationsHandlerShim : FindImplementationsHandlerShim + { + [ImportingConstructor] + public TypeScriptFindImplementationsHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } } diff --git a/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentHandlerShim.cs index e7e00d4f77f..afd3524411a 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentHandlerShim.cs @@ -13,13 +13,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentFormattingName)] internal class FormatDocumentHandlerShim : AbstractLiveShareHandlerShim { private readonly IThreadingContext _threadingContext; - [ImportingConstructor] - public FormatDocumentHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) + public FormatDocumentHandlerShim(IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, Methods.TextDocumentFormattingName) { _threadingContext = threadingContext; @@ -32,4 +30,41 @@ public override async Task HandleAsync(DocumentFormattingParams para return await base.HandleAsync(param, requestContext, cancellationToken).ConfigureAwait(false); } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentFormattingName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynFormatDocumentHandlerShim : FormatDocumentHandlerShim + { + [ImportingConstructor] + public RoslynFormatDocumentHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentFormattingName)] + internal class CSharpFormatDocumentHandlerShim : FormatDocumentHandlerShim + { + [ImportingConstructor] + public CSharpFormatDocumentHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentFormattingName)] + internal class VisualBasicFormatDocumentHandlerShim : FormatDocumentHandlerShim + { + [ImportingConstructor] + public VisualBasicFormatDocumentHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentFormattingName)] + internal class TypeScriptFormatDocumentHandlerShim : FormatDocumentHandlerShim + { + [ImportingConstructor] + public TypeScriptFormatDocumentHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } } diff --git a/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentOnTypeHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentOnTypeHandlerShim.cs index 94ff18bdc3c..9f002733211 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentOnTypeHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentOnTypeHandlerShim.cs @@ -13,13 +13,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentOnTypeFormattingName)] internal class FormatDocumentOnTypeHandlerShim : AbstractLiveShareHandlerShim { private readonly IThreadingContext _threadingContext; - [ImportingConstructor] - public FormatDocumentOnTypeHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) + public FormatDocumentOnTypeHandlerShim(IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, Methods.TextDocumentOnTypeFormattingName) { _threadingContext = threadingContext; @@ -32,4 +30,41 @@ public override async Task HandleAsync(DocumentOnTypeFormattingParam return await base.HandleAsync(param, requestContext, cancellationToken).ConfigureAwait(false); } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentOnTypeFormattingName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynFormatDocumentOnTypeHandlerShim : FormatDocumentOnTypeHandlerShim + { + [ImportingConstructor] + public RoslynFormatDocumentOnTypeHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentOnTypeFormattingName)] + internal class CSharpFormatDocumentOnTypeHandlerShim : FormatDocumentOnTypeHandlerShim + { + [ImportingConstructor] + public CSharpFormatDocumentOnTypeHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentOnTypeFormattingName)] + internal class VisualBasicFormatDocumentOnTypeHandlerShim : FormatDocumentOnTypeHandlerShim + { + [ImportingConstructor] + public VisualBasicFormatDocumentOnTypeHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentOnTypeFormattingName)] + internal class TypeScriptFormatDocumentOnTypeHandlerShim : FormatDocumentOnTypeHandlerShim + { + [ImportingConstructor] + public TypeScriptFormatDocumentOnTypeHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } } diff --git a/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentRangeHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentRangeHandlerShim.cs index e0af4ab702e..f563e3387e9 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentRangeHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/FormatDocumentRangeHandlerShim.cs @@ -13,13 +13,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentRangeFormattingName)] internal class FormatDocumentRangeHandlerShim : AbstractLiveShareHandlerShim { private readonly IThreadingContext _threadingContext; - [ImportingConstructor] - public FormatDocumentRangeHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) + public FormatDocumentRangeHandlerShim(IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, Methods.TextDocumentRangeFormattingName) { _threadingContext = threadingContext; @@ -32,4 +30,41 @@ public override async Task HandleAsync(DocumentRangeFormattingParams return await base.HandleAsync(param, requestContext, cancellationToken).ConfigureAwait(false); } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentRangeFormattingName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynFormatDocumentRangeHandlerShim : FormatDocumentRangeHandlerShim + { + [ImportingConstructor] + public RoslynFormatDocumentRangeHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentRangeFormattingName)] + internal class CSharpFormatDocumentRangeHandlerShim : FormatDocumentRangeHandlerShim + { + [ImportingConstructor] + public CSharpFormatDocumentRangeHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentRangeFormattingName)] + internal class VisualBasicFormatDocumentRangeHandlerShim : FormatDocumentRangeHandlerShim + { + [ImportingConstructor] + public VisualBasicFormatDocumentRangeHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentRangeFormattingName)] + internal class TypeScriptFormatDocumentRangeHandlerShim : FormatDocumentRangeHandlerShim + { + [ImportingConstructor] + public TypeScriptFormatDocumentRangeHandlerShim([ImportMany] IEnumerable> requestHandlers, IThreadingContext threadingContext) : base(requestHandlers, threadingContext) + { + } + } } diff --git a/src/VisualStudio/LiveShare/Impl/Shims/InitializeHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/InitializeHandlerShim.cs index 105b5b9a2cf..973b1d35a12 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/InitializeHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/InitializeHandlerShim.cs @@ -9,13 +9,48 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.InitializeName)] internal class InitializeHandlerShim : AbstractLiveShareHandlerShim { - [ImportingConstructor] - public InitializeHandlerShim([ImportMany] IEnumerable> requestHandlers) + public InitializeHandlerShim(IEnumerable> requestHandlers) : base(requestHandlers, Methods.InitializeName) { } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.InitializeName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynInitializeHandlerShim : InitializeHandlerShim + { + [ImportingConstructor] + public RoslynInitializeHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.InitializeName)] + internal class CSharpInitializeHandlerShim : InitializeHandlerShim + { + [ImportingConstructor] + public CSharpInitializeHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.InitializeName)] + internal class VisualBasicInitializeHandlerShim : InitializeHandlerShim + { + [ImportingConstructor] + public VisualBasicInitializeHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.InitializeName)] + internal class TypeScriptInitializeHandlerShim : InitializeHandlerShim + { + [ImportingConstructor] + public TypeScriptInitializeHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } } diff --git a/src/VisualStudio/LiveShare/Impl/Shims/SignatureHelpHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/SignatureHelpHandlerShim.cs index d39dffe3009..3f80d90a1ed 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/SignatureHelpHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/SignatureHelpHandlerShim.cs @@ -9,13 +9,48 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentSignatureHelpName)] internal class SignatureHelpHandlerShim : AbstractLiveShareHandlerShim { - [ImportingConstructor] - public SignatureHelpHandlerShim([ImportMany] IEnumerable> requestHandlers) + public SignatureHelpHandlerShim(IEnumerable> requestHandlers) : base(requestHandlers, Methods.TextDocumentSignatureHelpName) { } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentSignatureHelpName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynSignatureHelpHandlerShim : SignatureHelpHandlerShim + { + [ImportingConstructor] + public RoslynSignatureHelpHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.TextDocumentSignatureHelpName)] + internal class CSharpSignatureHelpHandlerShim : SignatureHelpHandlerShim + { + [ImportingConstructor] + public CSharpSignatureHelpHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.TextDocumentSignatureHelpName)] + internal class VisualBasicSignatureHelpHandlerShim : SignatureHelpHandlerShim + { + [ImportingConstructor] + public VisualBasicSignatureHelpHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentSignatureHelpName)] + internal class TypeScriptSignatureHelpHandlerShim : SignatureHelpHandlerShim + { + [ImportingConstructor] + public TypeScriptSignatureHelpHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } } diff --git a/src/VisualStudio/LiveShare/Impl/Shims/WorkspaceSymbolsHandlerShim.cs b/src/VisualStudio/LiveShare/Impl/Shims/WorkspaceSymbolsHandlerShim.cs index 7841a89c0a0..21f6420afb0 100644 --- a/src/VisualStudio/LiveShare/Impl/Shims/WorkspaceSymbolsHandlerShim.cs +++ b/src/VisualStudio/LiveShare/Impl/Shims/WorkspaceSymbolsHandlerShim.cs @@ -9,13 +9,48 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare { - [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.WorkspaceSymbolName)] internal class WorkspaceSymbolsHandlerShim : AbstractLiveShareHandlerShim { - [ImportingConstructor] - public WorkspaceSymbolsHandlerShim([ImportMany] IEnumerable> requestHandlers) + public WorkspaceSymbolsHandlerShim(IEnumerable> requestHandlers) : base(requestHandlers, Methods.WorkspaceSymbolName) { } } + + [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.WorkspaceSymbolName)] + [Obsolete("Used for backwards compatibility with old liveshare clients.")] + internal class RoslynWorkspaceSymbolsHandlerShim : WorkspaceSymbolsHandlerShim + { + [ImportingConstructor] + public RoslynWorkspaceSymbolsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.CSharpContractName, Methods.WorkspaceSymbolName)] + internal class CSharpWorkspaceSymbolsHandlerShim : WorkspaceSymbolsHandlerShim + { + [ImportingConstructor] + public CSharpWorkspaceSymbolsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, Methods.WorkspaceSymbolName)] + internal class VisualBasicWorkspaceSymbolsHandlerShim : WorkspaceSymbolsHandlerShim + { + [ImportingConstructor] + public VisualBasicWorkspaceSymbolsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } + + [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.WorkspaceSymbolName)] + internal class TypeScriptWorkspaceSymbolsHandlerShim : WorkspaceSymbolsHandlerShim + { + [ImportingConstructor] + public TypeScriptWorkspaceSymbolsHandlerShim([ImportMany] IEnumerable> requestHandlers) : base(requestHandlers) + { + } + } } -- GitLab