Sublime Forum

XML syntax highlighting in JavaScript in the new build

#1

Hi,

I write JS for rhino and have XML natively within my JS files (I navigate the tree with E4X).

Since upgrading to Build 3103 I have noticed that ST is not correctly highlighting the syntax for this embedded XML.

Can someone please suggest a fix or provide instructions on how to roll back to Build 3083?

Many thanks
Tom

2 Likes

#2

A quick rollback is to revert,
Uninstall it
then https://www.sublimetext.com/docs/3/revert.html
then install the previous version sublimetext.com/3dev

The other issue will require more dedication to see what changed. (if you use windows you can try in a portable version)

0 Likes

#3

looking at the syntax scopes for JavaScript, there is definitely something wrong here.

A colon at the end of a case statement is showing up with the scope of “keyword.operator.ternary.js”
Object property key:value seems to have a load of issues with value scopes being all over the place.

variable and function scopes seem to be confused in places

0 Likes

#4

Thanks guys, will run the revert method.

0 Likes

#5

Can you provide an example of your code and where the issue occurs?

0 Likes

#6

Sorry it’s so horribly redacted, this is for work stuff.

var test_xml = <node> <node> <node subsystem="redacted" method="redacted"> <node> <node> <node> <node> <node> <node type="redacted">value</node> <node type="redacted">value</node> <node type="redacted">value</node> <node type="redacted">{varaible2..test.toString()}</node> <node type="redacted">{variable_name}</node> <node> <node> <node>{varaible2..test.toString()}</node> <node>{variable_name}</node> </node> </node> </node> </node> </node> </node> </node> </node> </node> </node>;

0 Likes

#7

Hmm, that seems to be JSX syntax, no?

0 Likes

#8

If you can provide some samples of these at https://github.com/sublimehq/Packages/issues, we can add some tests and get the syntax definitions fixed up.

0 Likes

#9

It’s e4x: https://developer.mozilla.org/en-US/docs/Archive/Web/E4X/Processing_XML_with_E4X

I realise it’s now obselete, but I work with legacy systems that use JS on the server side with Rhino JS Engine.

0 Likes

#10

Roger, will get some online this eve.

Thank for the fast replay.

Oli

0 Likes

#11

My guess is that it was just a historical accident that it happened to look alright. Perhaps try https://packagecontrol.io/packages/Babel and see if that does an ok job?

0 Likes

#12

Babel works great, thanks.

0 Likes