-
Notifications
You must be signed in to change notification settings - Fork 4k
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 register method for analyzing embedded languages #63533
Comments
This is really up to compiler/analyzer to decide if htey want to do something here. I think it would be nice for there to be an official compiler API for understanding the contents of strings. However, it's not something i'm really interested in championing as my main use case is the IDE, and we have a story there. The desire to bring this stuff to things like the command-line experience is decidedly outside of that for me :) @jaredpar for thoughts. |
How does the embedded language detection work today? Essentially how do we map a given string literal and say "ah this is for embedded language X"? Or do we just throw every string at every embedded language analyzer and let them sort it out? |
We use the |
Does that attribute get placed on the API parameter? So basically developer defines public void Method([StringsSyntaxAttribute("awesome-lang")] p) Then calls like |
@jaredpar Correct :) Also things like |
@jaredpar Assigned to you for triage. |
Background and Motivation
There should be support for analyzing an embedded language with
DiagnosticAnalyzer
. For example, analyzers that inspect:There are some analyzers for regex strings and JSON strings today that implement their own solution. They are currently editor only analyzers, and don't run during command line build (I'm not sure if that was intentional or a technical limitation)
ASP.NET Core route strings has its own solution that uses a lot of copy and paste (StringFormatAttribute detection and VirtualChar).
Providing a built-in, official solution would make it must easier for future embedded language analyzers to be written and to improve existing analyzers.
Proposed API
Usage Examples
Alternative Designs
Risks
The text was updated successfully, but these errors were encountered: