Ignore node_modules in Webstorm when using navigation pop-up - webstorm

Is it possible to ignore searching the node_modules folder when using WebStorm's navigation pop-up window (Command + Shift + N)?
This makes it really annoying when wanting to quickly navigate to, for example, the package.json file.

To exclude the directory from being searched via navigation pop-up, pick node_modules directory in Project view, then from mouse context menu:
Mark Directory As -> Excluded
Directory could be restored via Preferences->Directories->Excluded Folders settings

In Webstorm 8, you need to also visit Settings > JavaScript > Libraries and disable Node.js core modules and node_modules. The directory exclusion will then work as before.

To exclude node_modules/ files from being searched in "Navigate | File..." popup and to avoid indexing node_modules/ folder, please perform these steps:
Mark node_modules/ folder as excluded in Settings | Directories.
Remove "<your project name> node_modules" library in Settings | Languages & Frameworks | JavaScript | Libraries.

To exclude node_modules folder from all projects (only created after that change) you can add this folder to list of standard folders to ignore.
Open PHPStorm, and close current project File > Close Project.
On startup PHPStorm window click "Configure > Settings".
Then navigate to Build, Execution, Deployment > Deployment > Options.
Now you can set node_modules or anyone else to exclude by default for all new projects.
P.s. Closing the current project is very important. If you do this settings with active project, this will affect only current project.

Exclude the directory: Mark the directory itself as excluded
(Right-Click -> Mark Directory As -> Excluded). It might then
already disappear.
Hide excluded files: Tick the project pane option (under the Gear-Wheel symbol) and un-tick Show Excluded Files to hide excluded
directories

I'm not sure why, but I saw lots of files with "spec" on Ctrl+Shift+n (I can't publish images, sorry :( )
I saw on the contextual menu over the node_modules:
"Mark directory as": "excluded", "test sources root", "resources root"
I went to settings > directories, and I saw the node_modules with red color and can't change it, but, on the left there is list without header (?), I'm not sure if it is the exclude list, but, there is an X, I pushed on it, and restarted the IDE and it works!
If I see the contextual again, I see:
"Mark directory as": "not exclude" and "test sources root".
And in settings > directories I do not see on the lists, but red color on the folder node_modules (weird), I think it is so particular for this folder.

While webstorm tries to keep indexing everything inside your project - while if its a node project - the indexing takes forever, the better ways to exclude the node folder from indexing as below.
Select folder -- Settings|Directories -> Use Exclude - button on folder

Related

Why is '.editorconfig' not doing anything in Visual Studio 2017?

I have the following version of Visual Studio:
Microsoft Visual Studio Community 2017 Version 15.1 (26403.7) Release
VisualStudio.15.Release/15.1.0+26403.7
I created a new project and added a .editorconfig file at my solution base folder.
Its content is the following:
root = true
[*.cs]
indent_style = space:warning
indent_size = 12:warning
# C# and Visual Basic code style settings:
[{*.cs,*.vb}]
dotnet_style_qualification_for_field = false:warning
The file location should be right:
.editorconfig <-- Here it is
ApplicationInsights.config
App_Data
App_Start
bin
Content
Controllers
favicon.ico
fonts
Global.asax
Global.asax.cs
Models
obj
packages.config
Properties
Scripts
Startup.cs
Views
Web.config
Web.config.backup.1
Web.Debug.config
Web.Release.config
WebApplication8.csproj
WebApplication8.csproj.user
But whenever I edit a .cs file, nothing special happen (despite indentation not following the rule), I expect a warning (after a build, for instance) to show up, but no.
Is there something wrong with my configuration, or is there something which could hinder the configuration from being applied?
I had this same problem. The solution was adding the .editorconfig file to the solution in my case. You can choose to either add it to the solution or the project, depending on whether you want it applied everywhere or just the individual project.
Solution Explorer → right-click your solution or project → Add → Existing Item... (if you have the .editorconfig file in position at the root of the solution or project) or New Item... (then search for editorconfig in the Add New Item wizard and choose the appropriate type for your work).
I solved a similar issue by placing the .editorconfig file at the root folder of the project, i.e., the same folder as your .sln file.
Try to put the .editorconfig file into the same folder as your source file. If it helps, try to move it up (into one of the parent directories) until you get it high enough to affect all the files you need.
If you have any EditorConfig extensions installed, try to uninstall them. There were some related bugs reported.
I had a similar problem and this is how I solved it:
My solution folder had a parent folder named between square brackets [], like [ParentFolderName], so I removed the square brackets and everything worked as expected.
For a reason or another, the editorconfig file does not do anything when the solution folder has a parent folder named between square brackets. The IDE (in my case Visual Studio 2017) uses its settings.

Multiple projects on same root folder

