-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Apache FreeMarker Language Support #2383
Comments
+1. I am also missing Freemarker support. |
Would be awesome. Subscribing! |
Also reported on the FreeMarker JIRA in case one of their devs wants to add the support: https://issues.apache.org/jira/browse/FREEMARKER-180 |
+1 as well. This would be a great addition. |
I could use Freemarker and Velocity. |
@rawdog71 I would open a new ticket for Velocity if it doesn't exist yet. |
We might need this too, I started taking a look at this. I made a first (not yet complete) draft based on the JavaCC grammar from FreeMarker. That grammar is pretty horrible though. Also, there's no the FreeMarker syntax, there's a couple of different syntaxes with some legacy options thrown into the mix a well (e.g. in Not sure yet, but I'm thinking legacy settings should be ignored, which leaves 2 expression (dollar and bracket) * 3 directive (auto, square bracket, angle bracket) syntaxes... which would result in 6 different language mode variations, hmm... The existing code mirror highlighter I found nicely illustrates some of the complexity: The Eclipse FreeMarker plugin implements auto mode, where you need to parse an arbitrary amount before you can establish the rules for highlighting. Note how the syntax highlighting changes, depending on the order of the lines (which don't have to be the first lines!): And while the Eclipse plugin is definitely much better, even that plugin gets it wrong sometimes: Interpolation syntax is always set and never affects or determines the tag syntax, in auto mode the tag syntax is always determined by the first tag: The above is wrong, if you evaluate that with FreeMarker in auto mode, you'll see that line 9 is evaluated and should thus have received syntax highlighting. Without the interpolation tag, synax highlighting seems to work: There's also another FreeMarker feature that is completely impossible to implement (with monarch): highlighting for string interpolation. E.g.
is valid. The solution here is to just not highlight interpolations in strings (which is what the CodeMirror and Eclipse highlighter are doing) |
I vote to ignore the legacy settings. No point in supporting something considered legacy only the newest FreeMarker syntax. |
Implements #2383 Add syntax modes for FreeMarker template language
Is there some documentation on how I might leverage this in monaco-editor? I'm using react with the new MonacoWebpackPlugin({
languages: ['xml', 'freemarker2'],
}) But it doesn't seem to get picked up |
Thanks. I think it is working. I was just expecting the non-freemarker xml to also syntax highlight. |
Yeah would be great if that were possible, but (a) freemarker can be used for any text content, so we'd have to create a different language mode for each embedded language, and (b) there's no guarantee that the plain text without free marker directives and interpolations is valid in the embedded language, e.g. this is perfectly a legal freemarker document
That looks light a nightmare to write a highlighter for. That's why I decided we should focus on highlighting freemarker syntax. But if anybody has an idea and/or wants to contribute, feel free to. |
Syntax highlighting for Apache Freemarker template language would be excellent.
See: https://freemarker.apache.org/
See: https://freemarker.apache.org/editors.html
See: https://freemarker.apache.org/docs/dgui_template_overallstructure.html
The text was updated successfully, but these errors were encountered: