Bug 238709 - Add ignored folders to HTML5 project
Add ignored folders to HTML5 project
Status: RESOLVED FIXED
Product: web
Classification: Unclassified
Component: HTML Project
8.0.2
All All
: P2 with 24 votes (vote)
: 8.2
Assigned To: Tomas Mysik
issues@web
:
: 238638 239399 254918 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-22 16:44 UTC by Vladimir Riha
Modified: 2016-08-10 08:00 UTC (History)
12 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
nbpoject folder (1.76 KB, application/zip)
2015-08-18 14:08 UTC, jdoe_12345
Details
Support for .nbignore files (15.59 KB, application/octet-stream)
2016-01-19 18:13 UTC, Tomas Mysik
Details
Sources of nbignore module (4.53 KB, application/zip)
2016-01-22 13:03 UTC, Tomas Mysik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2013-11-22 16:44:23 UTC
Just like PHP project has ignored folders property, it would be really useful to have it in HTML5, especially after having GruntJS support:
 - GruntJS installs npm modules into site root => scanning time is increased a lot (if one has more modules installed)
 - npm modules could contain code that is in term of JS syntax invalid, but due to nature of modules in npm and modules, it is valid (like return statement outside of function) => projects/folders has error badges not related to user's code
Comment 1 Vladimir Riha 2013-11-29 13:40:29 UTC
*** Bug 238638 has been marked as a duplicate of this bug. ***
Comment 2 Vladimir Riha 2013-12-12 15:42:27 UTC
*** Bug 239399 has been marked as a duplicate of this bug. ***
Comment 3 Izzmo 2014-12-21 04:27:13 UTC
This would be great to have.. please include! Not sure why you would discriminate with this option having only in projects such as PHP or Java.. and not HTML.
Comment 4 zimmi 2015-04-07 13:29:55 UTC
ember-cli uses a .tmp-directory next to the project files for intermediate js cross-compilation results and things like that.
I suspect that this is responsible for some slowdown of NetBeans, but I haven't checked.
Comment 5 nikolayivanovivanov 2015-04-23 13:11:07 UTC
I need to save the javascript source and minified files are under the same project. This makes a mess. I need to ignore the folder with the minified js files.

It seems that there are many use cases where the "Ignore folders" feature is needed. Please, we need it!
Comment 6 Tomas Mysik 2015-04-24 05:21:52 UTC
Consider using a different project structure, something like:

project
├── doc         <-- NetBeans shows it only in Files view
├── resources   <-- NetBeans shows it only in Files view
├── public_html <-- Site Root in Projects view
├── test        <-- Unit Tests in Projects view
└── tmp         <-- NetBeans shows it only in Files view

