-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
update SnippetGenerator to add language hint #22090
Conversation
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.
General and code-owned files LGTM. Curious, though: is this a convention for Microsoft Docs? According to https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/code the language
attribute isn't defined. Based on https://docs.microsoft.com/en-us/contribute/code-in-docs it seems that might be the case since there is similar syntax for including snippets from other files, but I wanted to double check.
Assert.AreEqual(expected, reProcessed); | ||
} | ||
|
||
private string SnippetProvider(string s) => Processed; | ||
private ValueTask<string> SnippetProvider(string s) => new(Processed); |
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.
Nit: should use Async
suffix.
Should we start erroring out for unused snippets? It would prevent us from accidentally breaking the generator and people from using the wrong snippet (like I did very recently). |
What should we do with the unused snippets? Ran locally with the changes and got this:
|
Delete them or comment out the #region part. They are still in source control, we just need to make sure the team is aware |
c8f6203
to
4d0f518
Compare
This change adds the
language="csharp"
property to the<code>
xml tag and also makes it possible to error on unused snippets.For unused snippet validation, there is a new switch added to
Update-Snippets.ps1
called-StrictMode
. Usage is as follows:The default behavior is to print the names of unused snippets, but not to thow:
With the StrictMode switch, it looks like this:
created the following issues to track remediation of unused snippets https://github.com/Azure/azure-sdk-for-net/search?q=Remove+unused+snippets&type=issues