Skip to content
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

Closed
tobias-tengler opened this issue Feb 27, 2022 · 5 comments
Closed

[.NET 7] Investigate StringSyntaxAttribute for GraphQL strings #4800

tobias-tengler opened this issue Feb 27, 2022 · 5 comments
Labels
🌶️ hot chocolate 🔍 investigate Indicates that an issue or pull request needs more information. 📌 pinned
Milestone

Comments

@tobias-tengler
Copy link
Collaborator

tobias-tengler commented Feb 27, 2022

Is your feature request related to a problem?

Some methods in the library accept GraphQL strings, e.g. AddDocumentFromString() or ExecuteAsync(). 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

@tobias-tengler tobias-tengler added 🎉 enhancement 🔍 investigate Indicates that an issue or pull request needs more information. 🌶️ hot chocolate labels Feb 27, 2022
@michaelstaib
Copy link
Member

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:
dotnet/csharplang#4304

Which essentially provides functionality like the javascript template strings.

@michaelstaib michaelstaib added this to the HC-13.0.0 milestone Mar 2, 2022
@stale
Copy link

stale bot commented May 4, 2022

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 stale bot added the ⌛ stale Nothing happened with this issue in quite a while label May 4, 2022
@matt-psaltis matt-psaltis added 📌 pinned and removed ⌛ stale Nothing happened with this issue in quite a while labels May 4, 2022
@github-actions
Copy link

github-actions bot commented Jul 3, 2022

Stale issue message

@github-actions github-actions bot added the ⌛ stale Nothing happened with this issue in quite a while label Jul 3, 2022
@tobias-tengler tobias-tengler removed the ⌛ stale Nothing happened with this issue in quite a while label Jul 3, 2022
@michaelstaib
Copy link
Member

I think I have now added this to a lot of places. I will do another round and then we can close this one.

@gdifilippo-ca
Copy link

gdifilippo-ca commented Oct 27, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌶️ hot chocolate 🔍 investigate Indicates that an issue or pull request needs more information. 📌 pinned
Projects
None yet
Development

No branches or pull requests

4 participants