提交 d896ff64 编写于 作者: S Sam Harwell

Fix RS0034 by defining missing constructors

上级 312939fb
......@@ -16,6 +16,11 @@ namespace Microsoft.CodeAnalysis.CSharp.AssignOutParameters
[ExportCodeFixProvider(LanguageNames.CSharp), Shared]
internal class AssignOutParametersAboveReturnCodeFixProvider : AbstractAssignOutParametersCodeFixProvider
{
[ImportingConstructor]
public AssignOutParametersAboveReturnCodeFixProvider()
{
}
protected override void TryRegisterFix(CodeFixContext context, Document document, SyntaxNode container, SyntaxNode location)
{
context.RegisterCodeFix(new MyCodeAction(
......
......@@ -14,6 +14,11 @@ namespace Microsoft.CodeAnalysis.CSharp.AssignOutParameters
[ExportCodeFixProvider(LanguageNames.CSharp), Shared]
internal class AssignOutParametersAtStartCodeFixProvider : AbstractAssignOutParametersCodeFixProvider
{
[ImportingConstructor]
public AssignOutParametersAtStartCodeFixProvider()
{
}
protected override void TryRegisterFix(CodeFixContext context, Document document, SyntaxNode container, SyntaxNode location)
{
// Don't offer if we're already the starting statement of the container. This case will
......
......@@ -14,6 +14,11 @@ namespace Microsoft.CodeAnalysis.CSharp.CodeRefactorings
[ExportLanguageService(typeof(IRefactoringHelpersService), LanguageNames.CSharp), Shared]
internal class CSharpRefactoringHelpersService : AbstractRefactoringHelpersService<ExpressionSyntax, ArgumentSyntax, ExpressionStatementSyntax>
{
[ImportingConstructor]
public CSharpRefactoringHelpersService()
{
}
protected override IEnumerable<SyntaxNode> ExtractNodesSimple(SyntaxNode? node, ISyntaxFactsService syntaxFacts)
{
if (node == null)
......
......@@ -25,6 +25,11 @@ namespace Microsoft.CodeAnalysis.CSharp.ConvertSwitchStatementToExpression
[ExportCodeFixProvider(LanguageNames.CSharp), Shared]
internal sealed partial class ConvertSwitchStatementToExpressionCodeFixProvider : SyntaxEditorBasedCodeFixProvider
{
[ImportingConstructor]
public ConvertSwitchStatementToExpressionCodeFixProvider()
{
}
public override ImmutableArray<string> FixableDiagnosticIds
=> ImmutableArray.Create(IDEDiagnosticIds.ConvertSwitchStatementToExpressionDiagnosticId);
......
......@@ -24,6 +24,11 @@ namespace Microsoft.CodeAnalysis.CSharp.ImplementInterface
internal class CSharpImplementExplicitlyCodeRefactoringProvider :
AbstractChangeImplementionCodeRefactoringProvider
{
[ImportingConstructor]
public CSharpImplementExplicitlyCodeRefactoringProvider()
{
}
protected override string Implement_0 => FeaturesResources.Implement_0_explicitly;
protected override string Implement_all_interfaces => FeaturesResources.Implement_all_interfaces_explicitly;
protected override string Implement => FeaturesResources.Implement_explicitly;
......
......@@ -18,6 +18,11 @@ namespace Microsoft.CodeAnalysis.CSharp.ImplementInterface
internal class CSharpImplementImplicitlyCodeRefactoringProvider :
AbstractChangeImplementionCodeRefactoringProvider
{
[ImportingConstructor]
public CSharpImplementImplicitlyCodeRefactoringProvider()
{
}
protected override string Implement_0 => FeaturesResources.Implement_0_implicitly;
protected override string Implement_all_interfaces => FeaturesResources.Implement_all_interfaces_implicitly;
protected override string Implement => FeaturesResources.Implement_implicitly;
......
......@@ -16,6 +16,11 @@ internal class CSharpIntroduceLocalForExpressionCodeRefactoringProvider :
ExpressionStatementSyntax,
LocalDeclarationStatementSyntax>
{
[ImportingConstructor]
public CSharpIntroduceLocalForExpressionCodeRefactoringProvider()
{
}
protected override bool IsValid(ExpressionStatementSyntax expressionStatement, TextSpan span)
{
// Expression is likely too simple to want to offer to generate a local for.
......
......@@ -15,6 +15,11 @@ namespace Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = nameof(MakeLocalFunctionStaticCodeRefactoringProvider)), Shared]
internal sealed class MakeLocalFunctionStaticCodeRefactoringProvider : CodeRefactoringProvider
{
[ImportingConstructor]
public MakeLocalFunctionStaticCodeRefactoringProvider()
{
}
public override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
{
var (document, textSpan, cancellationToken) = context;
......
......@@ -19,6 +19,11 @@ namespace Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(PassInCapturedVariablesAsArgumentsCodeFixProvider)), Shared]
internal sealed class PassInCapturedVariablesAsArgumentsCodeFixProvider : SyntaxEditorBasedCodeFixProvider
{
[ImportingConstructor]
public PassInCapturedVariablesAsArgumentsCodeFixProvider()
{
}
// "CS8421: A static local function can't contain a reference to <variable>."
public override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create("CS8421");
......
......@@ -12,6 +12,11 @@ namespace Microsoft.CodeAnalysis.CSharp.MakeMemberStatic
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(CSharpMakeMemberStaticCodeFixProvider)), Shared]
internal sealed class CSharpMakeMemberStaticCodeFixProvider : AbstractMakeMemberStaticCodeFixProvider
{
[ImportingConstructor]
public CSharpMakeMemberStaticCodeFixProvider()
{
}
public override ImmutableArray<string> FixableDiagnosticIds { get; } =
ImmutableArray.Create(
"CS0708" // 'MyMethod': cannot declare instance members in a static class
......
......@@ -11,5 +11,9 @@ namespace Microsoft.CodeAnalysis.CSharp.MoveDeclarationNearReference
[ExtensionOrder(After = PredefinedCodeRefactoringProviderNames.InlineTemporary)]
class CSharpMoveDeclarationNearReferenceCodeRefactoringProvider : AbstractMoveDeclarationNearReferenceCodeRefactoringProvider<LocalDeclarationStatementSyntax>
{
[ImportingConstructor]
public CSharpMoveDeclarationNearReferenceCodeRefactoringProvider()
{
}
}
}
......@@ -24,6 +24,11 @@ internal class CSharpPopulateSwitchExpressionCodeFixProvider
SwitchExpressionArmSyntax,
MemberAccessExpressionSyntax>
{
[ImportingConstructor]
public CSharpPopulateSwitchExpressionCodeFixProvider()
{
}
protected override SwitchExpressionArmSyntax CreateDefaultSwitchArm(SyntaxGenerator generator, Compilation compilation)
=> SwitchExpressionArm(DiscardPattern(), Exception(generator, compilation));
......
......@@ -15,5 +15,9 @@ namespace Microsoft.CodeAnalysis.CSharp.PopulateSwitch
internal class CSharpPopulateSwitchStatementCodeFixProvider : AbstractPopulateSwitchStatementCodeFixProvider<
SwitchStatementSyntax, SwitchSectionSyntax, MemberAccessExpressionSyntax>
{
[ImportingConstructor]
public CSharpPopulateSwitchStatementCodeFixProvider()
{
}
}
}
......@@ -24,6 +24,11 @@ namespace Microsoft.CodeAnalysis.CSharp.ReverseForStatement
[ExportCodeRefactoringProvider(LanguageNames.CSharp), Shared]
internal class CSharpReverseForStatementCodeRefactoringProvider : CodeRefactoringProvider
{
[ImportingConstructor]
public CSharpReverseForStatementCodeRefactoringProvider()
{
}
public override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
{
var forStatement = await context.TryGetRelevantNodeAsync<ForStatementSyntax>().ConfigureAwait(false);
......
......@@ -15,6 +15,11 @@ namespace Microsoft.CodeAnalysis.CSharp.SignatureHelp
[ExportSignatureHelpProvider(nameof(InitializerExpressionSignatureHelpProvider), LanguageNames.CSharp), Shared]
internal partial class InitializerExpressionSignatureHelpProvider : AbstractOrdinaryMethodSignatureHelpProvider
{
[ImportingConstructor]
public InitializerExpressionSignatureHelpProvider()
{
}
public override bool IsTriggerCharacter(char ch)
=> ch == '{' || ch == ',';
......
......@@ -13,6 +13,11 @@ internal class CSharpSimplifyInterpolationCodeFixProvider : AbstractSimplifyInte
InterpolationSyntax, ExpressionSyntax, InterpolationAlignmentClauseSyntax,
InterpolationFormatClauseSyntax, InterpolatedStringExpressionSyntax>
{
[ImportingConstructor]
public CSharpSimplifyInterpolationCodeFixProvider()
{
}
protected override InterpolationSyntax WithExpression(InterpolationSyntax interpolation, ExpressionSyntax expression)
=> interpolation.WithExpression(expression);
......
......@@ -227,11 +227,19 @@ public MyCodeAction(string title, Func<CancellationToken, Task<Document>> create
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(UseExpressionBodyForLambdaCodeFixProvider)), Shared]
internal sealed class UseExpressionBodyForLambdaCodeFixProvider : UseExpressionBodyForLambdaCodeStyleProvider.CodeFixProvider
{
[ImportingConstructor]
public UseExpressionBodyForLambdaCodeFixProvider()
{
}
}
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = nameof(UseExpressionBodyForLambdaCodeRefactoringProvider)), Shared]
internal sealed class UseExpressionBodyForLambdaCodeRefactoringProvider : UseExpressionBodyForLambdaCodeStyleProvider.CodeRefactoringProvider
{
[ImportingConstructor]
public UseExpressionBodyForLambdaCodeRefactoringProvider()
{
}
}
[DiagnosticAnalyzer(LanguageNames.CSharp)]
......
......@@ -27,6 +27,11 @@ internal sealed partial class ConfigureCodeStyleOptionCodeFixProvider : IConfigu
{
private static readonly ImmutableArray<bool> s_boolValues = ImmutableArray.Create(true, false);
[ImportingConstructor]
public ConfigureCodeStyleOptionCodeFixProvider()
{
}
public bool IsFixableDiagnostic(Diagnostic diagnostic)
{
// We only offer fix for configurable code style diagnostics which have one of more editorconfig based storage locations.
......
......@@ -26,6 +26,11 @@ internal sealed partial class ConfigureSeverityLevelCodeFixProvider : IConfigura
(nameof(EditorConfigSeverityStrings.Warning), EditorConfigSeverityStrings.Warning),
(nameof(EditorConfigSeverityStrings.Error), EditorConfigSeverityStrings.Error));
[ImportingConstructor]
public ConfigureSeverityLevelCodeFixProvider()
{
}
// We only offer fix for configurable diagnostics.
// Also skip suppressed diagnostics defensively, though the code fix engine should ideally never call us for suppressed diagnostics.
public bool IsFixableDiagnostic(Diagnostic diagnostic)
......
......@@ -141,6 +141,10 @@ public void Dispose()
[ExportWorkspaceServiceFactory(typeof(IImportCompletionCacheService<CacheEntry, CacheEntry>), ServiceLayer.Editor), Shared]
private sealed class CacheServiceFactory : AbstractImportCompletionCacheServiceFactory<CacheEntry, CacheEntry>
{
[ImportingConstructor]
public CacheServiceFactory()
{
}
}
}
}
......@@ -97,6 +97,10 @@ public void Dispose()
[ExportWorkspaceServiceFactory(typeof(IImportCompletionCacheService<CacheEntry, object>), ServiceLayer.Editor), Shared]
private sealed class CacheServiceFactory : AbstractImportCompletionCacheServiceFactory<CacheEntry, object>
{
[ImportingConstructor]
public CacheServiceFactory()
{
}
}
private static IImportCompletionCacheService<CacheEntry, object> GetCacheService(Workspace workspace)
......
......@@ -8,6 +8,11 @@ namespace Microsoft.CodeAnalysis.SolutionCrawler
[ExportEventListener(WellKnownEventListeners.Workspace, WorkspaceKind.Host), Shared]
internal class HostSolutionCrawlerWorkspaceEventListener : IEventListener<object>, IEventListenerStoppable
{
[ImportingConstructor]
public HostSolutionCrawlerWorkspaceEventListener()
{
}
public void StartListening(Workspace workspace, object serviceOpt)
{
var registration = workspace.Services.GetService<ISolutionCrawlerRegistrationService>();
......
......@@ -9,6 +9,11 @@ namespace Microsoft.CodeAnalysis.SolutionCrawler
[ExportEventListener(WellKnownEventListeners.Workspace, WorkspaceKind.MiscellaneousFiles), Shared]
internal class MiscSolutionCrawlerWorkspaceEventListener : IEventListener<object>, IEventListenerStoppable
{
[ImportingConstructor]
public MiscSolutionCrawlerWorkspaceEventListener()
{
}
public void StartListening(Workspace workspace, object serviceOpt)
{
// misc workspace will enable syntax errors and semantic errors for script files for
......
......@@ -21,6 +21,11 @@ namespace Microsoft.CodeAnalysis.UseSystemHashCode
[ExportCodeFixProvider(LanguageNames.CSharp, LanguageNames.VisualBasic), Shared]
internal class UseSystemHashCodeCodeFixProvider : SyntaxEditorBasedCodeFixProvider
{
[ImportingConstructor]
public UseSystemHashCodeCodeFixProvider()
{
}
public override ImmutableArray<string> FixableDiagnosticIds { get; }
= ImmutableArray.Create(IDEDiagnosticIds.UseSystemHashCode);
......
......@@ -21,6 +21,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
[ExportLspMethod(LSP.Methods.TextDocumentCompletionName)]
internal class CompletionHandler : IRequestHandler<LSP.CompletionParams, object>
{
[ImportingConstructor]
public CompletionHandler()
{
}
public async Task<object> HandleRequestAsync(Solution solution, LSP.CompletionParams request, LSP.ClientCapabilities clientCapabilities,
CancellationToken cancellationToken)
{
......
......@@ -19,6 +19,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
[ExportLspMethod(LSP.Methods.TextDocumentCompletionResolveName)]
internal class CompletionResolveHandler : IRequestHandler<LSP.CompletionItem, LSP.CompletionItem>
{
[ImportingConstructor]
public CompletionResolveHandler()
{
}
public async Task<LSP.CompletionItem> HandleRequestAsync(Solution solution, LSP.CompletionItem completionItem,
LSP.ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
{
......
......@@ -13,6 +13,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
[ExportLspMethod(Methods.TextDocumentFoldingRangeName)]
internal class FoldingRangesHandler : IRequestHandler<FoldingRangeParams, FoldingRange[]>
{
[ImportingConstructor]
public FoldingRangesHandler()
{
}
public async Task<FoldingRange[]> HandleRequestAsync(Solution solution, FoldingRangeParams request,
ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
{
......
......@@ -11,6 +11,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
[ExportLspMethod(LSP.Methods.TextDocumentFormattingName)]
internal class FormatDocumentHandler : FormatDocumentHandlerBase, IRequestHandler<LSP.DocumentFormattingParams, LSP.TextEdit[]>
{
[ImportingConstructor]
public FormatDocumentHandler()
{
}
public async Task<LSP.TextEdit[]> HandleRequestAsync(Solution solution, LSP.DocumentFormattingParams request, LSP.ClientCapabilities clientCapabilities,
CancellationToken cancellationToken)
{
......
......@@ -17,6 +17,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
[ExportLspMethod(Methods.TextDocumentOnTypeFormattingName)]
internal class FormatDocumentOnTypeHandler : IRequestHandler<DocumentOnTypeFormattingParams, TextEdit[]>
{
[ImportingConstructor]
public FormatDocumentOnTypeHandler()
{
}
public async Task<TextEdit[]> HandleRequestAsync(Solution solution, DocumentOnTypeFormattingParams request, ClientCapabilities clientCapabilities,
CancellationToken cancellationToken)
{
......
......@@ -11,6 +11,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
[ExportLspMethod(Methods.TextDocumentRangeFormattingName)]
internal class FormatDocumentRangeHandler : FormatDocumentHandlerBase, IRequestHandler<DocumentRangeFormattingParams, TextEdit[]>
{
[ImportingConstructor]
public FormatDocumentRangeHandler()
{
}
public async Task<TextEdit[]> HandleRequestAsync(Solution solution, DocumentRangeFormattingParams request, ClientCapabilities clientCapabilities,
CancellationToken cancellationToken)
{
......
......@@ -15,6 +15,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
[ExportLspMethod(Methods.TextDocumentDocumentHighlightName)]
internal class DocumentHighlightsHandler : IRequestHandler<TextDocumentPositionParams, DocumentHighlight[]>
{
[ImportingConstructor]
public DocumentHighlightsHandler()
{
}
public async Task<DocumentHighlight[]> HandleRequestAsync(Solution solution, TextDocumentPositionParams request,
ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
{
......
......@@ -14,6 +14,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
[ExportLspMethod(Methods.TextDocumentHoverName)]
internal class HoverHandler : IRequestHandler<TextDocumentPositionParams, Hover>
{
[ImportingConstructor]
public HoverHandler()
{
}
public async Task<Hover> HandleRequestAsync(Solution solution, TextDocumentPositionParams request,
ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
{
......
......@@ -28,6 +28,11 @@ internal class InitializeHandler : IRequestHandler<InitializeParams, InitializeR
}
};
[ImportingConstructor]
public InitializeHandler()
{
}
public Task<InitializeResult> HandleRequestAsync(Solution solution, InitializeParams request, ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
=> Task.FromResult(s_initializeResult);
}
......
......@@ -14,6 +14,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
[ExportLspMethod(LSP.Methods.TextDocumentImplementationName)]
internal class FindImplementationsHandler : IRequestHandler<LSP.TextDocumentPositionParams, object>
{
[ImportingConstructor]
public FindImplementationsHandler()
{
}
public async Task<object> HandleRequestAsync(Solution solution, LSP.TextDocumentPositionParams request,
LSP.ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
{
......
......@@ -20,6 +20,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
[ExportLspMethod(Methods.TextDocumentDocumentSymbolName)]
internal class DocumentSymbolsHandler : IRequestHandler<DocumentSymbolParams, object[]>
{
[ImportingConstructor]
public DocumentSymbolsHandler()
{
}
public async Task<object[]> HandleRequestAsync(Solution solution, DocumentSymbolParams request,
ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
{
......
......@@ -14,6 +14,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
[ExportLspMethod(Methods.WorkspaceSymbolName)]
internal class WorkspaceSymbolsHandler : IRequestHandler<WorkspaceSymbolParams, SymbolInformation[]>
{
[ImportingConstructor]
public WorkspaceSymbolsHandler()
{
}
public async Task<SymbolInformation[]> HandleRequestAsync(Solution solution, WorkspaceSymbolParams request,
ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
{
......
......@@ -11,6 +11,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings
Friend Class VisualBasicRefactoringHelpersService
Inherits AbstractRefactoringHelpersService(Of ExpressionSyntax, ArgumentSyntax, ExpressionStatementSyntax)
<ImportingConstructor>
Public Sub New()
End Sub
Protected Overrides Iterator Function ExtractNodesSimple(node As SyntaxNode, syntaxFacts As ISyntaxFactsService) As IEnumerable(Of SyntaxNode)
For Each baseExtraction In MyBase.ExtractNodesSimple(node, syntaxFacts)
Yield baseExtraction
......
......@@ -15,6 +15,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable
ExpressionStatementSyntax,
LocalDeclarationStatementSyntax)
<ImportingConstructor>
Public Sub New()
End Sub
Protected Overrides Function IsValid(expressionStatement As ExpressionStatementSyntax, span As TextSpan) As Boolean
' Expression is likely too simple to want to offer to generate a local for.
' This leads to too many false cases where this is offered.
......
......@@ -10,5 +10,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.MoveDeclarationNearReference
<ExtensionOrder(After:=PredefinedCodeRefactoringProviderNames.InlineTemporary)>
Class VisualBasicMoveDeclarationNearReferenceCodeRefactoringProvider
Inherits AbstractMoveDeclarationNearReferenceCodeRefactoringProvider(Of LocalDeclarationStatementSyntax)
<ImportingConstructor>
Public Sub New()
End Sub
End Class
End Namespace
......@@ -12,5 +12,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.PopulateSwitch
Friend Class VisualBasicPopulateSwitchStatementCodeFixProvider
Inherits AbstractPopulateSwitchStatementCodeFixProvider(Of
SelectBlockSyntax, CaseBlockSyntax, MemberAccessExpressionSyntax)
<ImportingConstructor>
Public Sub New()
End Sub
End Class
End Namespace
......@@ -13,6 +13,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp
Partial Friend Class CollectionInitializerSignatureHelpProvider
Inherits AbstractOrdinaryMethodSignatureHelpProvider
<ImportingConstructor>
Public Sub New()
End Sub
Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean
Return ch = "{"c OrElse ch = ","c
End Function
......
......@@ -12,6 +12,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SimplifyInterpolation
InterpolationSyntax, ExpressionSyntax, InterpolationAlignmentClauseSyntax,
InterpolationFormatClauseSyntax, InterpolatedStringExpressionSyntax)
<ImportingConstructor>
Public Sub New()
End Sub
Protected Overrides Function WithExpression(interpolation As InterpolationSyntax, expression As ExpressionSyntax) As InterpolationSyntax
Return interpolation.WithExpression(expression)
End Function
......
......@@ -12,6 +12,11 @@ namespace AnalyzerRunner
[Shared]
internal class PersistentStorageLocationService : IPersistentStorageLocationService
{
[ImportingConstructor]
public PersistentStorageLocationService()
{
}
public bool IsSupported(Workspace workspace) => true;
public string TryGetStorageLocation(Solution _)
......
......@@ -14,6 +14,11 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.CommentSelection
[ExportLanguageService(typeof(ICommentSelectionService), LanguageNames.FSharp)]
internal class FSharpCommentSelectionService : ICommentSelectionService
{
[ImportingConstructor]
public FSharpCommentSelectionService()
{
}
public Task<Document> FormatAsync(Document document, ImmutableArray<TextSpan> changes, CancellationToken cancellationToken)
{
return Task.FromResult(document);
......
......@@ -11,6 +11,11 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation
[ExportWorkspaceService(typeof(IFSharpDocumentNavigationService)), Shared]
internal class FSharpDocumentNavigationService : IFSharpDocumentNavigationService
{
[ImportingConstructor]
public FSharpDocumentNavigationService()
{
}
/// <summary>
/// Determines whether it is possible to navigate to the given position in the specified document.
/// </summary>
......
......@@ -14,6 +14,11 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
[ExportLanguageService(typeof(IProjectExistsUIContextProviderLanguageService), LanguageNames.CSharp), Shared]
internal sealed class CSharpProjectExistsUIContextProviderLanguageService : IProjectExistsUIContextProviderLanguageService
{
[ImportingConstructor]
public CSharpProjectExistsUIContextProviderLanguageService()
{
}
public UIContext GetUIContext()
{
return UIContext.FromUIContextGuid(Guids.CSharpProjectExistsInWorkspaceUIContext);
......
......@@ -15,6 +15,11 @@ internal static class ExperimentationOptions
[ExportOptionProvider, Shared]
internal class ExperimentationOptionsProvider : IOptionProvider
{
[ImportingConstructor]
public ExperimentationOptionsProvider()
{
}
public ImmutableArray<IOption> Options { get; } = ImmutableArray<IOption>.Empty;
}
}
......@@ -16,6 +16,12 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.FindReferences
internal class ContainingMemberColumnDefinition : TableColumnDefinitionBase
{
public const string ColumnName = AbstractReferenceFinder.ContainingMemberInfoPropertyName;
[ImportingConstructor]
public ContainingMemberColumnDefinition()
{
}
public override bool IsFilterable => true;
public override string Name => ColumnName;
public override string DisplayName => ServicesVSResources.Containing_member;
......
......@@ -16,6 +16,12 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.FindReferences
internal class ContainingTypeColumnDefinition : TableColumnDefinitionBase
{
public const string ColumnName = AbstractReferenceFinder.ContainingTypeInfoPropertyName;
[ImportingConstructor]
public ContainingTypeColumnDefinition()
{
}
public override bool IsFilterable => true;
public override string Name => ColumnName;
public override string DisplayName => ServicesVSResources.Containing_type;
......
......@@ -13,6 +13,11 @@ internal partial class RemoteHostClientServiceFactory : IWorkspaceServiceFactory
[ExportEventListener(WellKnownEventListeners.Workspace, WorkspaceKind.Host), Shared]
private sealed class RemoteHostWorkspaceEventListener : IEventListener<object>
{
[ImportingConstructor]
public RemoteHostWorkspaceEventListener()
{
}
public void StartListening(Workspace workspace, object serviceOpt)
{
var service = (RemoteHostClientService)workspace.Services.GetService<IRemoteHostClientService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.Storage
[ExportWorkspaceService(typeof(IPersistentStorageLocationService), ServiceLayer.Host), Shared]
internal class VisualStudioPersistentStorageLocationService : DefaultPersistentStorageLocationService
{
[ImportingConstructor]
public VisualStudioPersistentStorageLocationService()
{
}
public override bool IsSupported(Workspace workspace)
=> workspace is VisualStudioWorkspace;
}
......
......@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
......@@ -30,20 +31,36 @@ protected override async Task AddClassificationsAsync(IClassificationService cla
[Obsolete("Used for backwards compatibility with old liveshare clients.")]
internal class RoslynClassificationsHandler : ClassificationsHandler
{
[ImportingConstructor]
public RoslynClassificationsHandler()
{
}
}
[ExportLspRequestHandler(LiveShareConstants.CSharpContractName, RoslynMethods.ClassificationsName)]
internal class CSharpClassificationsHandler : ClassificationsHandler
{
[ImportingConstructor]
public CSharpClassificationsHandler()
{
}
}
[ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, RoslynMethods.ClassificationsName)]
internal class VisualBasicClassificationsHandler : ClassificationsHandler
{
[ImportingConstructor]
public VisualBasicClassificationsHandler()
{
}
}
[ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, RoslynMethods.ClassificationsName)]
internal class TypeScriptClassificationsHandler : ClassificationsHandler
{
[ImportingConstructor]
public TypeScriptClassificationsHandler()
{
}
}
}
......@@ -10,12 +10,22 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Classificatio
[ExportLanguageServiceFactory(typeof(IClassificationService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspClassificationServiceFactory : RoslynClassificationServiceFactory
{
[ImportingConstructor]
public CSharpLspClassificationServiceFactory()
{
}
protected override string LiveShareContentType => StringConstants.CSharpLspLanguageName;
}
[ExportLanguageServiceFactory(typeof(IClassificationService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspClassificationServiceFactory : RoslynClassificationServiceFactory
{
[ImportingConstructor]
public VBLspClassificationServiceFactory()
{
}
protected override string LiveShareContentType => StringConstants.VBLspLanguageName;
}
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(BlockStructureService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspBlockStructureServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspBlockStructureServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<BlockStructureService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IEditorBraceCompletionSessionFactory), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspBraceCompletionServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspBraceCompletionServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<IEditorBraceCompletionSessionFactory>();
......
......@@ -9,6 +9,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ICompilationFactoryService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpRemoteCompilationFactoryService : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpRemoteCompilationFactoryService()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ICompilationFactoryService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IDocumentDifferenceService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspDocumentDifferenceServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspDocumentDifferenceServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<IDocumentDifferenceService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ILineSeparatorService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspLineSeparatorServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspLineSeparatorServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ILineSeparatorService>();
......
......@@ -9,6 +9,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageService(typeof(IRenameTrackingLanguageHeuristicsService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspRenameTrackingLanguageHeuristicsService : IRenameTrackingLanguageHeuristicsService
{
[ImportingConstructor]
public CSharpLspRenameTrackingLanguageHeuristicsService()
{
}
public bool IsIdentifierValidForRenameTracking(string name)
{
return false;
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ISyntaxFactsService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspSyntaxFactsServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspSyntaxFactsServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ISyntaxFactsService>();
......
......@@ -9,6 +9,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ISyntaxTreeFactoryService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspSyntaxTreeFactoryServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspSyntaxTreeFactoryServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ISyntaxTreeFactoryService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ICommentSelectionService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspCommentSelectionServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspCommentSelectionServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ICommentSelectionService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IDocumentationCommentFormattingService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspDocumentationCommentFormattingServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspDocumentationCommentFormattingServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<IDocumentationCommentFormattingService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ICommentSelectionService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspCommentSelectionServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspCommentSelectionServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ICommentSelectionService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IDocumentationCommentFormattingService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspDocumentationCommentFormattingServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspDocumentationCommentFormattingServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<IDocumentationCommentFormattingService>();
......
......@@ -16,6 +16,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IBreakpointResolutionService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspBreakpointServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspBreakpointServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return new CSharpRemoteBreakpointService(languageServices);
......
......@@ -16,6 +16,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ILanguageDebugInfoService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspDebugInfoServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspDebugInfoServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return new CSharpRemoteDebugInfoService(languageServices);
......
......@@ -18,6 +18,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IBreakpointResolutionService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspBreakpointServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspBreakpointServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return new VBRemoteBreakpointService(languageServices);
......
......@@ -16,6 +16,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ILanguageDebugInfoService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspDebugInfoServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspDebugInfoServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return new VBRemoteDebugInfoService(languageServices);
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IEditorFormattingService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspEditorFormattingServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspEditorFormattingServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<IEditorFormattingService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IFormattingService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspFormattingServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspFormattingServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<IFormattingService>();
......
......@@ -10,6 +10,10 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IIndentationService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspIndentationServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspIndentationServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ISyntaxFormattingService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspSyntaxFormattingServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpLspSyntaxFormattingServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ISyntaxFormattingService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IEditorFormattingService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspEditorFormattingServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspEditorFormattingServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<IEditorFormattingService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IFormattingService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspFormattingServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspFormattingServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<IFormattingService>();
......
......@@ -12,6 +12,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[Obsolete]
internal class VBLspIndentationServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspIndentationServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ISynchronousIndentationService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ISyntaxFormattingService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspSyntaxFormattingServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspSyntaxFormattingServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ISyntaxFormattingService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(BlockStructureService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspBlockStructureServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspBlockStructureServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<BlockStructureService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IEditorBraceCompletionSessionFactory), StringConstants.VBLspLanguageName), Shared]
internal class VBLspBraceCompletionServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspBraceCompletionServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<IEditorBraceCompletionSessionFactory>();
......
......@@ -9,6 +9,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ICompilationFactoryService), StringConstants.VBLspLanguageName), Shared]
internal class VBRemoteCompilationFactoryService : ILanguageServiceFactory
{
[ImportingConstructor]
public VBRemoteCompilationFactoryService()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ICompilationFactoryService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(IDocumentDifferenceService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspDocumentDifferenceServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspDocumentDifferenceServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<IDocumentDifferenceService>();
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ILineSeparatorService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspLineSeparatorServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspLineSeparatorServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ILineSeparatorService>();
......
......@@ -9,6 +9,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageService(typeof(IRenameTrackingLanguageHeuristicsService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspRenameTrackingLanguageHeuristicsService : IRenameTrackingLanguageHeuristicsService
{
[ImportingConstructor]
public VBLspRenameTrackingLanguageHeuristicsService()
{
}
public bool IsIdentifierValidForRenameTracking(string name)
{
return false;
......
......@@ -10,6 +10,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ISyntaxFactsService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspSyntaxFactsServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspSyntaxFactsServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ISyntaxFactsService>();
......
......@@ -9,6 +9,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.LocalForwarde
[ExportLanguageServiceFactory(typeof(ISyntaxTreeFactoryService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspSyntaxTreeFactoryServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public VBLspSyntaxTreeFactoryServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return languageServices.GetOriginalLanguageService<ISyntaxTreeFactoryService>();
......
......@@ -152,6 +152,11 @@ public void InitializeServerCapabilities(CancellationToken cancellationToken)
CreationPriority = (int)ServiceRole.LocalService + 2000)]
internal class CSharpLspClientServiceFactory : AbstractLspClientServiceFactory
{
[ImportingConstructor]
public CSharpLspClientServiceFactory()
{
}
protected override string LanguageSpecificProviderName => StringConstants.CSharpProviderName;
protected override RoslynLSPClientLifeTimeService LspClientLifeTimeService => new CSharpLSPClientLifeTimeService();
......@@ -169,6 +174,11 @@ private class CSharpLSPClientLifeTimeService : RoslynLSPClientLifeTimeService
CreationPriority = (int)ServiceRole.LocalService + 2000)]
internal class VisualBasicLspClientServiceFactory : AbstractLspClientServiceFactory
{
[ImportingConstructor]
public VisualBasicLspClientServiceFactory()
{
}
protected override string LanguageSpecificProviderName => StringConstants.VisualBasicProviderName;
protected override RoslynLSPClientLifeTimeService LspClientLifeTimeService => new VisualBasicLSPClientLifeTimeService();
......@@ -186,6 +196,11 @@ private class VisualBasicLSPClientLifeTimeService : RoslynLSPClientLifeTimeServi
CreationPriority = (int)ServiceRole.LocalService + 2000)]
internal class TypeScriptLspClientServiceFactory : AbstractLspClientServiceFactory
{
[ImportingConstructor]
public TypeScriptLspClientServiceFactory()
{
}
protected override string LanguageSpecificProviderName => StringConstants.TypeScriptProviderName;
protected override RoslynLSPClientLifeTimeService LspClientLifeTimeService => new TypeScriptLSPClientLifeTimeService();
......
// 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.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
......@@ -15,6 +16,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare
[ExportLspRequestHandler(LiveShareConstants.RoslynLSPSDKContractName, LSP.Methods.InitializeName)]
internal class LSPSDKInitializeHandler : ILspRequestHandler<LSP.InitializeParams, LSP.InitializeResult, Solution>
{
[ImportingConstructor]
public LSPSDKInitializeHandler()
{
}
public Task<LSP.InitializeResult> HandleAsync(LSP.InitializeParams request, RequestContext<Solution> requestContext, CancellationToken cancellationToken)
{
var result = new LSP.InitializeResult
......
......@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
......@@ -28,10 +29,18 @@ protected override async Task AddClassificationsAsync(IClassificationService cla
[ExportLspRequestHandler(LiveShareConstants.CSharpContractName, LexicalClassificationsMethodName)]
internal class CSharpLexicalClassificationsHandler : LexicalClassificationsHandler
{
[ImportingConstructor]
public CSharpLexicalClassificationsHandler()
{
}
}
[ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, LexicalClassificationsMethodName)]
internal class VisualBasicLexicalClassificationsHandler : LexicalClassificationsHandler
{
[ImportingConstructor]
public VisualBasicLexicalClassificationsHandler()
{
}
}
}
// 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 System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.LiveShare.LanguageServices;
......@@ -20,20 +21,36 @@ public Task<object> HandleAsync(object request, RequestContext requestContext, C
[Obsolete("Used for backwards compatibility with old liveshare clients.")]
internal class RoslynLoadHandler : LoadHandler
{
[ImportingConstructor]
public RoslynLoadHandler()
{
}
}
[ExportLspRequestHandler(LiveShareConstants.CSharpContractName, CustomMethods.LoadName)]
internal class CSharpLoadHandler : LoadHandler
{
[ImportingConstructor]
public CSharpLoadHandler()
{
}
}
[ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, CustomMethods.LoadName)]
internal class VisualBasicLoadHandler : LoadHandler
{
[ImportingConstructor]
public VisualBasicLoadHandler()
{
}
}
[ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, CustomMethods.LoadName)]
internal class TypeScriptLoadHandler : LoadHandler
{
[ImportingConstructor]
public TypeScriptLoadHandler()
{
}
}
}
// 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.VisualStudio.LanguageServices.LiveShare.CustomProtocol;
using Microsoft.VisualStudio.LiveShare.LanguageServices;
......@@ -10,20 +11,36 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare
[Obsolete("Used for backwards compatibility with old liveshare clients.")]
internal class RoslynProjectsHandler : ProjectsHandler
{
[ImportingConstructor]
public RoslynProjectsHandler()
{
}
}
[ExportLspRequestHandler(LiveShareConstants.CSharpContractName, RoslynMethods.ProjectsName)]
internal class CSharpProjectsHandler : ProjectsHandler
{
[ImportingConstructor]
public CSharpProjectsHandler()
{
}
}
[ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, RoslynMethods.ProjectsName)]
internal class VisualBasicProjectsHandler : ProjectsHandler
{
[ImportingConstructor]
public VisualBasicProjectsHandler()
{
}
}
[ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, RoslynMethods.ProjectsName)]
internal class TypeScriptProjectsHandler : ProjectsHandler
{
[ImportingConstructor]
public TypeScriptProjectsHandler()
{
}
}
}
......@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
......@@ -27,10 +28,18 @@ protected override async Task AddClassificationsAsync(IClassificationService cla
[ExportLspRequestHandler(LiveShareConstants.CSharpContractName, SyntaxClassificationsMethodName)]
internal class CSharpSyntaxClassificationsHandler : SyntaxClassificationsHandler
{
[ImportingConstructor]
public CSharpSyntaxClassificationsHandler()
{
}
}
[ExportLspRequestHandler(LiveShareConstants.VisualBasicContractName, SyntaxClassificationsMethodName)]
internal class VisualBasicSyntaxClassificationsHandler : SyntaxClassificationsHandler
{
[ImportingConstructor]
public VisualBasicSyntaxClassificationsHandler()
{
}
}
}
......@@ -15,6 +15,11 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests
[PartNotDiscoverable]
internal class MockDocumentNavigationServiceFactory : IWorkspaceServiceFactory
{
[ImportingConstructor]
public MockDocumentNavigationServiceFactory()
{
}
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
{
return new MockDocumentNavigationService();
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Composition
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.VisualStudio.Composition
Imports Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel
......@@ -26,6 +27,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests
<ExportWorkspaceServiceFactory(GetType(IWorkspaceEventListenerService), ServiceLayer.Host), System.Composition.Shared>
Friend Class MockWorkspaceEventListenerProvider
Implements IWorkspaceServiceFactory
<ImportingConstructor>
Public Sub New()
End Sub
Public Function CreateService(workspaceServices As HostWorkspaceServices) As IWorkspaceService Implements IWorkspaceServiceFactory.CreateService
Return Nothing
End Function
......
......@@ -11,6 +11,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.ProjectSystemShim
Public Class VisualBasicProjectExistsUIContextProviderLanguageService
Implements IProjectExistsUIContextProviderLanguageService
<ImportingConstructor>
Public Sub New()
End Sub
Public Function GetUIContext() As UIContext Implements IProjectExistsUIContextProviderLanguageService.GetUIContext
Return UIContext.FromUIContextGuid(Guids.VisualBasicProjectExistsInWorkspaceUIContext)
End Function
......
......@@ -11,6 +11,11 @@ namespace Microsoft.CodeAnalysis.CSharp
[ExportLanguageServiceFactory(typeof(ISyntaxKindsService), LanguageNames.CSharp), Shared]
internal class CSharpSyntaxKindsServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
public CSharpSyntaxKindsServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
=> CSharpSyntaxKindsService.Instance;
}
......
......@@ -23,6 +23,11 @@ internal static class PythiaOptions
[ExportOptionProvider, Shared]
internal class PythiaOptionsProvider : IOptionProvider
{
[ImportingConstructor]
public PythiaOptionsProvider()
{
}
public ImmutableArray<IOption> Options { get; }
= ImmutableArray.Create<IOption>(
PythiaOptions.ShowDebugInfo,
......
......@@ -10,6 +10,11 @@ namespace Microsoft.CodeAnalysis.Remote.Services
[ExportWorkspaceService(typeof(IExperimentationService), ServiceLayer.Host), Shared]
internal sealed class RemoteExperimentationService : IExperimentationService
{
[ImportingConstructor]
public RemoteExperimentationService()
{
}
public bool IsExperimentEnabled(string experimentName)
{
var assetSource = AssetStorage.Default.AssetSource;
......
......@@ -10,12 +10,22 @@ namespace Microsoft.CodeAnalysis.Remote.Storage
[ExportWorkspaceService(typeof(IPersistentStorageLocationService), layer: WorkspaceKind.RemoteWorkspace), Shared]
internal class RemoteWorkspacePersistentStorageLocationService : DefaultPersistentStorageLocationService
{
[ImportingConstructor]
public RemoteWorkspacePersistentStorageLocationService()
{
}
public override bool IsSupported(Workspace workspace) => true;
}
[ExportWorkspaceService(typeof(IPersistentStorageLocationService), layer: WorkspaceKind.RemoteTemporaryWorkspace), Shared]
internal class RemoteTemporaryWorkspacePersistentStorageLocationService : DefaultPersistentStorageLocationService
{
[ImportingConstructor]
public RemoteTemporaryWorkspacePersistentStorageLocationService()
{
}
public override bool IsSupported(Workspace workspace) => true;
}
}
......@@ -11,6 +11,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Class VisualBasicSyntaxKindsServiceFactory
Implements ILanguageServiceFactory
<ImportingConstructor>
Public Sub New()
End Sub
Public Function CreateLanguageService(languageServices As HostLanguageServices) As ILanguageService Implements ILanguageServiceFactory.CreateLanguageService
Return VisualBasicSyntaxKindsService.Instance
End Function
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册