Exemplo n.º 1
0
        public static async Task <Solution> ApplyCodeFix(Document document, TextSpan diagnosticSpan, CancellationToken ct)
        {
            var root = await document.GetSyntaxRootAsync(ct).ConfigureAwait(false);

            var declaration = root.FindToken(diagnosticSpan.Start)
                              .Parent
                              .AncestorsAndSelf()
                              .OfType <TypeDeclarationSyntax>()
                              .First();

            if (!(declaration is ClassDeclarationSyntax ids))
            {
                return(document.Project.Solution);
            }

            var syntax = await PassiveDeclarationSyntax.FromParseAsync(ids, document, ct);

            var semantics = SemanticsRoot.FromSyntax(syntax);
            var template  = new PassiveProcessTemplate(semantics);

            return(ApplyGeneratedCode(document, template));
        }
 public FinalPropertyTemplate(SemanticsRoot root)
 {
     Root = root;
 }
Exemplo n.º 3
0
 public PassiveProcessHookHandlerTemplate(SemanticsRoot root)
 {
     Root = root;
 }
Exemplo n.º 4
0
 public DomainContextTemplate(SemanticsRoot root)
 {
     Root = root;
 }
Exemplo n.º 5
0
 public PassiveProcessTemplate(SemanticsRoot root)
 {
     Root = root;
 }