I have a directory like this:
htdocs
- shared
- project 1
- css
- JS
- project 2
- css
- JS
etc.
Now I want to create 2 projects, one with the folders shared and project1 and one with the folders shared and project2.
The first project I can create with htdocs as a root folder, and exclude project2 as source directory.
However, when I want to create a new project with htdocs as a root folder, WebStorm sees the already created project.
Is it possible to create the project structure like I want?
Sure. But it involves additional manipulations.
The idea is simple -- store .idea folder (project settings .. and the clue/marker for IDE that this is a project) somewhere else:
Create new empty project somewhere else
Go to Settings/Preferences | Directories
Remove existing Content Root
Add new Content Root -- the folder(s) that you need.
You can A) add both folders as separate content roots (e.g. shared and project 1 as per your example) .. or B) add htdocs and then mark unwanted folders as excluded (so it's not indexed and not participating in code completion etc).
I suggest using A) option in general -- less files to work with for IDE (in B) -- even though the folders are excluded, they are still processed by IDE and can participate in certain activities).
Repeat the same for your 2nd project (for shared and project 2 folders)
https://youtrack.jetbrains.com/issue/WI-343 -- this ticket is for PhpStorm but describes the actual idea.
Alternatively:
Create project in project 1 folder (and not htdocs like you were planning originally)
Add additional Content Root -- add shared folder -- it will be listed as separate node in Project View.
Do the same for your 2nd project.

How to make Netbeans remove deleted files from the project?

I am developing a C++ program using CMake as a Makefile generator. I have added the project as an existing source to the Netbeans and everything works nice except when I update lists of dependencies for my build targets.
Netbeans is able to get the new files added to the project, but keeps removed files hanging with a small yellow warning icon in the list of files. So the only way they could be removed is to manually in the GUI or by removing them from configurations.xml in the project.
As far as I understand the issue is about the way Netbeans scans for external changes. Is there a way to tell it to remove deleted files from the project?
You can try solutions mentioned here:
right click on your project in the "Projects" window,
click on "Properties",
click on "Ignored folders" in the left panel called "Categories",
click on "Add folder" and select the folders you want to ignore.
You can also clear the cache located in:
C:\Users\username\.netbeans\7.0\var\cache. //Deleting this directory should clear the cache for you.
To remove a file name with no file from my C++ static library project...
< File < OpenProject < "YourProject" (< means left click) (Leads To Projects.)
< Source Files > a.cpp < Remove File From Project (> means right click)
< Header Files > a.h < Remove File From Project (And the header file.)
I'm using netbeans 8.2. Curiously only c.cpp is listed under "Source files".
And only c.h is listed under "Header Files".
All the other (actual, real) source and header files are listed under "Important Files".

Eclipse CDT "New Class" default paths for created source files

How can I configure Eclipse 4.2 to put the test file in tests/ when using the New Class wizard?
I'm looking for the same thing... well, I was looking to automate it. In the remote case you didn't figure out any solution at all, here's my solution that is a 2 extra clicks and some typing (steps 3 and 4).
Right click folder you want your new source files (.h and .cpp) to be in, and choose create new class
Type the 'class name' as usual, check 'unit test'
Click Browse next to unit test and click ok, without selecting a file (but don't hit cancel!).
choosing a path doesn't do anything. It would be nice if Eclipse would append the path to the file name, but it doesn't.
What it does do is change the source folder to the project root, and fills in a relative path for the other 2 files, src/class.h and src/class.cpp.
Type test/ in front of the test file name to specify the path.

Cannot open include file "AIUtilities.h": No such file or directory. But it exists?

I have a two projects, AI and Core, which used to hold a circular dependency. I have a CoreUtilities file that I have broken up to remove this dependency, and added the functions I have removed to a new file called AIUtilities(.cpp/.h).
I then went to the piece in my AI project that uses these functions and added #include "AI/AIUtilities.h" and changed the function call from CoreUtilities::Functionname to AIUtilities::Functionname. Upon compile, I recieved the error given in the title.
Why! How can I fix it?
Did you update your project settings with the path to the direcory containing AI/AIUtilities?
Update:
From the solution explorer window, right click on your project and choose "properties" then a new windows "your_project_name property page" will pop up.
In this window on the left pane you'll see a tree. Click on 'Configuration properties' which expands to multiple choices. Continue clicking on 'C/C++' then on General. On the right pane appears multiple properties that affect your project.
Choose the "Additional include directories" property and add the path to your new directory. For instance if your path is : "C:\AI\AIUtilities.h" add the following: "C:\" in the property.
Click on "Aplpy button". Done.
As mentioned in other post, you must consider that moving your project around will break your project settings. Don't forget to update them. Or use either environnement variable to set the root of your project or use the "../../" trick. But personnaly I prefer the former.
You need to ensure that the parent directory of AI is on your header include path. Assuming that your code is laid out like this:
blah/source/
AI/
AIUtilities.h
AIUtilities.cpp
Core/
CoreUtilities.h
CoreUtilities.cpp
So either you need to have the header search path to '/blah/Source' or '..' depending on how your directories are structured.
Note that if you have sub-directories inside each project then this can cause problems with resolving the header search path. In that case set the header search path to $(ProjectDir)\.. .