Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 SnippetGenerator #7928
Add SnippetGenerator #7928
Changes from all commits
1d9327a
99fe217
c64cc2b
7ad6a9f
8764e1b
d963a10
7a92344
4f4ecb5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Have we considered potentially keeping snippets in their own files, so that each can be a small and contained test. I'm not a fan of
regions
, personally, and worry about polluting the sample code with them will make things less clear to the casual reader.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.
Would you want to inject the entire file with headers and everything?
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.
I was thinking more of keeping the region-based approach, but segmenting it from the samples proper. In some form that can be run and validated as part of the nightly process, but maybe a set of tests in its own folder or something similar.
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.
I'm open to improvements but wanted to start with something simple
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.
I'm not sure that mine is the best suggestion either. One of the goals that we had discussed was helping developers understand the copy/paste worthy areas of the samples, which the regions do - if (and only if) you understand the convention.
Too bad that we can't create our own alias for
region
and use something like: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.
I know that @danieljurek is planning to start digging into samples and help define a convention so that they can essentially be standalone examples and can be ran during our smoke testing. Personally also avoid using regions but instead just use the entire method body. We can easily attribute the method with the name for the sample so that we can align them with the readmes.
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.
Also by attribute we don't actually have to depend on a .NET Attribute type but we can simply add a structured comment on the method and look for that as well.
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.
I think using the full method would definitely favor not using the full samples, lest our
ReadMe
files become a novel. It could work in something isolated with a very intentional scoping to snippet use.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.
DocFX uses regions that's why I went with them, it would be easy to reuse code when writing doc articles.