Enable auto-scanning of sources - Scan for External Changes

NetBeans 6.9 contains a feature that automatically looks for external changes to keep informations about files up-to-date. We have some reports that it can slow down NetBeans mainly, when an open project has many folders. When NetBeans find out that files were externally changed, it re-scans the files to keep data up-to-date that are used with features like code completion, navigation etc. Unfortunately the notification and following re-scanning can take some time and during this time many mentioned features are waiting for the finishing of scanning. There is option Enable auto-scanning of sources that can switch off this behavior. The option you can find it in Options dialog, Miscellaneous category and Files tab.

The default behavior is that NetBeans also looks for external changes when the main window gets focus. This is can be during developing a web application very often when user switches between browser and IDE. The mentioned option also switch this off.

When you switch off  option Enable auto-scanning of sources you can still keep the information up-to-date, just invoke Scan for External Changes  action from Sources menu manually.



Comments:

So, this finally might render the (in-?)famous "Scan on Demand" plug-in for NetBeans obsolete. IMHO it's a good thing!

Posted by Tom on June 02, 2010 at 11:56 AM CEST #

That sounds really great! When will it become available? I'm using a DEV build, but I don't see the new feature (maybe I'm using an older DEV version?). I think this could be great for me because our DEV-server at work is a bit slow at times and this is where we keep the files. I thought it was a networking issue for a long time but it turns out that it is the server. Anyway the server seems to have huge impact on how responsive NetBeans is. Even basic text-editing such as copying code, deleting lines code etc. frequently has lag. This is ok for a while, but after a few hours of coding it gets really annoying, and I start focusing on the editor instead of banging out code :-) I also use NetBeans at home where I have the files I'm editing on my local drive. This is working 100xTimes better. I hope (and think) this new feature will improve my daily NetBeans experience and I can't wait to try it. There is no way I'm switching to another editor because NetBeans is still the best. Thanks a lot to the developer(s) who are implementing this feature!

Posted by Kristian Wiborg on June 02, 2010 at 04:30 PM CEST #

this is a great tip!
that scan external was eating my memory all the time! thanx for the share :D

Kristian just download and use the 6.9 RC1 or builds that come after it if there are ;)

Posted by pit on June 02, 2010 at 04:37 PM CEST #

I have installed the ScanOnDemand plugin last week. But I'm going to disable it now and try this great new feature of netbeans!

Posted by Joris van de Sande on June 03, 2010 at 01:43 AM CEST #

@Kristian: If I understand, you have the sources on a network drive, is it right? I'm afraid that the option will not solved all your problems. It will help, but on the local drive it will always faster. I hope that at least the userdir you have on the local drive.

Posted by Petr Pisl on June 03, 2010 at 05:43 AM CEST #

@Petr Pisl: Yes I have the sources on a networked drive and you are right the new feature hasn't solved all issues. But is has helped. We will be upgrading our server at work in the near future and hopefully that will also contribute to a less frustrating NetBeans-experience. BTW I do have the user-dir on my local harddrive.

Posted by Kristian Wiborg on June 04, 2010 at 11:02 AM CEST #

@Kristian: Try to convince your company and yourself to use a VCS system like Subversion. It's very useful and your work will be easier.

Posted by guest on June 07, 2010 at 08:46 AM CEST #

Nice! Is there any way to assign a key to "Scan for external changes" ? :)

Posted by Ole Hejlskov on June 09, 2010 at 05:43 AM CEST #

@Ole Hejlkov: Sure, you can assign a shortcut to an action in Tools->Options->Keymaps. Find the action and assign a shortcut.

Posted by Petr Pisl on June 09, 2010 at 11:03 AM CEST #

@Petr Pisl

Awesome! :D

Posted by Ole Hejlskov on June 09, 2010 at 11:09 AM CEST #

Not really sure I like this feature at all. I disabled it because Netbeans 6.9 began using a lot more memory, and the "Checking for external changes" scan was taking a long time and running too often. I actually prefer Netbeans 6.8 and have gone back to it. In 6.8 when I create a new file in Windows explorer, the Netbeans project tree gets automatically refreshed to show the new file. In 6.9 with "Enable auto-scanning" disabled, the project tree doesn't get auto-refreshed to show the new file. So I like the way 6.8 worked better. It scanned in the background for changes but didn't use up much memory. Am I wrong?

Posted by ptuna on June 17, 2010 at 03:17 PM CEST #

I really don't like this feature, we have a large codebase and it caused NB to freeze a lot and lag due to a large number of files it had to keep checking on. If I had a smaller project base it would probably be an excellent feature but not for me.

