Add tring syntax attribute like C#

eg: add string syntax attribute to parse methods · json-everything/json-everything@6ef2101 · GitHub

Then the IDE and the compiler can check the string syntax

public static JsonPath Parse([StringSyntax("jsonpath")] string source, PathParsingOptions? options = null)
{
	options ??= new PathParsingOptions();

	if (options.TolerateExtraWhitespace)
		source = source.Trim();

	int index = 0;
	return PathParser.Parse(source.AsSpan(), ref index, options, !options.AllowRelativePathStart);
}

so this is a directive for “language injection” e.g. for syntax highlighting in the IDE?

You can do that with macro interpolator today if I understand you correctly.

1 Like

Some IDEs already use annotations for this, like org.intellij.lang.annotations.Language, which seems quite natural:

Yes IDE will do checking for it too.