Skip to content

Commit

Permalink
Files generated by source generator have relative path (fix #876)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt committed Jan 23, 2022
1 parent 8c633e9 commit cec55ab
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System;
using System.Collections.Immutable;
using System.IO;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;

Expand Down Expand Up @@ -50,6 +51,10 @@ public override void Initialize(AnalysisContext context)
compilationContext.RegisterSyntaxTreeAction(context =>
{
// files generated by source generator have relative path
if (!Path.IsPathRooted(context.Tree.FilePath))
return;
if (!CommonDiagnosticRules.AnalyzerOptionIsObsolete.IsEffective(context.Tree, compilationOptions, context.CancellationToken))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System;
using System.Collections.Immutable;
using System.IO;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;

Expand Down Expand Up @@ -50,6 +51,10 @@ public override void Initialize(AnalysisContext context)
compilationContext.RegisterSyntaxTreeAction(context =>
{
// files generated by source generator have relative path
if (!Path.IsPathRooted(context.Tree.FilePath))
return;
if (!CommonDiagnosticRules.RequiredConfigOptionNotSet.IsEffective(context.Tree, compilationOptions, context.CancellationToken))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System;
using System.Collections.Immutable;
using System.IO;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;

Expand Down Expand Up @@ -46,6 +47,10 @@ public override void Initialize(AnalysisContext context)
compilationContext.RegisterSyntaxTreeAction(context =>
{
// files generated by source generator have relative path
if (!Path.IsPathRooted(context.Tree.FilePath))
return;
if (!CommonDiagnosticRules.AnalyzerOptionIsObsolete.IsEffective(context.Tree, compilationOptions, context.CancellationToken))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System;
using System.Collections.Immutable;
using System.IO;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;

Expand Down Expand Up @@ -46,6 +47,10 @@ public override void Initialize(AnalysisContext context)
compilationContext.RegisterSyntaxTreeAction(context =>
{
// files generated by source generator have relative path
if (!Path.IsPathRooted(context.Tree.FilePath))
return;
if (!CommonDiagnosticRules.RequiredConfigOptionNotSet.IsEffective(context.Tree, compilationOptions, context.CancellationToken))
return;
Expand Down

0 comments on commit cec55ab

Please sign in to comment.