Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Write intermediate file only when not running from the IDE editor
  • Loading branch information
kzu committed Sep 23, 2018
commit 9816b3f7573c02a35405ce7c64fe1ef3f5627dd1
12 changes: 11 additions & 1 deletion src/Stunts/Stunts.CodeAnalysis/StuntGeneratorAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ private void AnalyzeSyntaxNode(SyntaxNodeAnalysisContext context)
}.ToImmutableDictionary(),
name);

// Flag AutoCodeFix that the next build should generate the type.
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("AutoCodeFix")) &&
// We only flag if we're not being run by AutoCodeFix itself
context.Options.GetCodeFixSettings().TryGetValue("IntermediateOutputPath", out var intermediateOutputPath))
{
File.WriteAllText(Path.Combine(intermediateOutputPath, "AutoCodeFixBeforeCompile.flag"), "");
}

context.ReportDiagnostic(diagnostic);
}
else
Expand All @@ -151,7 +159,9 @@ private void AnalyzeSyntaxNode(SyntaxNodeAnalysisContext context)
// Any outdated files should be automatically updated on the next build,
// so signal this to the build targets with a text file that the targets
// can use to determine a pre-compile analysis and codefix phase is needed.
if (context.Options.GetCodeFixSettings().TryGetValue("IntermediateOutputPath", out var intermediateOutputPath))
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("AutoCodeFix")) &&
// We only flag if we're not being run by AutoCodeFix itself
context.Options.GetCodeFixSettings().TryGetValue("IntermediateOutputPath", out var intermediateOutputPath))
{
File.WriteAllText(Path.Combine(intermediateOutputPath, "AutoCodeFixBeforeCompile.flag"), "");
}
Expand Down