-
Notifications
You must be signed in to change notification settings - Fork 10.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 StringSyntax formats throughout source code #44535
Comments
Example of this kind of thing done previously in runtime |
I would love to help here. |
I have assigned to you @blouflashdb |
#44555 PR for CompositeFormat more will follow soon. |
@JamesNK I have a question about StringSyntaxAttribute.Uri. There are some places where a RelativeIUri is passed as an parameter. I saw that optinal arguments can be added to StringSyntaxAttribute for example uriKind. How should the StringSyntaxAttribute look like for relative uri? There is also one place in the code where a relative or absolute url can be passed to the methode. For Example WebViewManager.Navigate . How to handle this case? |
Good question. Thanks for thinking about this. I think @stephentoub I see you added Uri throughout dotnet/runtime in dotnet/runtime#67621. Any extra input on these StringSyntaxAttribute usages? |
btw @CyrusNajmabadi just curious what the status of tooling support for these is? Do you expect them to all have an experience like regex has? |
Does StringSyntaxAttribute also works on parameters like this? params string[] urls ? |
I tested it, and yes it does: However, looks like there is a bug in Roslyn where it only applies it to the first string. New Roslyn issue: dotnet/roslyn#64756 |
We can add support if the language provides a suitable parser we can depend on. |
My preference though would be to treat it like asp route strings. Have the bcl team own the integration points, not Roslyn. |
There are no public api parameters where StringFormatAttribute Xml can be added. |
There are some for DateOnlyFormat & DateTimeFormat. Others I haven't checked yet. |
Thanks for contacting us. We're moving this issue to the |
@JamesNK, what are you looking for feedback on here? |
Original question was about arguments to URI strings. We figured it out. |
@blouflashdb is there more to do here, after your last changes? if so any interest in doing the last ones? |
@danmoseley I will look into the remaining things aswell. |
Thanks @blouflashdb |
Hi @danmoseley @JamesNK, I notice this issue hasn't had activity for a while. Do you still need someone to take on the remaining tasks (e.g. GuidFormat)? Thanks. |
It's already assigned but it has been idle for a while. @blouflashdb Do you plan to keep looking at this? |
Sorry, I cant work on it anymore. |
@blouflashdb thanks for the part you did. @abc516 thanks for taking on the rest! |
I wonder if NumericFormat is already done. |
@danmoseley I noticed that the last PR that addressed this issue was closed. |
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
StringSyntaxAttribute is placed on strings to tell tooling what format the string will take. For example, regex, JSON, XML, date format string, etc. This is then used to provide helpful features such as completion of date format strings, regex/JSON/XML highlighting, analyzers, etc.
We should ensure all the ASP.NET Core strings have this attribute where appropriate, so ASP.NET Core APIs get tooling enhancements.
Describe the solution you'd like
Audit dotnet/aspnetcore source and add StringSyntax attribute with format strings as needed:
StringSyntax
for regex parameters #40589This list is from https://github.com/dotnet/runtime/blob/664d7c68d53f2465b79de25fdd6827007216239f/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/StringSyntaxAttribute.cs#L38-L72
I expect many of these won't have any usage - e.g. the format strings (except CompositeFormat) - but we should have Regex, Uri, Json and Xml.
Additional context
No response
The text was updated successfully, but these errors were encountered: