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 262490 - ES6 editor should support variables declared directly in class
Summary: ES6 editor should support variables declared directly in class
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Linux
: P2 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks: 242387
  Show dependency tree
 
Reported: 2016-06-20 18:45 UTC by Jenselme
Modified: 2016-06-29 20:47 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Wrong colors when varialbe directly in class (7.49 KB, image/png)
2016-06-20 18:45 UTC, Jenselme
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jenselme 2016-06-20 18:45:42 UTC
Created attachment 160100 [details]
Wrong colors when varialbe directly in class

When two variables or more are declared directly in the class (and not in a function), syntax highlighting doesn't work as expected (see attached screenshot).

I don't know if it is part of the standard or not, but some code is written that way (for instance in the Aurelia framework: https://github.com/aurelia/framework/blob/master/src/framework-configuration.js#L117). Furthermore, the babel transpiller handles this code fine and VSCode doesn't report it as an error.

Expected result: the code is parsed, function names are highlighted correctly and no error is reported.

Sample code:

export class Test {
    name = 'test';
    test;

    constructor() {
        
    }
}

So, this code works fine:

export class Test {
    name = 'test';
    test;

    constructor() {
        
    }
}
Comment 1 Petr Pisl 2016-06-21 13:25:30 UTC
This is not standard ES6. Marking as enhancement.
Comment 2 Petr Hejl 2016-06-21 13:38:11 UTC
This is ES7 feature.
https://github.com/jeffmo/es-class-fields-and-static-properties
Comment 3 Petr Hejl 2016-06-29 13:33:51 UTC
Fixed in trunk.
Comment 4 Jenselme 2016-06-29 20:47:45 UTC
This works perfectly. Thanks. +1 for support of experimental ES7.