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

Request language specific provider from liveshare client.

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