-
-
Notifications
You must be signed in to change notification settings - Fork 748
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
[.NET 7] Investigate StringSyntaxAttribute for GraphQL strings #4800
Comments
Yes, already looked into this with @PascalSenn and @rstaib. We want to use this with HotChocolate but also with StrawberryShake. I think updating the language server should be easy. Actually, looking at this, we were looking at the following Roslyn proposal: Which essentially provides functionality like the javascript template strings. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Stale issue message |
I think I have now added this to a lot of places. I will do another round and then we can close this one. |
Hi, we couldn't find updates on this matter, so we decided to write a Visual Studio extension named GraphQLTools for GraphQL syntax highlighting. This extension highlights strings passed as arguments where the corresponding parameter is decorated with the StringSyntax attribute. Hope this helps. |
Is your feature request related to a problem?
Some methods in the library accept GraphQL strings, e.g.
AddDocumentFromString()
orExecuteAsync()
. Currently there is no syntax highlighting / validation for these strings or any hint to "editors" that these are GraphQL strings.The solution you'd like
I just found out about
StringSyntaxAttribute
which will be shipped with .NET 7 and support is already being rolled out in Visual Studio 2022 previews. It allows to annotate string arguments to hint to the "editor" what kind of string will be passed, so it can add syntax highlight and "editor only" validation of said string, for example for JSON or Regex strings.I thought it would be nice to also annotate our APIs accepting a GraphQL string with the
StringSyntaxAttribute
to hint at this being a GraphQL string.I marked this issue as "investigate", since I think it will be unlikely that Visual Studio adds GraphQL syntax highlighting. But since we already have the extension for StrawberryShake to highlight .graphql files, maybe we can take a similar route to support the
StringSyntaxAttribute
.This is still really early, but I just wanted to note down the idea. I'm sure more resources around this will pop up until the .NET 7 release...
Product
Hot Chocolate
The text was updated successfully, but these errors were encountered: