protected override IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition) { if (definition.Cardinality != ImportCardinality.ExactlyOne) { return Enumerable.Empty<Export>(); } ExportSource exportSource; if (_exactlyOneExports.TryGetValue(definition.ContractName, out exportSource)) { AddMemberType(exportSource, definition); return new[] { exportSource.Export }; } string typeName = ImportDefinitionConstraintAnalyser.GetRequiredTypeIdentity(definition.Constraint); Type type = GetType(typeName); if (!CanHandleType(type)) { return Enumerable.Empty<Export>(); } exportSource = new ExportSource(definition.ContractName, definition.Metadata); exportSource.AddType(type); AddMemberType(exportSource, definition); _exactlyOneExports[definition.ContractName] = exportSource; return new[] { exportSource.Export }; }
protected override IEnumerable <Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition) { if (definition.Cardinality != ImportCardinality.ExactlyOne) { return(Enumerable.Empty <Export>()); } ExportSource exportSource; if (_exactlyOneExports.TryGetValue(definition.ContractName, out exportSource)) { AddMemberType(exportSource, definition); return(new[] { exportSource.Export }); } string typeName = ImportDefinitionConstraintAnalyser.GetRequiredTypeIdentity(definition.Constraint); Type type = GetType(typeName); if (!CanHandleType(type)) { return(Enumerable.Empty <Export>()); } exportSource = new ExportSource(definition.ContractName, definition.Metadata); exportSource.AddType(type); AddMemberType(exportSource, definition); _exactlyOneExports[definition.ContractName] = exportSource; return(new[] { exportSource.Export }); }
public LanguageServiceProviderFactoryWorkspaceServiceFactory(ExportSource exports) { this.languageServices = exports.GetExports<ILanguageService, LanguageServiceMetadata>(); this.languageServiceFactories = exports.GetExports<ILanguageServiceFactory, LanguageServiceMetadata>(); this.unboundServices = new Lazy<ImmutableList<KeyValuePair<LanguageServiceMetadata, Func<ILanguageServiceProvider, ILanguageService>>>>( () => languageServices.Select(ls => new KeyValuePair<LanguageServiceMetadata, Func<ILanguageServiceProvider, ILanguageService>>(ls.Metadata, (lsp) => ls.Value)) .Concat(languageServiceFactories.Select(lsf => new KeyValuePair<LanguageServiceMetadata, Func<ILanguageServiceProvider, ILanguageService>>(lsf.Metadata, (lsp) => lsf.Value.CreateLanguageService(lsp)))).ToImmutableList()); }
public LanguageServiceProviderFactoryWorkspaceServiceFactory(ExportSource exports) { this.languageServices = exports.GetExports <ILanguageService, LanguageServiceMetadata>(); this.languageServiceFactories = exports.GetExports <ILanguageServiceFactory, LanguageServiceMetadata>(); this.unboundServices = new Lazy <ImmutableList <KeyValuePair <LanguageServiceMetadata, Func <ILanguageServiceProvider, ILanguageService> > > >( () => languageServices.Select(ls => new KeyValuePair <LanguageServiceMetadata, Func <ILanguageServiceProvider, ILanguageService> >(ls.Metadata, (lsp) => ls.Value)) .Concat(languageServiceFactories.Select(lsf => new KeyValuePair <LanguageServiceMetadata, Func <ILanguageServiceProvider, ILanguageService> >(lsf.Metadata, (lsp) => lsf.Value.CreateLanguageService(lsp)))).ToImmutableList()); }
public WorkspaceServiceProviderFactory(ExportSource exports) { this.Exports = exports; this.workspaceServiceFactories = exports.GetExports <IWorkspaceServiceFactory, WorkspaceServiceMetadata>(); this.workspaceServices = exports.GetExports <IWorkspaceService, WorkspaceServiceMetadata>(); this.unboundServices = new Lazy <ImmutableList <KeyValuePair <WorkspaceServiceMetadata, Func <IWorkspaceServiceProvider, IWorkspaceService> > > >(() => workspaceServices.Select(ws => new KeyValuePair <WorkspaceServiceMetadata, Func <IWorkspaceServiceProvider, IWorkspaceService> >(ws.Metadata, (wsp) => ws.Value)) .Concat(workspaceServiceFactories.Select(wsf => new KeyValuePair <WorkspaceServiceMetadata, Func <IWorkspaceServiceProvider, IWorkspaceService> >(wsf.Metadata, (wsp) => wsf.Value.CreateService(wsp)))).ToImmutableList()); }
public WorkspaceServiceProviderFactory(ExportSource exports) { this.Exports = exports; this.workspaceServiceFactories = exports.GetExports<IWorkspaceServiceFactory, WorkspaceServiceMetadata>(); this.workspaceServices = exports.GetExports<IWorkspaceService, WorkspaceServiceMetadata>(); this.unboundServices = new Lazy<ImmutableList<KeyValuePair<WorkspaceServiceMetadata, Func<IWorkspaceServiceProvider, IWorkspaceService>>>>(() => workspaceServices.Select(ws => new KeyValuePair<WorkspaceServiceMetadata, Func<IWorkspaceServiceProvider, IWorkspaceService>>(ws.Metadata, (wsp) => ws.Value)) .Concat(workspaceServiceFactories.Select(wsf => new KeyValuePair<WorkspaceServiceMetadata, Func<IWorkspaceServiceProvider, IWorkspaceService>>(wsf.Metadata, (wsp) => wsf.Value.CreateService(wsp)))).ToImmutableList()); }
private static void AddMemberType(ExportSource exportSource, ImportDefinition definition) { try { LazyMemberInfo member = ReflectionModelServices.GetImportingMember(definition); switch (member.MemberType) { case MemberTypes.Property: MemberInfo[] accessors = member.GetAccessors(); MethodInfo setter = accessors.OfType<MethodInfo>().Single(m => m.ReturnType == typeof (void)); Type type = setter.GetParameters()[0].ParameterType; exportSource.AddType(type); return; default: return; } } catch (ArgumentException) { // There is no TryGetImportingMember method, so if definition is of the wrong type, we just swallow exception } }
private static void AddMemberType(ExportSource exportSource, ImportDefinition definition) { try { LazyMemberInfo member = ReflectionModelServices.GetImportingMember(definition); switch (member.MemberType) { case MemberTypes.Property: MemberInfo[] accessors = member.GetAccessors(); MethodInfo setter = accessors.OfType <MethodInfo>().Single(m => m.ReturnType == typeof(void)); Type type = setter.GetParameters()[0].ParameterType; exportSource.AddType(type); return; default: return; } } catch (ArgumentException) { // There is no TryGetImportingMember method, so if definition is of the wrong type, we just swallow exception } }
public ExportedOptionProvider(ExportSource exports) { this.options = exports.GetExports<IOption>(); }
public ExportSettings(ExportSource source, string sourcePath, bool exportPointClouds, bool exportCameraParameters, bool exportMaxScript, bool exportMaxScriptPos, bool exportMaxScriptSpheres) { Source = source; SourcePath = sourcePath; ExportPointClouds = exportPointClouds; ExportCameraParameters = exportCameraParameters; ExportMaxScript = exportMaxScript; ExportMaxScriptPos = exportMaxScriptPos; ExportMaxScriptSpheres = exportMaxScriptSpheres; }
public ExportedOptionProvider(ExportSource exports) { this.options = exports.GetExports <IOption>(); }
internal void SetExports(ExportSource exports) { this.exports = exports; }
internal abstract ExportSource ComposeExports(ExportSource root);
public OptionService(ExportSource exports) : this( exports.GetExports <IOptionProvider>(), exports.GetExports <IOptionSerializer, OptionSerializerMetadata>()) { }
public OptionsServiceFactory(ExportSource exports) { this.exports = exports; }
public CSharpSyntaxFormattingService(ExportSource exports) : this(exports.GetExports <IFormattingRule, OrderableLanguageMetadata>()) { }
public OptionsServiceFactory(ExportSource exports) { this.exports = exports; }
public CSharpSyntaxFormattingService(ExportSource exports) : this(exports.GetExports<IFormattingRule, OrderableLanguageMetadata>()) { }
internal override ExportSource ComposeExports(ExportSource root) { return new ExportList() { // case correction new Lazy<ILanguageService, LanguageServiceMetadata>( () => new Microsoft.CodeAnalysis.CSharp.CaseCorrection.CSharpCaseCorrectionService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.CaseCorrection.ICaseCorrectionService), ServiceLayer.Default)), // code clean up new Lazy<ILanguageServiceFactory, LanguageServiceMetadata>( () => new Microsoft.CodeAnalysis.CSharp.CodeCleanup.CSharpCodeCleanerServiceFactory(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.CodeCleanup.ICodeCleanerService), ServiceLayer.Default)), // code generation new Lazy<ILanguageServiceFactory, LanguageServiceMetadata>( () => new Microsoft.CodeAnalysis.CSharp.CodeGeneration.CSharpCodeGenerationServiceFactory(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.CodeGeneration.ICodeGenerationService), ServiceLayer.Default)), new Lazy<ILanguageService, LanguageServiceMetadata>( () => new Microsoft.CodeAnalysis.CSharp.CodeGeneration.CSharpSyntaxFactory(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.CodeGeneration.ISyntaxFactoryService), ServiceLayer.Default)), // formatting service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingService(root), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.Formatting.IFormattingService), ServiceLayer.Default)), // formatting rules new Lazy<Microsoft.CodeAnalysis.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Formatting.AlignTokensFormattingRule(), new OrderableLanguageMetadata(Microsoft.CodeAnalysis.CSharp.Formatting.AlignTokensFormattingRule.Name, LanguageNames.CSharp)), new Lazy<Microsoft.CodeAnalysis.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Formatting.AnchorIndentationFormattingRule(), new OrderableLanguageMetadata(Microsoft.CodeAnalysis.CSharp.Formatting.AnchorIndentationFormattingRule.Name, LanguageNames.CSharp, after: new string[] { Microsoft.CodeAnalysis.CSharp.Formatting.SuppressFormattingRule.Name })), new Lazy<Microsoft.CodeAnalysis.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Formatting.ElasticTriviaFormattingRule(), new OrderableLanguageMetadata(Microsoft.CodeAnalysis.CSharp.Formatting.ElasticTriviaFormattingRule.Name, LanguageNames.CSharp)), new Lazy<Microsoft.CodeAnalysis.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Formatting.EndOfFileTokenFormattingRule(), new OrderableLanguageMetadata(Microsoft.CodeAnalysis.CSharp.Formatting.EndOfFileTokenFormattingRule.Name, LanguageNames.CSharp, after: new string[] { Microsoft.CodeAnalysis.CSharp.Formatting.ElasticTriviaFormattingRule.Name })), new Lazy<Microsoft.CodeAnalysis.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Formatting.IndentBlockFormattingRule(), new OrderableLanguageMetadata(Microsoft.CodeAnalysis.CSharp.Formatting.IndentBlockFormattingRule.Name, LanguageNames.CSharp, after: new string[] { Microsoft.CodeAnalysis.CSharp.Formatting.StructuredTriviaFormattingRule.Name })), new Lazy<Microsoft.CodeAnalysis.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Formatting.QueryExpressionFormattingRule(), new OrderableLanguageMetadata(Microsoft.CodeAnalysis.CSharp.Formatting.QueryExpressionFormattingRule.Name, LanguageNames.CSharp, after: new string[] { Microsoft.CodeAnalysis.CSharp.Formatting.AnchorIndentationFormattingRule.Name })), new Lazy<Microsoft.CodeAnalysis.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Formatting.StructuredTriviaFormattingRule(), new OrderableLanguageMetadata(Microsoft.CodeAnalysis.CSharp.Formatting.StructuredTriviaFormattingRule.Name, LanguageNames.CSharp, after: new string[] { Microsoft.CodeAnalysis.CSharp.Formatting.EndOfFileTokenFormattingRule.Name })), new Lazy<Microsoft.CodeAnalysis.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Formatting.SuppressFormattingRule(), new OrderableLanguageMetadata(Microsoft.CodeAnalysis.CSharp.Formatting.SuppressFormattingRule.Name, LanguageNames.CSharp, after: new string[] { Microsoft.CodeAnalysis.CSharp.Formatting.IndentBlockFormattingRule.Name })), new Lazy<Microsoft.CodeAnalysis.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Formatting.TokenBasedFormattingRule(), new OrderableLanguageMetadata(Microsoft.CodeAnalysis.CSharp.Formatting.TokenBasedFormattingRule.Name, LanguageNames.CSharp, after: new string[] { Microsoft.CodeAnalysis.CSharp.Formatting.QueryExpressionFormattingRule.Name })), // formatting options new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.MethodDeclarationNameParenthesis), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.MethodDeclarationParenthesisArgumentList), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.MethodDeclarationEmptyArgument), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.MethodCallNameParenthesis), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.MethodCallArgumentList), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.MethodCallEmptyArgument), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OtherAfterControlFlowKeyword), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OtherBetweenParenthesisExpression), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OtherParenthesisTypeCast), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OtherParenControlFlow), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OtherParenAfterCast), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OtherSpacesDeclarationIgnore), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SquareBracesBefore), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SquareBracesEmpty), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SquareBracesAndValue), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.DelimitersAfterColonInTypeDeclaration), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.DelimitersAfterCommaInParameterArgument), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.DelimitersAfterDotMemberAccessQualifiedName), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.DelimitersAfterSemiColonInForStatement), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.DelimitersBeforeColonInTypeDeclaration), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.DelimitersBeforeCommaInParameterArgument), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.DelimitersBeforeDotMemberAccessQualifiedName), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.DelimitersBeforeSemiColonInForStatement), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpacingAroundBinaryOperator), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OpenCloseBracesIndent), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentBlock), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentSwitchSection), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentSwitchCaseSection), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.LabelPositioning), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.LeaveStatementMethodDeclarationSameLine), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForTypes), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForMethods), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForAnonymousMethods), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForControl), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForAnonymousType), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForObjectInitializers), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForLambda), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForElse), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForCatch), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForFinally), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForMembersInObjectInit), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForMembersInAnonymousTypes), new Lazy<Options.IOption>( () => Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForClausesInQuery), // Recommendation service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new CSharpRecommendationService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.Recommendations.IRecommendationService), ServiceLayer.Default)), // Command line arguments service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new CSharpCommandLineArgumentsFactoryService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.LanguageServices.ICommandLineArgumentsFactoryService), ServiceLayer.Default)), // Compilation factory service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new CSharpCompilationFactoryService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.LanguageServices.ICompilationFactoryService), ServiceLayer.Default)), // Project File Loader service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new CSharpProjectFileLoaderService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.Host.ProjectFileLoader.IProjectFileLoaderLanguageService), ServiceLayer.Default)), // Semantic Facts service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new CSharpSemanticFactsService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.LanguageServices.ISemanticFactsService), ServiceLayer.Default)), // Symbol Declaration service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new CSharpSymbolDeclarationService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.LanguageServices.ISymbolDeclarationService), ServiceLayer.Default)), // Syntax Facts service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new CSharpSyntaxFactsService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.LanguageServices.ISyntaxFactsService), ServiceLayer.Default)), // SyntaxTree Factory service new Lazy<ILanguageServiceFactory, LanguageServiceMetadata>( () => new CSharpSyntaxTreeFactoryServiceFactory(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.LanguageServices.ISyntaxTreeFactoryService), ServiceLayer.Default)), // SyntaxVersion service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new CSharpSyntaxVersionService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.LanguageServices.ISyntaxVersionLanguageService), ServiceLayer.Default)), // Type Inference service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new CSharpTypeInferenceService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.LanguageServices.ITypeInferenceService), ServiceLayer.Default)), // Rename conflicts service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Rename.CSharpRenameConflictLanguageService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.Rename.IRenameRewriterLanguageService), ServiceLayer.Default)), // Simplification service new Lazy<ILanguageService, LanguageServiceMetadata>( () => new Microsoft.CodeAnalysis.CSharp.Simplification.CSharpSimplificationService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(Microsoft.CodeAnalysis.Simplification.ISimplificationService), ServiceLayer.Default)) }; }
internal override ExportSource ComposeExports(ExportSource root) { return(new ExportList() { // case correction new Lazy <ILanguageService, LanguageServiceMetadata>( () => new StarkPlatform.Compiler.Stark.CaseCorrection.CSharpCaseCorrectionService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.CaseCorrection.ICaseCorrectionService), ServiceLayer.Default)), // code clean up new Lazy <ILanguageServiceFactory, LanguageServiceMetadata>( () => new StarkPlatform.Compiler.Stark.CodeCleanup.CSharpCodeCleanerServiceFactory(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.CodeCleanup.ICodeCleanerService), ServiceLayer.Default)), // code generation new Lazy <ILanguageServiceFactory, LanguageServiceMetadata>( () => new StarkPlatform.Compiler.Stark.CodeGeneration.CSharpCodeGenerationServiceFactory(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.CodeGeneration.ICodeGenerationService), ServiceLayer.Default)), new Lazy <ILanguageService, LanguageServiceMetadata>( () => new StarkPlatform.Compiler.Stark.CodeGeneration.CSharpSyntaxFactory(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.CodeGeneration.ISyntaxFactoryService), ServiceLayer.Default)), // formatting service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingService(root), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.Formatting.IFormattingService), ServiceLayer.Default)), // formatting rules new Lazy <StarkPlatform.Compiler.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new StarkPlatform.Compiler.Stark.Formatting.AlignTokensFormattingRule(), new OrderableLanguageMetadata(StarkPlatform.Compiler.Stark.Formatting.AlignTokensFormattingRule.Name, LanguageNames.CSharp)), new Lazy <StarkPlatform.Compiler.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new StarkPlatform.Compiler.Stark.Formatting.AnchorIndentationFormattingRule(), new OrderableLanguageMetadata(StarkPlatform.Compiler.Stark.Formatting.AnchorIndentationFormattingRule.Name, LanguageNames.CSharp, after: new string[] { StarkPlatform.Compiler.Stark.Formatting.SuppressFormattingRule.Name })), new Lazy <StarkPlatform.Compiler.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new StarkPlatform.Compiler.Stark.Formatting.ElasticTriviaFormattingRule(), new OrderableLanguageMetadata(StarkPlatform.Compiler.Stark.Formatting.ElasticTriviaFormattingRule.Name, LanguageNames.CSharp)), new Lazy <StarkPlatform.Compiler.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new StarkPlatform.Compiler.Stark.Formatting.EndOfFileTokenFormattingRule(), new OrderableLanguageMetadata(StarkPlatform.Compiler.Stark.Formatting.EndOfFileTokenFormattingRule.Name, LanguageNames.CSharp, after: new string[] { StarkPlatform.Compiler.Stark.Formatting.ElasticTriviaFormattingRule.Name })), new Lazy <StarkPlatform.Compiler.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new StarkPlatform.Compiler.Stark.Formatting.IndentBlockFormattingRule(), new OrderableLanguageMetadata(StarkPlatform.Compiler.Stark.Formatting.IndentBlockFormattingRule.Name, LanguageNames.CSharp, after: new string[] { StarkPlatform.Compiler.Stark.Formatting.StructuredTriviaFormattingRule.Name })), new Lazy <StarkPlatform.Compiler.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new StarkPlatform.Compiler.Stark.Formatting.QueryExpressionFormattingRule(), new OrderableLanguageMetadata(StarkPlatform.Compiler.Stark.Formatting.QueryExpressionFormattingRule.Name, LanguageNames.CSharp, after: new string[] { StarkPlatform.Compiler.Stark.Formatting.AnchorIndentationFormattingRule.Name })), new Lazy <StarkPlatform.Compiler.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new StarkPlatform.Compiler.Stark.Formatting.StructuredTriviaFormattingRule(), new OrderableLanguageMetadata(StarkPlatform.Compiler.Stark.Formatting.StructuredTriviaFormattingRule.Name, LanguageNames.CSharp, after: new string[] { StarkPlatform.Compiler.Stark.Formatting.EndOfFileTokenFormattingRule.Name })), new Lazy <StarkPlatform.Compiler.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new StarkPlatform.Compiler.Stark.Formatting.SuppressFormattingRule(), new OrderableLanguageMetadata(StarkPlatform.Compiler.Stark.Formatting.SuppressFormattingRule.Name, LanguageNames.CSharp, after: new string[] { StarkPlatform.Compiler.Stark.Formatting.IndentBlockFormattingRule.Name })), new Lazy <StarkPlatform.Compiler.Formatting.Rules.IFormattingRule, OrderableLanguageMetadata>( () => new StarkPlatform.Compiler.Stark.Formatting.TokenBasedFormattingRule(), new OrderableLanguageMetadata(StarkPlatform.Compiler.Stark.Formatting.TokenBasedFormattingRule.Name, LanguageNames.CSharp, after: new string[] { StarkPlatform.Compiler.Stark.Formatting.QueryExpressionFormattingRule.Name })), // formatting options new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.MethodDeclarationNameParenthesis), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.MethodDeclarationParenthesisArgumentList), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.MethodDeclarationEmptyArgument), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.MethodCallNameParenthesis), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.MethodCallArgumentList), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.MethodCallEmptyArgument), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OtherAfterControlFlowKeyword), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OtherBetweenParenthesisExpression), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OtherParenthesisTypeCast), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OtherParenControlFlow), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OtherParenAfterCast), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OtherSpacesDeclarationIgnore), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.SquareBracesBefore), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.SquareBracesEmpty), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.SquareBracesAndValue), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.DelimitersAfterColonInTypeDeclaration), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.DelimitersAfterCommaInParameterArgument), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.DelimitersAfterDotMemberAccessQualifiedName), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.DelimitersAfterSemiColonInForStatement), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.DelimitersBeforeColonInTypeDeclaration), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.DelimitersBeforeCommaInParameterArgument), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.DelimitersBeforeDotMemberAccessQualifiedName), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.DelimitersBeforeSemiColonInForStatement), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.SpacingAroundBinaryOperator), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OpenCloseBracesIndent), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.IndentBlock), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.IndentSwitchSection), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.IndentSwitchCaseSection), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.LabelPositioning), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.LeaveStatementMethodDeclarationSameLine), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForTypes), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForMethods), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForAnonymousMethods), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForControl), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForAnonymousType), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForObjectInitializers), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.OpenBracesInNewLineForLambda), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.NewLineForElse), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.NewLineForCatch), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.NewLineForFinally), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.NewLineForMembersInObjectInit), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.NewLineForMembersInAnonymousTypes), new Lazy <Options.IOption>( () => StarkPlatform.Compiler.Stark.Formatting.CSharpFormattingOptions.NewLineForClausesInQuery), // Recommendation service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new CSharpRecommendationService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.Recommendations.IRecommendationService), ServiceLayer.Default)), // Command line arguments service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new CSharpCommandLineArgumentsFactoryService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.LanguageServices.ICommandLineArgumentsFactoryService), ServiceLayer.Default)), // Compilation factory service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new CSharpCompilationFactoryService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.LanguageServices.ICompilationFactoryService), ServiceLayer.Default)), // Project File Loader service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new CSharpProjectFileLoaderService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.Host.ProjectFileLoader.IProjectFileLoaderLanguageService), ServiceLayer.Default)), // Semantic Facts service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new CSharpSemanticFactsService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.LanguageServices.ISemanticFactsService), ServiceLayer.Default)), // Symbol Declaration service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new CSharpSymbolDeclarationService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.LanguageServices.ISymbolDeclarationService), ServiceLayer.Default)), // Syntax Facts service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new CSharpSyntaxFactsService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.LanguageServices.ISyntaxFactsService), ServiceLayer.Default)), // SyntaxTree Factory service new Lazy <ILanguageServiceFactory, LanguageServiceMetadata>( () => new CSharpSyntaxTreeFactoryServiceFactory(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.LanguageServices.ISyntaxTreeFactoryService), ServiceLayer.Default)), // SyntaxVersion service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new CSharpSyntaxVersionService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.LanguageServices.ISyntaxVersionLanguageService), ServiceLayer.Default)), // Type Inference service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new CSharpTypeInferenceService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.LanguageServices.ITypeInferenceService), ServiceLayer.Default)), // Rename conflicts service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new StarkPlatform.Compiler.Stark.Rename.CSharpRenameConflictLanguageService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.Rename.IRenameRewriterLanguageService), ServiceLayer.Default)), // Simplification service new Lazy <ILanguageService, LanguageServiceMetadata>( () => new StarkPlatform.Compiler.Stark.Simplification.CSharpSimplificationService(), new LanguageServiceMetadata(LanguageNames.CSharp, typeof(StarkPlatform.Compiler.Simplification.ISimplificationService), ServiceLayer.Default)) }); }
internal void SetExports(ExportSource exports) { this.exports = exports; }