This could help, I hope.
Comment 7 nikolayivanovivanov 2015-04-24 10:52:15 UTC
(In reply to Tomas Mysik from comment #6)
> Consider using a different project structure, something like:
> 
> project
> ├── doc         <-- NetBeans shows it only in Files view
> ├── resources   <-- NetBeans shows it only in Files view
> ├── public_html <-- Site Root in Projects view
> ├── test        <-- Unit Tests in Projects view
> └── tmp         <-- NetBeans shows it only in Files view
> 
> This could help, I hope.

Good suggestion, but the minified js and css files (if you use sass) are needed under the public_html (or www in my case) directory.

Will netbeans ignores some of the folders under public_html if I name them in a certain way?

When working on php projects we just add them to the ignore list.
Comment 8 Tomas Mysik 2015-04-24 10:55:05 UTC
(In reply to nikolayivanovivanov from comment #7)
> Will netbeans ignores some of the folders under public_html if I name them
> in a certain way?

See Tools > Options > Miscellaneous > Files, feel free to update the regular expression [1].

HTH.
[1] ^(CVS|SCCS|vssver.?\.scc|#.*#|%.*%|_svn)$|~$|^\.(?!(htaccess|git.+|hgignore|npmignore|jshintrc|bowerrc|travis\.yml)$).*$
Comment 9 pschoefer 2015-06-06 15:28:51 UTC
Changing the regex is not going to help the issue. The node_modules folder contains filetypes that can be found within the projects, .js files, for example. I can't exclude all .js files in my projects.

It needs to be based on the folder.
Comment 10 jdoe_12345 2015-07-27 14:20:09 UTC
As an example of how necessary this is for HTML5 projects using NPM, Grunt, Bower, etc., the webapp I'm working on has a node_modules folder that's 61.5 MB (90 on disk) containing 10,170 files. This means that whenever I start up NetBeans, it takes 15 minutes to scan all those files and actually finish opening the project.
Comment 11 Tomas Mysik 2015-07-28 08:01:27 UTC
(In reply to jdoe_12345 from comment #10)
> As an example of how necessary this is for HTML5 projects using NPM, Grunt,
> Bower, etc., the webapp I'm working on has a node_modules folder that's 61.5
> MB (90 on disk) containing 10,170 files. This means that whenever I start up
> NetBeans, it takes 15 minutes to scan all those files and actually finish
> opening the project.

@jdoe_12345: This can be solved by better project structure, I guess. Something like:

project/
├── node_modules
└── public_html    -> set this as Site Root

With this project structure, NetBeans will "ignore" (do not scan & index) node_modules directory at all.

Thanks.
Comment 12 jdoe_12345 2015-08-17 15:09:15 UTC
(In reply to Tomas Mysik from comment #11)

Nope. I already have a project directory structure like that:

project/
├── bower_modules/
├── nbproject/
├── node/
├── node_modules/
├── src/            -> Site Root folder: project/src/main/webapp
├── target/
└── template/

and NetBeans still scans and indexes the entirety of bower_modules, node, and node_modules
Comment 13 Tomas Mysik 2015-08-18 08:11:00 UTC
(In reply to jdoe_12345 from comment #12)
> and NetBeans still scans and indexes the entirety of bower_modules, node,
> and node_modules

In such case, feel free to attach your nbproject folder here, I will look at it. But please first verify that it does not contain any private information.

Thanks.
Comment 14 jdoe_12345 2015-08-18 14:08:59 UTC
Created attachment 155429 [details]
nbpoject folder
Comment 15 Tomas Mysik 2015-08-19 07:39:41 UTC
(In reply to jdoe_12345 from comment #14)
> Created attachment 155429 [details]
> nbpoject folder

Looking into your project metadata, only src/main/js and src/main/webapp should be scanned & indexed by NetBeans. If it is not true, please, create a sample project, submit a new bug report and attach the project to it.

Thanks.
Comment 16 Tomas Mysik 2015-09-02 05:49:30 UTC
*** Bug 254918 has been marked as a duplicate of this bug. ***
Comment 17 jockeeriksson 2015-10-31 06:00:47 UTC
Not all of us have the ability to change project structure.
Comment 18 jockeeriksson 2016-01-05 08:14:05 UTC
Any news on this and is there anything I can do to speed this feature up?

I think the best solution would parse the package.json file and filter out dev dependencies so they do not get indexed and parsed.
Comment 19 Tomas Mysik 2016-01-05 10:25:59 UTC
(In reply to jockeeriksson from comment #18)
> Any news on this

No news, sorry :/

> and is there anything I can do to speed this feature up?

The best would be to attach a patch here, of course :)

Thanks.
Comment 20 jockeeriksson 2016-01-05 23:05:05 UTC
OK I will take a stab at this. I can see three approaches here.

1)
Just implement the same functionality that php projects have, where you can add ignore folders. This is the easiest solution and probably the most robust. The problem is that we could loose some intelligent code completion because some folders are not scanned if you would add the node_modules folder. You could exclude 
every item separably I guess but it would be a hassle.  

2)
We could also parse the package.json if it exist and filter out any folder in the node_modules folder that is not a regular dependency.

3) All the above.

What do you think?
Comment 21 jockeeriksson 2016-01-07 07:46:20 UTC
Ok I started on this task and halfway through I realized I could fix my
issue just by not specifying a site root. But still I think dependencies that 
are bundled with the application should be indexed to get the best code completion possible. This will get even more important when we get ES6 support.
Comment 22 dusty 2016-01-11 21:03:17 UTC
I suppose that the files in .gitignore could be ignored by default...
Comment 23 Tomas Mysik 2016-01-19 12:33:29 UTC
One idea - what could be done now is to add a support for marking hidden folders using a special file (e.g. ".nbignore"); in other words, every folder containing this file would be ignored by NetBeans.

Opinions? Should I prepare a test module (*.nbm) for this functionality?

Let me know, thanks.
Comment 24 dholzgang 2016-01-19 16:20:31 UTC
(In reply to Tomas Mysik from comment #23)
> One idea - what could be done now is to add a support for marking hidden
> folders using a special file (e.g. ".nbignore"); in other words, every
> folder containing this file would be ignored by NetBeans.
> 
> Opinions? Should I prepare a test module (*.nbm) for this functionality?
> 
> Let me know, thanks.

I'd really like that. It seems a good solution for now, and fairly flexible.
Comment 25 gnhki 2016-01-19 16:38:55 UTC
(In reply to Tomas Mysik from comment #23)
> One idea - what could be done now is to add a support for marking hidden
> folders using a special file (e.g. ".nbignore"); in other words, every
> folder containing this file would be ignored by NetBeans.
> 
> Opinions? Should I prepare a test module (*.nbm) for this functionality?
> 
> Let me know, thanks.

Polluting a source tree with tool-specific files doesn't sound like a good idea. If the configuration is stored in a separate tool configuration hierarchy, that would sound better.
Comment 26 Tomas Mysik 2016-01-19 17:29:24 UTC
(In reply to gnhki from comment #25)
> Polluting a source tree with tool-specific files doesn't sound like a good
> idea.

I agree. The point is that the solution I proposed can be done _very_ easily (likely this week).

> If the configuration is stored in a separate tool configuration
> hierarchy, that would sound better.

I agree again. Unfortunately, this is totally out-of-scope, at least for now, sorry. Of course, patches are more than welcome! :)

So, please, let me know if I should try to prepare the NBM file with the solution I proposed earlier.

Thanks for your feedback.
Comment 27 dholzgang 2016-01-19 17:51:47 UTC
As Voltaire said "The better is the enemy of the good". I vote for the quick fix; it's better to get something done imperfectly than to do nothing perfectly.
Comment 28 Tomas Mysik 2016-01-19 18:13:15 UTC
Created attachment 158182 [details]
Support for .nbignore files

This NBM should work in NetBeans 9.1 as well as in the development version of NetBeans.
Comment 29 Tomas Mysik 2016-01-19 18:16:50 UTC
I just attached the NBM file, feel free to test it (Tools > Plugins > Downloaded).

As I already wrote, I would also prefer to have a UI in the Project Properties dialog and store this option in the nbproject directory but this is not doable right now, sorry.

Please, let me know whether the plugin works for you (so we could add it to the plugin portal maybe?).

Thanks!
Comment 30 Tomas Mysik 2016-01-19 18:17:35 UTC
(In reply to Tomas Mysik from comment #28)
> This NBM should work in NetBeans 9.1

I meant NB 8.1, of course! :)
Comment 31 Tomas Mysik 2016-01-19 18:19:33 UTC
One note: this plugin could have some impact on the performance (it is touching the HDD but I hope the impact will be not visible at all).

Thanks.
Comment 32 Tomas Mysik 2016-01-19 18:29:33 UTC
Last note, I promise :)

This plugin works in all project types, not only HTML5 project, of course.
Comment 33 dholzgang 2016-01-20 07:44:01 UTC
(In reply to Tomas Mysik from comment #28)
> Created attachment 158182 [details]
> Support for .nbignore files
> 
> This NBM should work in NetBeans 9.1 as well as in the development version
> of NetBeans.

Hi Tomas...

Works for me! Thanks for the (very ;-) prompt fix.

System information for your records:
Product Version: NetBeans IDE 8.1 (Build 201510222201)
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-4-amd64 running on amd64; UTF-8; en_US (nb)
    	Debian 8.2 (Jessie)
Comment 34 Tomas Mysik 2016-01-20 08:00:29 UTC
(In reply to dholzgang from comment #33)
> Works for me!

Great to hear! Thanks for letting me know.

> Thanks for the (very ;-) prompt fix.

You are welcome, of course.

Thanks.
Comment 35 Tomas Mysik 2016-01-22 13:03:29 UTC
Created attachment 158219 [details]
Sources of nbignore module

Attaching sources of nbignore module (to avoid loosing them :)
Comment 36 Tomas Mysik 2016-08-10 08:00:23 UTC
Please note that module Support for .nbignore files is now in contrib reposiry and its NBM file can be found here [1]. I consider this issue to be fixed.

Thanks.
[1] http://deadlock.netbeans.org/job/nbms-and-javadoc/lastSuccessfulBuild/artifact/nbbuild/nbms/extra/org-netbeans-modules-nbignore.nbm


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo