-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add API for marking a syntax tree as generated #39051
Add API for marking a syntax tree as generated #39051
Conversation
2de9411
to
f4cb52d
Compare
Tagging @jinujoseph @vatsalyaagrawal @jaredpar Is this PR still targeted for 16.5? If not, can we please merge the branch https://github.com/dotnet/roslyn/tree/features/editorconfig-generated-code back into master for 16.5, so the core feature requests in #3705 are unblocked (more context here)? I understand compiler team's desire to ship both analyzer and compiler features in same release, but given there isn't a consensus on this API change in the compiler team, it does not seem reasonable to block a highly requested analyzer feature on this PR. |
Provides API to fix dotnet#3705.
f4cb52d
to
a75be1c
Compare
x = null; // warning 3 | ||
F = null; // warning 4 | ||
} | ||
}", isGeneratedCode: null /* use heuristic */); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* use heuristic */ [](start = 26, length = 19)
I'm not really sure what this comment is supposed to indicate. Consider expanding or removing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 1). Consider removing the test comment.
@@ -319,6 +320,13 @@ private void BuildPreprocessorStateChangeMap() | |||
((CompilationUnitSyntax)root).GetConditionalDirectivesStack() : | |||
InternalSyntax.DirectiveStack.Empty; | |||
|
|||
bool isGenerated = isGeneratedCode.HasValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isGeneratedCode [](start = 31, length = 15)
bool isGenerated = isGeneratedCode ?? GeneratedCodeUtilities...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -76,6 +82,35 @@ private static bool IsGeneratedCodeFile(string filePath) | |||
return false; | |||
} | |||
|
|||
private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delayed comment, but seems like you can share majority of code between this method and the overload below which takes SyntaxTree
argument.
…tax tree parse APIs in command line compiler and IDE syntax tree factory service. Builds on top of dotnet#39051 Addresses dotnet#3705
Provides API to fix #3705.