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 249338 - javascript Autocomplete does not work on a library
Summary: javascript Autocomplete does not work on a library
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.2
Hardware: All All
: P3 normal with 2 votes (vote)
Assignee: Petr Pisl
Depends on:
Reported: 2014-12-13 10:30 UTC by elennaro
Modified: 2014-12-17 09:55 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:

Full source of project (1.95 MB, application/zip)
2014-12-13 10:30 UTC, elennaro

Note You need to log in before you can comment on or make changes to this bug.
Description elennaro 2014-12-13 10:30:18 UTC
Created attachment 151090 [details]
Full source of project

Steps to reproduce:

1) Create new Cordova App or Html5 App (choose no Site Template or choose any template you like it does not matter)
2) In project Properties - Javascript Files add any (phaser in my case) to js/libs
3) In index.html write
<!DOCTYPE html>
    <title>TODO supply a title</title>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
		<script src="js/libs/phaser/phaser.js" type="text/javascript"></script>
		<script type="text/javascript">
			//Try Autocomplete here
			var game = new Ph//Nothing at all here
		<div>TODO write content</div>
(you can either try to reopen project or IDE, wait for background scan but nothing helps)

Full project is attached
Comment 1 Vladimir Riha 2014-12-15 08:27:46 UTC
Thank you for the project. The problem is that the JS file phaser.js has 2.7 MB and afaik editor does not parse files larger then 1MB due to performance.
Comment 2 elennaro 2014-12-15 10:22:33 UTC
Thank you for the information, Vladimir.
Maybe it is an easy workaround? Like setting in netbeans.conf, or something I could do to make this work?
I do really appreciate any help.
Comment 3 Petr Pisl 2014-12-15 15:18:12 UTC
There are three options how you can influence the parsing of big files. 

nb.js.parse.big.files  - if you use this option, then the big files will be always parsed, the default value is false. 

nb.js.big.file.size - the size of js file, when the file is not parsed. The default value is 1048576  (1024x1024)

nb.js.big.minimize.file.size - the size of minimized file that is not parsed. The default value is 0, which means that the minimized files are not parsed at all. 

You can add these properties to the netbeans.conf or run netbeans from a command line with -J-Dpropertyname=propertyvalue. For example if you run NB from commandline on linux throgh the command ./netbeans -J-Dnb.js.big.file.size=3145728 , NetBeans will not parsed js files bigger then 3 MB.

Let me know, if it's work for you. You can probably run in some performance problem, if you will edit such big file.
Comment 4 Petr Pisl 2014-12-15 15:21:15 UTC
I'm closing this issue as wont fix. I think that the default vales of these options works well.
Comment 5 elennaro 2014-12-16 10:10:03 UTC
Thank you so much Petr for taking your time and kindly helping me!
And sorry for creating this Issue.
I've tried -J-Dnb.js.big.file.size=3145728 and -J-Dnb.js.parse.big.files=true each by adding them to netbeans_default_options in netbeans.conf 
(System data is:
Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Java: 1.8.0_25; Java HotSpot(TM) 64-Bit Server VM 25.25-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_25-b18
System: Windows 8 version 6.2 running on amd64; UTF-8; en_US (nb)
In IDE log i saw each argument in:
Input arguments:
Project opening time did not increase, I mean background scanning time. Finally I enabled both setting and reopened a project few times, even recreated it (as HTML5 application with existing sources) but unfortunately nothing helped.
Comment 6 Petr Pisl 2014-12-16 10:33:54 UTC
Could you try to delete the index cache? The cache is located in your userdir and how to find your userdir is write up here: .

The index cache should be in the folder index. After deleting the cache, start NB again. It will parsed all the file again. 

Or when you open the big file, does it have the semantic coloring? If yes, then it's parsed. You can create small change (add a space to the comment). This invokes reindexing the file. Thanks.
Comment 7 elennaro 2014-12-16 11:43:31 UTC
Thank you once again Petr!

So, I've:
1) closed Netbeans
2) deleted content of C:\Users\{MyUsername}\AppData\Local\NetBeans\Cache\8.0.1\index (please don't be confused about 8.0.1 folder name, i've updated netbeans to 8.0.2)
3) Opened Netbeans and checked color scheme on phaser.js

Background Scanning of projects took about 3 minutes :)
Autocomplete search takes 1-2+ minutes after hitting Ctrl+ each time :)
But it worked! I See the docs now!
Thank you!

So all the suggestions you gave me do work.
Even that 1Mb is quite a good limit for JS file scan.
Thanks once again, for your king help and explanations!
Comment 8 Petr Pisl 2014-12-16 12:21:48 UTC
You are welcome, but if you have to wait 1 or 2 minutes for cc, then it's unusable.:(
Comment 9 elennaro 2014-12-16 13:32:47 UTC
It is, Petr.
So the only way I've figured out is to put sources of the library in any folder of my project, while developing, and deleting it for release.

Second solution I see, is to add to Netbeans' CC ability to make suggestions(autocompletes) from another open projects (At least if there is a bower dependency between two projects or if they both are simply open).
If you like this suggestion, I could make an enhancement issue for this.

Anyway, thank you very much for your kindness.
Comment 10 Petr Pisl 2014-12-17 09:55:29 UTC
There is a workaround. You can define some types through the @typedef annotation in your project and get the cc for it. So have one js file, where are defined most used types from the library.