|
|
|
Seems reasonable, but do I hate having cryptic things like "jdkre" in my code. I'd prefer a better name for referring to the standard regular expression language.
I'd prefer to be somehow able to create my own annotations, each associated with a different language (presumably, as specified by a regular expression). This association could be done with Java Source code somehow, or by cooperation with some sort of Options settings in the IDE, although I'd prefer to have the IDE just read the Java source of the annotation definitions and be able to configure itself automatically. (This facilitates code sharing between different projects, and use of the annotations with tools other than Idea). I like this approach. Sounds great, for predefined languages, like mysql, jdk regexp, SimpleDateFormat, LispExpression, etc. Perhaps Idea could allow plugins for adding parsers that could add new predefined languages.
I also, however, want to also be able to easily parse my own simple languages, without going to the trouble of writing a plugin. For most purposes, simply specifying a regular expression would be sufficient. (If I need more than that, I can use a plugin). Perhaps something like: @LanguageRegexp("[a-zA-Z_][a-zA-Z0-9_]*") and so forth. (Of course, the coolest of all would be if I could automatically inject bytecode at compile time to test these expressions at runtime, for debugging purposes... not that I really expect this to be implemented, but hey, I can dream, can't I? Another thing that has occurred to me recently is that it would be nice if these annotations would work on variable declarations too. So I could, for instance, write:
public @Regexp String foo; foo = "("; // Warning from Idea: Illegal regular expression '(' assigned to @RegExp-annotated variable. Perhaps it could even provide an optional warning to let me know if I attempt to pass a non-@Regexp variable to a function parameter that is annotated as a @Regexp. Most of this is implemented by the IntelliLang plugin available here: http://plugins.intellij.net/plugin/?id=1105
Wow. Just... wow. That's a far nicer solution than I envisioned when I posted this feature request.
I haven't had a chance to try it yet (I probably won't for a week or two), but from the description, it looks great! Especially the part about instrumenting the compiled classes with runtime assertions, which goes way beyond anything I had expected to be able to do. I'm very, very impressed! Thank you for all your hard work! Are there any plans to make this plugin ship as a default part of Idea? Derek, sorry for the delayed response. Did you have a chance yet to try the plugin? I'm very interested in your opinion and/or further suggestions.
Thanks, PS:
This can only be answered by JetBrains |
|||||||||||||||||||||||||||||||||||||||||||||||||
I think a better solution to @RegExp would be a @Language("jdkre") or something, which could allow language support in the editor for other things like "mysql" "javascript" etc.