PDA

View Full Version : Disable XML syntax checking within a JavaScript block



angeliasi
09-19-2015,
One of my projects uses XML to do UI markup and it includes JavaScript sections. The generic XML syntax highlighter however doesn't recognize these blocks and then highlights "invalid" sections. The HTML one does not, but then of course it highlights all our custom tags.
How can I disable this highlighting? Or even better, is there a way to create a mixed mode highlighting so the JavaScript parts can be JS highlighted?
http://forum.komodoide.com/uploads/default/original/2X/d/dd4657df557134ed12387c28074d4368c883b964.png

Angeloer
09-21-2015,
In response to your first query: your XML is technically not valid, strict XML from the perspective of a strict XML syntax checker (which is what we have). I'm sure the tool you use to process such XML is more lax, but to Komodo your XML is not valid XML. You can disable the syntax checking via Edit > Preferences > Syntax & Spell Checking.
As for your second query: you'd have to create a custom syntax highlighter that mixes XML and JavaScript. You can find some material on creating one here: http://docs.komodoide.com/SDK/udl
As for your C# issue, you can remove the highlighting by changing the "Edit > Preferences > Color Scheme > Editor > stringeol" background color to match your default background color.

ANicoleor
09-23-2015,
Note you could mark your language as XBL (Xul Binding), which is XML with JavaScript syntax support. I'm not certain that would work but it's worth a try.
Additionally you could wrap your JS code in <!-- CODE --> tags, although unless you are using XBL that would disable syntax highlighting on your JS code.
The only other option would be to write your own language addon, which you could base off of XBL:
https://github.com/Komodo/KomodoIDE/tree/10.0.1/src/udl/skel/XBL

AnitGaf
09-24-2015,
I know my document isn't technically XML, it's a derived format (like HTML it allows unescaped code blocks).
I've just disabled the syntax checking for now. Even if I could fix the JavaScript bit the marking of unclosed tags becomes annoying. As I type an new open tag <SomeTag> it starts hightlghting errors until I close it, and then it still takes a while before it removes the markings. So I'll just keep the syntax checking off entirely.