RSyntaxTextArea
RSyntaxTextArea copied to clipboard
Wishlist: A way to figure out the right syntax for a ScriptEngineFactory
ScriptEngineFactory gives us multiple ways to identify a scripting language.
- getEngineName()
- getLanguageName()
- getMimeTypes()
- getNames()
- getExtensions()
Constant strings in RSyntax for MIME types seem to be a perfect fit. But I find that script engines have unexpected things. AppleScript declares "text/plain" as one of its MIME types, making it look like it isn't supported for syntax highlighting. (At the moment it isn't, but that's not the point.) JRuby declares application/x-ruby, but SyntaxConstants declares text/ruby.
I don't know how to match these two up, but there are a few disparate ideas:
- Provide a method to get a syntax for a language name or file extension and hope that ScriptEngineFactory implementations can be trusted to get those right.
- Provide a mapping for multiple MIME types to a single syntax MIME type. Then Ruby would be able to match up at least.