Skip to content
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

Merged

Conversation

agocke
Copy link
Member

@agocke agocke commented Oct 4, 2019

Provides API to fix #3705.

@agocke agocke force-pushed the syntaxtree-generated branch from 2de9411 to f4cb52d Compare November 1, 2019 00:02
@agocke agocke closed this Nov 4, 2019
@agocke agocke reopened this Nov 4, 2019
@mavasani
Copy link
Contributor

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.

@agocke agocke force-pushed the syntaxtree-generated branch from f4cb52d to a75be1c Compare November 14, 2019 01:04
@agocke agocke marked this pull request as ready for review November 14, 2019 18:19
@agocke agocke requested a review from a team as a code owner November 14, 2019 18:19
x = null; // warning 3
F = null; // warning 4
}
}", isGeneratedCode: null /* use heuristic */);
Copy link
Member

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.

Copy link
Member

@333fred 333fred left a 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.

@agocke agocke added this to the 16.5 milestone Nov 14, 2019
@agocke agocke requested a review from gafter November 14, 2019 22:06
@@ -319,6 +320,13 @@ private void BuildPreprocessorStateChangeMap()
((CompilationUnitSyntax)root).GetConditionalDirectivesStack() :
InternalSyntax.DirectiveStack.Empty;

bool isGenerated = isGeneratedCode.HasValue
Copy link
Member

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...

Copy link
Member

@gafter gafter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@agocke agocke merged commit 4dce8d6 into dotnet:features/editorconfig-generated-code Nov 19, 2019
@agocke agocke deleted the syntaxtree-generated branch November 19, 2019 23:49
@@ -76,6 +82,35 @@ private static bool IsGeneratedCodeFile(string filePath)
return false;
}

private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
Copy link
Contributor

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.

mavasani added a commit to mavasani/roslyn that referenced this pull request Dec 12, 2019
…tax tree parse APIs in command line compiler and IDE syntax tree factory service.

Builds on top of dotnet#39051
Addresses dotnet#3705
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants