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 249436 - Local variables are not offered in code completion
Summary: Local variables are not offered in code completion
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Node.js (show other bugs)
Version: 8.1
Hardware: PC Linux
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2014-12-18 19:02 UTC by Vladimir Riha
Modified: 2015-01-05 07:52 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (33.31 KB, text/plain)
2014-12-18 19:02 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2014-12-18 19:02:08 UTC
Created attachment 151182 [details]
IDE log

Please try following JS file (does not matter if NodeJS is enabled for the project or not)

====FILE START=====
"use strict";
var pes = 1;
var tripCtrl = require("../trip/tripCtrl");
var http = require("../misc/http");

//cc here

exports.registerRoute = function (app) {
  
};


===FILE END=====


and on line with the "//cc here" delete this comment and and invoke code completion
=> any local variable (http or tripCtrl or pes) is not offered. If I have already typed e.g. "tripCtrl.", then cc for properties of tripCtrl are offered correctly but go to declaration does not work for these properties anymore (I'll file it separately)

Thank you



Product Version: NetBeans IDE Dev (Build web-main-1728-on-20141218)
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Linux version 3.13.0-43-generic running on amd64; UTF-8; en_US (nb)
Comment 1 Vladimir Riha 2014-12-18 19:08:17 UTC
It happens as soon as the file contains either "module.exports" or "exports.whatever". If these assignments are missing, it works as well.
Comment 2 Vladimir Riha 2014-12-18 19:09:38 UTC
BTW I forgot to mention it, but it is REALLY fast now :)
Comment 3 Petr Pisl 2014-12-22 09:17:49 UTC
This is regression after the  commit that fixed the code completion performance for nodejs modules.
Comment 4 Petr Pisl 2014-12-22 15:55:45 UTC
The problem is that the code completion context is obtained from token hierarchy, but now the context doesn't correspond with the model :(. Model is wrap up in one anonymous function. It needs to be reflected during finding code completion context as well, resp. the context finder has to count with the model as well.
Comment 5 Petr Pisl 2014-12-22 17:26:07 UTC
Should be fixed in web-main.
Comment 6 Quality Engineering 2014-12-24 04:11:25 UTC
Integrated into 'main-silver', will be available in build *201412240001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f47bbbdb091b
User: Petr Pisl <ppisl@netbeans.org>
Log: #249436 - Local variables are not offered in code completion
Comment 7 Vladimir Riha 2015-01-05 07:52:47 UTC
Thank you, verified

Product Version: NetBeans IDE Dev (Build 201501050001)
Java: 1.7.0_71; Java HotSpot(TM) Client VM 24.71-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_71-b14
System: Linux version 3.13.0-35-generic running on i386; UTF-8; en_US (nb)