Eclipse > Javascript > Code highlighting not working with Object Notation

Posted by Redsandro on Stack Overflow See other posts from Stack Overflow or by Redsandro
Published on 2011-05-15T04:11:28Z Indexed on 2012/07/04 21:16 UTC
Read the original article Hit count: 201

Filed under:
|
|
|

I am using Eclipse Helios with PDT, and when I am editing JavaScript files with the default JavaScript Editor (JSDT), code highlighting (Mark Occurrences) is not working for half of the code, for example JSON-style (or Object Literal if you will) declarations.

Little example:

Foo = {};
Foo.Bar = Foo.Bar || {};

Foo.Bar = { 
    bar: function(str) { 
        alert(str) 
    }, 
    baz: function(str) {
        this.bar(str); // This bar *is* highlighted though
    } 
};

Foo.Bar.baz('text');

No Bar, bar or baz is highlighted. For now, I humbly edit the JavaScript part of projects in Notepad++ because it just highlights every occurrence of whatever is currently selected.

Is there a common practice for Eclipse JavaScript developers to get code highlighting work correctly, using the popular Object Literal notation? An option or update I missed?

-update-

I have found that code highlighting depends on the code being properly outlined. Altough commonly used, Object Literal outlining still seems rare in javascript editors. the Spket Javascript Editor does partial Object Literal outlining, and the Aptana Javascript Editor does full Object Literal outlining. But both loses other important functionality. A quest for the editor with the least loss of functionality is currently in progress in this question.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about eclipse