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 226140 - Go to declaration does not work beyond a single file
Summary: Go to declaration does not work beyond a single file
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-15 00:12 UTC by c69
Modified: 2013-02-25 09:41 UTC (History)
1 user (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 c69 2013-02-15 00:12:50 UTC
Just installed fresh dev build 201302132300.

Neither "Go to declaration..", nor middle-click, nor CC work for my project (defined as php, made in NB7.2 or earlier).
This is a regression compared to early january build (and 99% other ones), because when i open a project there - everything is ok.  

Also, i see "the global variable XXX is not defined" for all variables defined in other files. 

observation: Upon start, "background scanning of project..." is very quick (just a couple of seconds), compared to 201301040001 version.

Local variables work perfectly.

Possible duplicate:
http://netbeans.org/bugzilla/show_bug.cgi?id=215820
Comment 1 Vladimir Riha 2013-02-15 07:59:06 UTC
Could you please try it with Release Candidate 2 (link on main page)?

I tried 7.3 FCS and for me:
 - CC works, there are some cases when type is not resolved (issue 225705) but in most of cases it seems to be OK (I'm also using JSDoc with specified types)
 - Go To declaration - please see issue 226152. For global objects across several files, I found this:

fileA.js:
function Test(){
    this.bar = 1;
}

fileB.js:
function run(){
 a = new Test(); // cc and GoTo declaration works
}

fileC.js:
a.bar = 2; // cc works, but GoTo declaration for bar not, but for "a" it does



Product Version: NetBeans IDE 7.3 (Build 201302132200)
Java: 1.7.0_15; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b02
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)
Comment 2 Vladimir Riha 2013-02-15 08:01:32 UTC
The same happens in 

Product Version: NetBeans IDE Dev (Build 201302132300)
Comment 3 Petr Pisl 2013-02-15 09:48:29 UTC
The navigation doesn't work through the files, because there was not time to reimplement this feature. I will try to finish this soon, but probably will be a part of patch for NB 7.3.

This is not reimplemented yet. There wasn't time to finish this feature. I will add it soon. Probably into the patch.

The hint "The global variable XXX is not defined" you can switch off in Tools options. It's a message that you can get also from js lint for example. According the JS style you should use construction like this:

var xxx = xxx || {}

or similar, to be sure that the variable is really defined.

Downgrading to P3 and keep it only as reminder to add the navigation through more files.Thanks
Comment 4 c69 2013-02-17 02:30:22 UTC
Big thanks for clarification, Petr.

My home project (10 KLOS, ~40 classes) has 3 levels of nesting:
 VENDOR.module.method

My work project (50 KLOS, ~250 classes) has 5-6 levels on average:
 package.long.boring.path.to.Module

So, as you can guess, the lack of "Go to declaration..." and CC, is an absolute showstopper for me.

Thus, delaying upgrade until the patch comes. Hopefully, it would not take much longer.




____
sidenote: regarding the "global variable not defined" - its a nice feature by intention, but there seems to be simply too much cases, where it will trigger false positive. But as it is configurable - its fine.
Comment 5 Petr Pisl 2013-02-18 13:03:49 UTC
I committed a fix for the go to declaration at last Friday. Could you please try a latest build from http://bits.netbeans.org/download/trunk/nightly/latest/ ? Let me know whether it works for you or something missing. Thanks.
Comment 6 Petr Pisl 2013-02-18 13:08:02 UTC
The mentioned commit was originally fro issue #226152 .
Comment 7 c69 2013-02-23 16:13:54 UTC
Petr, thanks.
In 7.3 this bug does not reproduce*.

Actually it does, for a few seconds while background scanning is going on, but once it completes - middle click, cc, jsdoc, and go to declaration all start to work.

Thanks once again!
Comment 8 Petr Pisl 2013-02-25 09:41:08 UTC
Yes, the information where is the element defined is stored in the index and these information are obtained during background scanning. This is why the functionality doesn't work correctly during scanning. 
Thanks