This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 223207 - Different highlighting for object properties and variables
Summary: Different highlighting for object properties and variables
Status: STARTED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-03 21:05 UTC by robyter
Modified: 2012-12-04 18:28 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description robyter 2012-12-03 21:05:58 UTC
Here is a snipet of code to reproduce it.

function aa () {
    var regular = "", arr = [];
    var bolded = {};   
}

var z = {
    data: x,
    extra: {},
    success: function (data) {
    }
}

For some reason some variables are "bolded" while other are not. I would rather keep them all with the same formating.

Also, something that is more disturbing is the fact that this "bolding" (color changed too) happens inside an object with the property names (in the example above: extra and success).

If this is a feature it is one I definitely dislike and I am certain I am not the only one.
Comment 1 Petr Pisl 2012-12-04 13:27:25 UTC
This is intended.

function aa () {   // function declaration name -> bold
    var regular = "", arr = []; // simple variable - regular font. probably the array should be bold there
    var bolded = {};   // declaration of object -> bold
}

var z = { // global varaible / object -> purple
    data: x, // simple property -> field
    extra: {},  // declaration of object -> bold
    success: function (data) {   // method declaration -> bold
    }
}

We can discuss this approach.
Comment 2 robyter 2012-12-04 18:28:45 UTC
I guess you could mark objects by making them bold but do this in a consistent way. Arrays are objects too and as such they should be bolded as well.

An issue could be that this feature isn't configurable. Even more, the preview box doesn't reflect the reality at all.

In any case, arrays should be considered as objects everywhere and be treated as such.

Here is why I don't like this feature. Variables in JavaScript are only references. Even though you might guess if it is an object or not there are cases where you will not and it won't be consistent.

I am certain a great deal of work went into this and while I can live with it, I guess it would be nice to be able to disable this feature.