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 255872 - Code completion doesn't work for Node.js 4.x version
Summary: Code completion doesn't work for Node.js 4.x version
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Node.js (show other bugs)
Version: 8.1
Hardware: All All
: P1 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords: 81_HR_FIX, RELNOTE
Depends on:
Blocks:
 
Reported: 2015-10-12 12:10 UTC by Petr Pisl
Modified: 2016-06-06 22:34 UTC (History)
4 users (show)

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 Petr Pisl 2015-10-12 12:10:29 UTC
The code completion of node.js framework is based on the downloaded sources, that  are parsed and then used for editor features. Unfortunately the sources of Node.js 4.x.y are written in EcmaScript 6. We are not able to parse these sources yet and this is the problem.

As a result of this, we are not able to offer code completion for most of modules, which are already written in ECMA Script 6. fs module is one of them.
Comment 1 Petr Pisl 2015-10-12 12:20:29 UTC
One of the "temporary" solution would be to work internally with Node.js version 0.12.7 . It means download sources of Node.js 0.12.7, when user uses version 4.0 or newer. Put the sources 0.12.7 version on the project classpath. 

This has some consequences, like:

- if user will navigate to the module file like fs.js, then it will not be opened his defined version (4.x.y), but sources from the version 0.12.7.
- the code completion doesn't have to be exactly the same like for the version 4.x.y, because the methods of modules will be taken from version 0.12.7
- the previous point has to be applied to the documentation as well. 

The positive things is that this "hack" should be simple to implement and could be in the trunk and branch relase81 today. 

IMHO also this workaround should be mentioned in the release notes.
Comment 2 Tomas Mysik 2015-10-12 12:44:22 UTC
Should be "fixed" now. Simply pretend that all versions not-starting-by-zero (0.x) are the latest 0.12 version (0.12.7 at the moment). It means that everywhere in the IDE one can see only 0.12.7 as a version instead of 4.x or newer. This applies only for node.js and not for io.js.

Petr promised to do the backport to the releases repo, branch release81, once the fix is verified. Thanks a lot Petře!

http://hg.netbeans.org/web-main/rev/ffcccc73d724
Comment 3 Jiri Kovalsky 2015-10-12 12:58:38 UTC
Lado, could you please verify this as soon as new build from web-main repository [1] is built? Thanks!

[1] http://deadlock.netbeans.org/job/web-main/
Comment 4 Vladimir Riha 2015-10-12 13:14:59 UTC
I've tried on trunk build with jar from Tomas and it seems to work fine (tested with NodeJS 0.12.6 and 4.1.1). It downloads docs for 0.12.6/0.12.7 without any ES6 code.

Maybe there could be some explanation message in Tools->Options->HTML/JS->NodeJS when it won't use sources for major versions so that users will know why it shows 0.12.7 while their NodeJS is 4.1.1. 


Product Version: NetBeans IDE Dev (Build 201510120002)
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b14
System: Linux version 3.16.0-30-generic running on amd64; UTF-8; en_US (nb)
Comment 5 Petr Pisl 2015-10-12 13:37:23 UTC
Small fix for documentation to get it work properly: http://hg.netbeans.org/web-main/rev/15c28a2c26ea
Comment 6 Tomas Mysik 2015-10-12 13:44:48 UTC
(In reply to Vladimir Riha from comment #4)
> Maybe there could be some explanation message in
> Tools->Options->HTML/JS->NodeJS when it won't use sources for major versions
> so that users will know why it shows 0.12.7 while their NodeJS is 4.1.1. 

Information will be in Release Notes. I have also created issue #255878, marked as a patch candidate. Feel free to add your comment there.

Petře, will you do the backport, please?

Thanks.
Comment 7 Petr Pisl 2015-10-12 14:08:27 UTC
Yes, I'm going to do it.
Comment 8 Vladimir Riha 2015-10-12 14:17:50 UTC
Thanks, I've tried the 2nd fix as well and JSDoc is displayed for both 0.12.6 and 4.1.1
Comment 9 Petr Pisl 2015-10-12 14:22:36 UTC
So both fixes are transplanted in the releases repo:
http://hg.netbeans.org/releases/rev/db49e2c0edde
http://hg.netbeans.org/releases/rev/c2902e471e59

Should be mentioned in the release notes -> adding the keyword
Comment 10 Quality Engineering 2015-10-13 01:33:08 UTC
Integrated into 'main-silver', will be available in build *201510130002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/ffcccc73d724
User: Tomas Mysik <tmysik@netbeans.org>
Log: #255872 - Code completion doesn't work for Node.js 4.x version

Just a hotfix/workaround: simply pretend that all versions 4.x or newer are
the latest 0.12 version (0.12.7 at the moment). This applies only for node.js
and not for io.js.
Comment 11 Vladimir Riha 2015-10-13 14:19:24 UTC
Thank you, verified in RC2 with NodeJS 0.12.6 and 4.1.1

Product Version: NetBeans IDE 8.1 RC2 (Build 201510122201)
Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27
System: Linux version 3.16.0-30-generic running on amd64; UTF-8; en_US (nb)
Comment 12 eggmatters 2016-06-06 22:34:05 UTC
Altering node sources of node-v0.12.14-linux-x64 and then node-v4.1.1-linux-x64 did not allow code completion for node projects.