public override void VisitTaskDeclarationSymbol(ITaskDeclarationSymbol taskDeclarationSymbol) { // Haben wir bereits in Form der Taskdefinition abgefrühstückt // => Jede Taskdefinition ist auch eine Deklaration if(taskDeclarationSymbol.Origin == TaskDeclarationOrigin.TaskDefinition) { return; } NavigationItems.Add(new NavigationItem( displayName : taskDeclarationSymbol.Name, imageIndex : NavigationBarImages.Index.TaskDeclaration, location : taskDeclarationSymbol.Syntax?.GetLocation(), navigationPoint: taskDeclarationSymbol.Location.Start)); }
public TaskDeclarationCodeModel(ITaskDeclarationSymbol taskDeclarationSymbol) { if (taskDeclarationSymbol == null) { throw new ArgumentNullException(nameof(taskDeclarationSymbol)); } if (taskDeclarationSymbol.IsIncluded) { throw new ArgumentException("Only embedded task declarations supported"); } Taskname = taskDeclarationSymbol.Name ?? String.Empty; if (taskDeclarationSymbol.Origin == TaskDeclarationOrigin.TaskDeclaration) { var syntax = taskDeclarationSymbol.Syntax as TaskDeclarationSyntax; NamespacePräfix = syntax?.CodeNamespaceDeclaration?.Namespace?.Text ?? String.Empty; } else { var syntax = taskDeclarationSymbol.Syntax as TaskDefinitionSyntax; NamespacePräfix = (syntax?.SyntaxTree.GetRoot() as CodeGenerationUnitSyntax)?.CodeNamespace?.Namespace?.ToString()?? String.Empty; } }