-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Support #if SNIPPET in snippets #20391
Support #if SNIPPET in snippets #20391
Conversation
If we decide to do this I'll update all existing snippets and remove the commend syntax. |
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.
Nice!
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 like this. It should also help the occasional reformatting problems where VS wants to put /*@@*/
on it's own line and, if not caught, screws up the testable sample/snippet. At some point recently, too, VS seems to have stopped graying out ifdef'd out code and still provides IntelliSense, which helps writing syntactically correct snippet-only code.
Fixes: #8539 |
Maybe not, there are a LOT of them. I might ask service owners to clean up their samples. |
Feel free to create issues per library and we can track the progress in the Eng Excellence epic. |
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.
This is great. A couple of questions:
- Will refactoring work in the
#if SNIPPET
branch? - Should we file a work item to schedule a weekly build with
-d SNIPPET
to make sure all the code that doesn't run still compiles?
No, unfortunately, Roslyn treats the text in disabled branches as absent from the syntax/semantic tree.
Will do. |
It's closer to C# syntax, can be used to verify that snippets still build after replacement and I can type it without having to consult the doc.