Posted by Travis on June 21, 2010 at 01:58 PM CEST #

Totally agreed with ptuna. I like how it worked in NB 6.8. Why NB performs scan on each window focus? I want to disable such feature but save NB6.8 - like scans.

Posted by Aleksey on June 24, 2010 at 04:59 AM CEST #

@Aleksey: NetBeans 6.8 doesn't know about external changes, if the file is not somehow touch by NB. So when you did change (for example update a VCS from command line) then NB 6.8 doesn't rescan the sources and features like CC work with old data cached in an Lucene index.

NB 6.9 tries to handle this automatically. It's change in the core and we have to complain against the core (if we want). I hope that all problems will be fixed soon.

Posted by Petr Pisl on June 24, 2010 at 06:36 AM CEST #

I like this feature, but it doesn't add anything new. We already had ScanOnDemand plugin which does the same.

The problem with scanning is not its speed. It is the \*PERCEPTION\* of speed that matters. Why do I have to sometimes wait for it? Why is everything slower when it runs? Why does it freeze from time to time?

The real solution would be:
- remember the old scanned data and use it until you get a newer version
- scan in background (another thread), be nice
- no process should wait for scanning to finish, they should all use the old data
- when scanning has finished, just switch the data

I know this is oversimplification, but please give the developers older machines and HUGE projects (with lots of unnecessary files) and I guarantee you this issue will be solved in a week. ;)

Posted by Andrew on July 04, 2010 at 05:34 AM CEST #

I too just switched back to 6.8, as 6.9 was totally unusable because of the constant scanning. Adding a checkbox which the user must go&click is in no way a solution to this problem.

Posted by Red on July 15, 2010 at 06:53 AM CEST #

I know what this is \*supposed\* to do, but it's broken in Netbeans 6.9.1. I have ScanOnDemand uninstalled, I have "Enable auto-scanning" disabled, but still Netbeans insists on running the memory-intensive, CPU-intensive, "Scanning Projects" sequence every time I open Netbeans, open a project, and who knows what else.

Posted by Brian on October 13, 2010 at 01:44 PM CEST #

Is there a way to change how often it check for external changes. I like having it enabled but would like it to run once every 10 minutes or 30 minutes or something like that. Is there a way to configure that?

In reference to Brian. If you want auto-complete (and other modern IDE features) you have scan the project at some point in time. So have it scan once when you start netbeans or on project open is pretty much required if you want those features.

Posted by Jeff Whiting on October 19, 2010 at 12:42 PM CEST #

When I disable the auto scanning, the IDE no longer alerts me to problems (i.e. missing methods that I haven't implemented when I declare that I implement an interface). I also consistently get an IndexOutOfBoundsException http://netbeans.org/bugzilla/show_bug.cgi?id=187924. Ughh.

With it enabled I need to restart the program about once every 30 minutes or so as it just becomes completely unusable, using 1 gig of memory and 100% cpu.

Posted by Nick Dunn on February 24, 2011 at 11:55 AM CET #

La depilación láser, láser de la información Bienvenido a Daphne. La depilación láser antes de la aplicación yaptırmadan Le recomendamos que lea nuestra información.

Posted by lazer epilasyon on April 01, 2011 at 10:10 AM CEST #

I'd just like to pile in and say the scanning is a source of pain. It's intrusive and constantly reminds about itself either by preventing other functionality (autocomplete, go to declaration etc.) in the UI or not functioning reliably itself. For instance, I just had to restart the IDE because it couldn't see the files the IDE itself had just created. I knew they were there, because I could see them working on the server, but the project tree just didn't update. Now I'll have to endure the scan taking forever due to having to work with large projects on network shares. It would all be solved if NetBeans would just cache the results of previous scans. It would be much more useful than a hacky option to disable automatic scanning.

Posted by slikts on April 15, 2011 at 01:48 AM CEST #

Also I've seen a higher demand of memory if you have Web enabled. Make sure not to have it enabled if you are not using it. If you still have issues use VisualVM when the lockup occurs to get both a thread and Heap dump and file an issue with those.

Posted by lazer epilasyon on April 15, 2011 at 10:13 AM CEST #

not sure about what to do on linux, but in the windows version why not use file hooks? Visual Studio does this very well - the IDE is notified by the OS of any changes and immediately asks the user how they want to resolve the conflict.

Posted by CS on December 27, 2011 at 04:48 AM CET #

So good!
Thanks!

Posted by guest on October 04, 2012 at 07:35 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

This blogs is written by NetBeans developers who contribute to the PHP support mainly.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today