提交 03550308 编写于 作者: D David Barbet

Request language specific provider from liveshare client.

上级 f7a2fef5
......@@ -30,42 +30,42 @@ public ILanguageService CreateLanguageService(HostLanguageServices languageServi
[ExportLanguageServiceFactory(typeof(ISyntaxClassificationService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspEditorClassificationFactoryService : ILanguageServiceFactory
{
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly CSharpLspClientServiceFactory _csharpLspClientServiceFactory;
private readonly ClassificationTypeMap _classificationTypeMap;
private readonly IThreadingContext _threadingContext;
[ImportingConstructor]
public CSharpLspEditorClassificationFactoryService(RoslynLspClientServiceFactory roslynLspClientServiceFactory, ClassificationTypeMap classificationTypeMap, IThreadingContext threadingContext)
public CSharpLspEditorClassificationFactoryService(CSharpLspClientServiceFactory csharpLspClientServiceFactory, ClassificationTypeMap classificationTypeMap, IThreadingContext threadingContext)
{
_roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
_csharpLspClientServiceFactory = csharpLspClientServiceFactory ?? throw new ArgumentNullException(nameof(csharpLspClientServiceFactory));
_classificationTypeMap = classificationTypeMap ?? throw new ArgumentNullException(nameof(classificationTypeMap));
_threadingContext = threadingContext;
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return new RoslynClassificationService(_roslynLspClientServiceFactory, languageServices.GetOriginalLanguageService<ISyntaxClassificationService>(), _classificationTypeMap, _threadingContext);
return new RoslynClassificationService(_csharpLspClientServiceFactory, languageServices.GetOriginalLanguageService<ISyntaxClassificationService>(), _classificationTypeMap, _threadingContext);
}
}
[ExportLanguageServiceFactory(typeof(ISyntaxClassificationService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspEditorClassificationFactoryService : ILanguageServiceFactory
{
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly VisualBasicLspClientServiceFactory _vbLspClientServiceFactory;
private readonly ClassificationTypeMap _classificationTypeMap;
private readonly IThreadingContext _threadingContext;
[ImportingConstructor]
public VBLspEditorClassificationFactoryService(RoslynLspClientServiceFactory roslynLspClientServiceFactory, ClassificationTypeMap classificationTypeMap, IThreadingContext threadingContext)
public VBLspEditorClassificationFactoryService(VisualBasicLspClientServiceFactory vbLspClientServiceFactory, ClassificationTypeMap classificationTypeMap, IThreadingContext threadingContext)
{
_roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
_vbLspClientServiceFactory = vbLspClientServiceFactory ?? throw new ArgumentNullException(nameof(vbLspClientServiceFactory));
_classificationTypeMap = classificationTypeMap ?? throw new ArgumentNullException(nameof(classificationTypeMap));
_threadingContext = threadingContext;
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return new RoslynClassificationService(_roslynLspClientServiceFactory, languageServices.GetOriginalLanguageService<ISyntaxClassificationService>(), _classificationTypeMap, _threadingContext);
return new RoslynClassificationService(_vbLspClientServiceFactory, languageServices.GetOriginalLanguageService<ISyntaxClassificationService>(), _classificationTypeMap, _threadingContext);
}
}
}
......@@ -17,12 +17,12 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Classification
{
internal class RoslynClassificationService : ISyntaxClassificationService
{
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly AbstractLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly ISyntaxClassificationService _originalService;
private readonly ClassificationTypeMap _classificationTypeMap;
private readonly IThreadingContext _threadingContext;
public RoslynClassificationService(RoslynLspClientServiceFactory roslynLspClientServiceFactory, ISyntaxClassificationService originalService,
public RoslynClassificationService(AbstractLspClientServiceFactory roslynLspClientServiceFactory, ISyntaxClassificationService originalService,
ClassificationTypeMap classificationTypeMap, IThreadingContext threadingContext)
{
_roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
......
......@@ -11,8 +11,8 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.CodeActions
internal class CSharpLspCodeActionProvider : RoslynCodeActionProvider
{
[ImportingConstructor]
public CSharpLspCodeActionProvider(RoslynLspClientServiceFactory roslynLspClientServiceFactory, IDiagnosticAnalyzerService diagnosticAnalyzerService)
: base(roslynLspClientServiceFactory, diagnosticAnalyzerService)
public CSharpLspCodeActionProvider(CSharpLspClientServiceFactory csharpLspClientServiceFactory, IDiagnosticAnalyzerService diagnosticAnalyzerService)
: base(csharpLspClientServiceFactory, diagnosticAnalyzerService)
{
}
}
......@@ -22,8 +22,8 @@ public CSharpLspCodeActionProvider(RoslynLspClientServiceFactory roslynLspClient
internal class VBLspCodeActionProvider : RoslynCodeActionProvider
{
[ImportingConstructor]
public VBLspCodeActionProvider(RoslynLspClientServiceFactory roslynLspClientServiceFactory, IDiagnosticAnalyzerService diagnosticAnalyzerService)
: base(roslynLspClientServiceFactory, diagnosticAnalyzerService)
public VBLspCodeActionProvider(VisualBasicLspClientServiceFactory vbLspClientServiceFactory, IDiagnosticAnalyzerService diagnosticAnalyzerService)
: base(vbLspClientServiceFactory, diagnosticAnalyzerService)
{
}
}
......
......@@ -14,10 +14,10 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.CodeActions
{
internal class RoslynCodeActionProvider : CodeRefactoringProvider
{
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly AbstractLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly IDiagnosticAnalyzerService _diagnosticAnalyzerService;
public RoslynCodeActionProvider(RoslynLspClientServiceFactory roslynLspClientServiceFactory, IDiagnosticAnalyzerService diagnosticAnalyzerService)
public RoslynCodeActionProvider(AbstractLspClientServiceFactory roslynLspClientServiceFactory, IDiagnosticAnalyzerService diagnosticAnalyzerService)
{
_roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
_diagnosticAnalyzerService = diagnosticAnalyzerService ?? throw new ArgumentNullException(nameof(diagnosticAnalyzerService));
......
......@@ -9,8 +9,8 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Completion
internal class CSharpLspCompletionProvider : RoslynCompletionProvider
{
[ImportingConstructor]
public CSharpLspCompletionProvider(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
: base(roslynLspClientServiceFactory)
public CSharpLspCompletionProvider(CSharpLspClientServiceFactory csharpLspClientServiceFactory)
: base(csharpLspClientServiceFactory)
{
}
}
......@@ -19,8 +19,8 @@ public CSharpLspCompletionProvider(RoslynLspClientServiceFactory roslynLspClient
internal class VBLspCompletionProvider : RoslynCompletionProvider
{
[ImportingConstructor]
public VBLspCompletionProvider(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
: base(roslynLspClientServiceFactory)
public VBLspCompletionProvider(VisualBasicLspClientServiceFactory vbLspClientServiceFactory)
: base(vbLspClientServiceFactory)
{
}
}
......
......@@ -16,9 +16,9 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Completion
{
internal class RoslynCompletionProvider : CommonCompletionProvider
{
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly AbstractLspClientServiceFactory _roslynLspClientServiceFactory;
public RoslynCompletionProvider(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
public RoslynCompletionProvider(AbstractLspClientServiceFactory roslynLspClientServiceFactory)
{
_roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
}
......
......@@ -9,8 +9,8 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Diagnostics
internal class CSharpLspRemoteDiagnosticsService : RoslynRemoteDiagnosticsService
{
[ImportingConstructor]
public CSharpLspRemoteDiagnosticsService(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
: base(roslynLspClientServiceFactory)
public CSharpLspRemoteDiagnosticsService(CSharpLspClientServiceFactory csharpLspClientServiceFactory)
: base(csharpLspClientServiceFactory)
{
}
}
......@@ -19,8 +19,8 @@ public CSharpLspRemoteDiagnosticsService(RoslynLspClientServiceFactory roslynLsp
internal class VBLspRemoteDiagnosticsService : RoslynRemoteDiagnosticsService
{
[ImportingConstructor]
public VBLspRemoteDiagnosticsService(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
: base(roslynLspClientServiceFactory)
public VBLspRemoteDiagnosticsService(VisualBasicLspClientServiceFactory vbLspClientServiceFactory)
: base(vbLspClientServiceFactory)
{
}
}
......
......@@ -13,9 +13,9 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Diagnostics
{
internal class RoslynRemoteDiagnosticsService : IRemoteDiagnosticsService
{
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly AbstractLspClientServiceFactory _roslynLspClientServiceFactory;
public RoslynRemoteDiagnosticsService(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
public RoslynRemoteDiagnosticsService(AbstractLspClientServiceFactory roslynLspClientServiceFactory)
{
_roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
}
......
......@@ -13,17 +13,17 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.GotoDefinition
internal class CSharpLspGotoDefinitionService : RoslynGotoDefinitionService
{
[ImportingConstructor]
public CSharpLspGotoDefinitionService(IStreamingFindUsagesPresenter streamingPresenter, RoslynLspClientServiceFactory roslynLspClientServiceFactory,
public CSharpLspGotoDefinitionService(IStreamingFindUsagesPresenter streamingPresenter, CSharpLspClientServiceFactory csharpLspClientServiceFactory,
RemoteLanguageServiceWorkspace remoteWorkspace, IThreadingContext threadingContext)
: base(streamingPresenter, roslynLspClientServiceFactory, remoteWorkspace, threadingContext) { }
: base(streamingPresenter, csharpLspClientServiceFactory, remoteWorkspace, threadingContext) { }
}
[ExportLanguageService(typeof(IGoToDefinitionService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspGotoDefinitionService : RoslynGotoDefinitionService
{
[ImportingConstructor]
public VBLspGotoDefinitionService(IStreamingFindUsagesPresenter streamingPresenter, RoslynLspClientServiceFactory roslynLspClientServiceFactory,
public VBLspGotoDefinitionService(IStreamingFindUsagesPresenter streamingPresenter, VisualBasicLspClientServiceFactory vbLspClientServiceFactory,
RemoteLanguageServiceWorkspace remoteWorkspace, IThreadingContext threadingContext)
: base(streamingPresenter, roslynLspClientServiceFactory, remoteWorkspace, threadingContext) { }
: base(streamingPresenter, vbLspClientServiceFactory, remoteWorkspace, threadingContext) { }
}
}
......@@ -21,13 +21,13 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.GotoDefinition
internal class RoslynGotoDefinitionService : IGoToDefinitionService
{
private readonly IStreamingFindUsagesPresenter _streamingPresenter;
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly AbstractLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly RemoteLanguageServiceWorkspace _remoteWorkspace;
private readonly IThreadingContext _threadingContext;
public RoslynGotoDefinitionService(
IStreamingFindUsagesPresenter streamingPresenter,
RoslynLspClientServiceFactory roslynLspClientServiceFactory,
AbstractLspClientServiceFactory roslynLspClientServiceFactory,
RemoteLanguageServiceWorkspace remoteWorkspace,
IThreadingContext threadingContext)
{
......
......@@ -10,8 +10,8 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Highlights
internal class CSharpLspDocumentHighlightsService : RoslynDocumentHighlightsService
{
[ImportingConstructor]
public CSharpLspDocumentHighlightsService(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
: base(roslynLspClientServiceFactory)
public CSharpLspDocumentHighlightsService(CSharpLspClientServiceFactory csharpLspClientServiceFactory)
: base(csharpLspClientServiceFactory)
{
}
}
......@@ -20,8 +20,8 @@ public CSharpLspDocumentHighlightsService(RoslynLspClientServiceFactory roslynLs
internal class VBLspDocumentHighlightsService : RoslynDocumentHighlightsService
{
[ImportingConstructor]
public VBLspDocumentHighlightsService(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
: base(roslynLspClientServiceFactory)
public VBLspDocumentHighlightsService(VisualBasicLspClientServiceFactory vbLspClientServiceFactory)
: base(vbLspClientServiceFactory)
{
}
}
......
......@@ -13,9 +13,9 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Highlights
{
internal class RoslynDocumentHighlightsService : IDocumentHighlightsService
{
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly AbstractLspClientServiceFactory _roslynLspClientServiceFactory;
public RoslynDocumentHighlightsService(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
public RoslynDocumentHighlightsService(AbstractLspClientServiceFactory roslynLspClientServiceFactory)
{
_roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
}
......
......@@ -10,8 +10,8 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Navigation
internal class CSharpLspNavigationBarItemService : RoslynNavigationBarItemService
{
[ImportingConstructor]
protected CSharpLspNavigationBarItemService(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
: base(roslynLspClientServiceFactory)
protected CSharpLspNavigationBarItemService(CSharpLspClientServiceFactory csharpLspClientServiceFactory)
: base(csharpLspClientServiceFactory)
{
}
}
......@@ -20,8 +20,8 @@ protected CSharpLspNavigationBarItemService(RoslynLspClientServiceFactory roslyn
internal class VBLspNavigationBarItemService : RoslynNavigationBarItemService
{
[ImportingConstructor]
protected VBLspNavigationBarItemService(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
: base(roslynLspClientServiceFactory)
protected VBLspNavigationBarItemService(VisualBasicLspClientServiceFactory vbLspClientServiceFactory)
: base(vbLspClientServiceFactory)
{
}
}
......@@ -30,8 +30,8 @@ protected VBLspNavigationBarItemService(RoslynLspClientServiceFactory roslynLspC
internal class TypeScriptLspNavigationBarItemService : RoslynNavigationBarItemService
{
[ImportingConstructor]
protected TypeScriptLspNavigationBarItemService(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
: base(roslynLspClientServiceFactory)
protected TypeScriptLspNavigationBarItemService(TypeScriptLspClientServiceFactory typeScriptLspClientServiceFactory)
: base(typeScriptLspClientServiceFactory)
{
}
}
......
......@@ -20,9 +20,9 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Navigation
{
internal class RoslynNavigationBarItemService : AbstractNavigationBarItemService
{
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly AbstractLspClientServiceFactory _roslynLspClientServiceFactory;
internal RoslynNavigationBarItemService(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
internal RoslynNavigationBarItemService(AbstractLspClientServiceFactory roslynLspClientServiceFactory)
{
_roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
}
......
......@@ -17,11 +17,11 @@ internal class RoslynRemoteProjectInfoProvider : IRemoteProjectInfoProvider
{
private const string SystemUriSchemeExternal = "vslsexternal";
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly CSharpLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly RemoteLanguageServiceWorkspace _remoteLanguageServiceWorkspace;
[ImportingConstructor]
public RoslynRemoteProjectInfoProvider(RoslynLspClientServiceFactory roslynLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace)
public RoslynRemoteProjectInfoProvider(CSharpLspClientServiceFactory roslynLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace)
{
_roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
_remoteLanguageServiceWorkspace = remoteLanguageServiceWorkspace ?? throw new ArgumentNullException(nameof(RemoteLanguageServiceWorkspace));
......
......@@ -10,8 +10,8 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.References
internal class CSharpLspFindUsagesService : RoslynFindUsagesService
{
[ImportingConstructor]
public CSharpLspFindUsagesService(RoslynLspClientServiceFactory roslynLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace)
: base(roslynLspClientServiceFactory, remoteLanguageServiceWorkspace)
public CSharpLspFindUsagesService(CSharpLspClientServiceFactory csharpLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace)
: base(csharpLspClientServiceFactory, remoteLanguageServiceWorkspace)
{
}
}
......@@ -20,8 +20,8 @@ public CSharpLspFindUsagesService(RoslynLspClientServiceFactory roslynLspClientS
internal class VBLspFindUsagesService : RoslynFindUsagesService
{
[ImportingConstructor]
public VBLspFindUsagesService(RoslynLspClientServiceFactory roslynLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace)
: base(roslynLspClientServiceFactory, remoteLanguageServiceWorkspace)
public VBLspFindUsagesService(VisualBasicLspClientServiceFactory vbLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace)
: base(vbLspClientServiceFactory, remoteLanguageServiceWorkspace)
{
}
}
......
......@@ -14,10 +14,10 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.References
{
internal class RoslynFindUsagesService : IFindUsagesService
{
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly AbstractLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly RemoteLanguageServiceWorkspace _remoteLanguageServiceWorkspace;
public RoslynFindUsagesService(RoslynLspClientServiceFactory roslynLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace)
public RoslynFindUsagesService(AbstractLspClientServiceFactory roslynLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace)
{
_roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
_remoteLanguageServiceWorkspace = remoteLanguageServiceWorkspace ?? throw new ArgumentNullException(nameof(remoteLanguageServiceWorkspace));
......
......@@ -11,16 +11,9 @@
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare
{
[Export]
[ExportCollaborationService(typeof(RoslynLSPClientLifeTimeService),
Scope = SessionScope.Guest,
Role = ServiceRole.LocalService,
Features = "LspServices",
CreationPriority = (int)ServiceRole.LocalService + 2000)]
internal class RoslynLspClientServiceFactory : ICollaborationServiceFactory
internal abstract class AbstractLspClientServiceFactory : ICollaborationServiceFactory
{
private const string RoslynProviderName = "Roslyn";
private const string AnyProviderName = "any";
protected abstract string LanguageSpecificProviderName { get; }
public ILanguageServerClient ActiveLanguageServerClient { get; private set; }
......@@ -30,11 +23,19 @@ public Task<ICollaborationService> CreateServiceAsync(CollaborationSession colla
collaborationSession.RemoteServicesChanged += (sender, e) =>
{
// VS will expose a roslyn LSP server and VSCode will expose a "any" LSP provider and both support roslyn languages.
var roslynLspServerProviderName = LanguageServicesUtils.GetLanguageServerProviderServiceName(RoslynProviderName);
var anyLspServerProviderName = LanguageServicesUtils.GetLanguageServerProviderServiceName(AnyProviderName);
// VS will expose a roslyn LSP server.
var roslynLspServerProviderName = LanguageServicesUtils.GetLanguageServerProviderServiceName(StringConstants.RoslynProviderName);
// Newer versions of VS will expose language specific LSP servers for Roslyn.
var languageSpecificLspServerProviderName = LanguageServicesUtils.GetLanguageServerProviderServiceName(LanguageSpecificProviderName);
// VSCode will expose a "any" LSP provider and both support roslyn languages.
var anyLspServerProviderName = LanguageServicesUtils.GetLanguageServerProviderServiceName(StringConstants.AnyProviderName);
if (collaborationSession.RemoteServiceNames.Contains(roslynLspServerProviderName))
// For VS, Preferentially use the language specific server when it's available, otherwise fall back to the generic roslyn server.
if (collaborationSession.RemoteServiceNames.Contains(languageSpecificLspServerProviderName))
{
ActiveLanguageServerClient = languageServerGuestService.CreateLanguageServerClient(languageSpecificLspServerProviderName);
}
else if (collaborationSession.RemoteServiceNames.Contains(roslynLspServerProviderName))
{
ActiveLanguageServerClient = languageServerGuestService.CreateLanguageServerClient(roslynLspServerProviderName);
}
......@@ -112,7 +113,7 @@ public Task<ICollaborationService> CreateServiceAsync(CollaborationSession colla
return Task.FromResult<ICollaborationService>(lifeTimeService);
}
private class RoslynLSPClientLifeTimeService : ICollaborationService, IDisposable
protected class RoslynLSPClientLifeTimeService : ICollaborationService, IDisposable
{
public event EventHandler Disposed;
......@@ -122,4 +123,37 @@ public void Dispose()
}
}
}
[Export]
[ExportCollaborationService(typeof(RoslynLSPClientLifeTimeService),
Scope = SessionScope.Guest,
Role = ServiceRole.LocalService,
Features = "LspServices",
CreationPriority = (int)ServiceRole.LocalService + 2000)]
internal class CSharpLspClientServiceFactory : AbstractLspClientServiceFactory
{
protected override string LanguageSpecificProviderName => StringConstants.CSharpProviderName;
}
[Export]
[ExportCollaborationService(typeof(RoslynLSPClientLifeTimeService),
Scope = SessionScope.Guest,
Role = ServiceRole.LocalService,
Features = "LspServices",
CreationPriority = (int)ServiceRole.LocalService + 2000)]
internal class VisualBasicLspClientServiceFactory : AbstractLspClientServiceFactory
{
protected override string LanguageSpecificProviderName => StringConstants.VisualBasicProviderName;
}
[Export]
[ExportCollaborationService(typeof(RoslynLSPClientLifeTimeService),
Scope = SessionScope.Guest,
Role = ServiceRole.LocalService,
Features = "LspServices",
CreationPriority = (int)ServiceRole.LocalService + 2000)]
internal class TypeScriptLspClientServiceFactory : AbstractLspClientServiceFactory
{
protected override string LanguageSpecificProviderName => StringConstants.TypeScriptProviderName;
}
}
......@@ -11,8 +11,8 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
internal class CSharpLspSignatureHelpProvider : RoslynSignatureHelpProvider
{
[ImportingConstructor]
public CSharpLspSignatureHelpProvider(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
: base(roslynLspClientServiceFactory)
public CSharpLspSignatureHelpProvider(CSharpLspClientServiceFactory csharpLspClientServiceFactory)
: base(csharpLspClientServiceFactory)
{
}
}
......@@ -22,8 +22,8 @@ public CSharpLspSignatureHelpProvider(RoslynLspClientServiceFactory roslynLspCli
internal class VBLspSignatureHelpProvider : RoslynSignatureHelpProvider
{
[ImportingConstructor]
public VBLspSignatureHelpProvider(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
: base(roslynLspClientServiceFactory)
public VBLspSignatureHelpProvider(VisualBasicLspClientServiceFactory vbLspClientServiceFactory)
: base(vbLspClientServiceFactory)
{
}
}
......
......@@ -16,9 +16,9 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
{
class RoslynSignatureHelpProvider : ISignatureHelpProvider
{
private readonly RoslynLspClientServiceFactory _roslynLspClientServiceFactory;
private readonly AbstractLspClientServiceFactory _roslynLspClientServiceFactory;
public RoslynSignatureHelpProvider(RoslynLspClientServiceFactory roslynLspClientServiceFactory)
public RoslynSignatureHelpProvider(AbstractLspClientServiceFactory roslynLspClientServiceFactory)
{
_roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
}
......
......@@ -11,6 +11,13 @@ internal class StringConstants
// The service name for an LSP server implemented using Roslyn designed to be used with the LSP SDK client
public const string RoslynLspSdkContractName = "RoslynLSPSDK";
// LSP server provider names.
public const string RoslynProviderName = "Roslyn";
public const string CSharpProviderName = "RoslynCSharp";
public const string VisualBasicProviderName = "RoslynVisualBasic";
public const string TypeScriptProviderName = "RoslynTypeScript";
public const string AnyProviderName = "any";
public const string CSharpLspLanguageName = "C#_LSP";
public const string CSharpLspContentTypeName = "C#_LSP";
public const string TypeScriptLanguageName = "TypeScript";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册