Folders missing in project pane in Webstorm - ide

I've built a project in WebStorm and then submitted the project to GitHub.
When I rebooted the computer and relaunched WebStorm (and the project), all I can see in the project pane is the root files, and none of the folders (yes the folders are there)
See the image below for reference.
Does anyone know how I can get those folders to re-appear in the project pane of Webstorm?

It can be caused by the corrupted .idea/modules.xml project file. You can either try to fix it manually (restore from Local History, version control or backup) or create the new project from scratch.
Check this issue for the hints/workarounds.

It happens sometimes in WebStorm 9.
The easiest way to fix it for me:
close WebStorm;
in project's folder remove .idea/ (hidden directory);
open your project, enjoy:)

Solution:
Creating a new project from existing sources
File => New => Project
Select "Empty Project"
Browse to the location of your project with folder issues
Click "Create"
Select "Create from Existing Sources" in the "Directory Is Not Empty" dialog
Why this solution:
Editing and deleting in various combinations of .idea and XML files did not solve the issue for me. Hence the solution above. Back up your .idea directory in case you have project customizations you want to keep. This likely overwrites them.
Outcome:
All the various folders I had created were now visible and the project worked as expected. The .idea directory was now formatted correctly with all the necessary files.

Find the .idea/modules.xml in your project root
make sure that these lines are correct :
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/NameOfYourProject.iml" filepath="$PROJECT_DIR$/.idea/NameOfYourProject.iml" />
</modules>
Replace NameOfYourProject.iml with the name of your project.
Then, make sure that the file .idea/NameOfYourProject.iml exists, if not , create it and put this in it :
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="PHP">
<CLASSES>
<root url="file://$MODULE_DIR$/../../php/PEAR" />
</CLASSES>
<SOURCES />
</library>
</orderEntry>
</component>
</module>

You do not need to delete whole .idea folder and reconfigure your whole project, just
delete the .idea/modules.xml
restart the IDE and your folders are there again!

I ran into the same issue and resolved it by invalidating the cache.
The option is under File > Invalidate Caches/Restart.
On the prompt click Invalidate and restart.
Note: The project in concern needs to be open before you do this.

I see this from time to time. I use Git, and I have my .gitignore file set up as recommended, specifically:
.idea/workspace.xml
.idea/tasks.xml
.idea/*.iml
I sometimes see this after cloning the repository, and when trying to figure out why, I came across this post and read the accepted answer.
I deleted the modules.xml file and reopened WebStorm (2016.2.4), and it was resolved. I looked at the new modules.xml and found that its contents were exactly the same as before, but my <projectName>.iml file was bigger.
So it seems to be a corruption in the .iml file, not modules.xml. I assume that deleting modules.xml triggers a rebuild of the .iml file. Not sure if this helps anyone with anything, but thought I would offer the extra insight.

floor 36 solve my problem. in WebStrorm 11
It happens sometimes in WebStorm 9. The easiest way to fix it for me:
close WebStorm;
in project's folder remove .idea/ (hidden directory);
open your project, enjoy:)

Try deleting workspace.xml and watchertask.xml then just restart the IDE. You must see your full source code in all folders there.

Finally I found the culprit, it was Team Foundation Server - Version Control Integration plugin from https://plugins.jetbrains.com/plugin/7961-team-foundation-server--version-control-integration/
I looked at the system/log/idea.log file and found that this plugin was producing Null exception whenever I open a new folder as a new project and breaks the content root auto detection by the IDE, and after I uninstalled this plugin, all folders show up as it should.
You might have this issue because of a culprit plugin, and disabling those which you have just installed recently just before this issue occurs, will resolve the issue. Check the log file and search for ERROR.
If it is found to be an important plugin you are actively using which you are not willing to disable, then a temporary fix is to open Settings->Directories and click Add content root button to add the root folder of your project, click Ok now folders will show up and indexing will begin, and of course you have to do this everytime you open a new folder as new project.

Related

Intellij Load Settings error

After a computer crash i get the following error in Intellij:
Cannot load settings from file 'C:\Users\*\.IdeaIC14\config\options\mavenVersion.xml': content truncated
File content will be recreated
What I've tried to no success: clearing \caches folder, deleting mavenVersion.xml file.
Please help restoring peace in Intellij IDEA!
In my case, there were Intellij and Android Studio installed on my machine.
I deleted the .idea dir in the project. Opened the project in Android Studio. Closed it. Then everything was fine in IntelliJ.
I am pasting the contents of my mavenVerison.xml file for you - please recreate the file with this contents, in the specified location, and give it another try.
<application>
<component name="MavenVersion" version="3.x" vmOptions="-Xmx512m" embedderJdk="#JAVA_INTERNAL" />
</application>
Note that I am using maven 3.x.
If this doesn't work, and if you don't mind reconfiguring your environment again, stop IntelliJ, move the entire .IdeaIC14 folder to some place else, and restart IntelliJ.

Intellij IDEA 14: Error Loading Project: Cannot load module cars-service

With my last restart of my mac I had a problem with IntelliJ IDEA project : the .iml file was deleted and I have
Error loading project: cannot load module cars-service Details ....
in the console.
Besides that, the structure view of the project has disapeared.
Here is a screenshot:
Finally, I imported my project via import project so the iml file was recreated.
Closing intelliJ. Deleting the .idea folder and re-opening intellij worked for me.
This happened to me this morning*, and fortunately there's a fairly straightforward solution.
Press Ctrl+Alt+Shift+S (or go to File > Project Structure...) and click Modules on the left of the window.
Click the green + above the list of modules then New Module. Select the type of module (Java, Android, Flash, what have you) and click Next.
Enter the details of the lost module. Click the browse button to the right of Content Root and navigate to the directory that contains your lost module. The module name will be populated with the directory name by default, but you can rename it without issue.
(*I... got a bit gung-ho with the old git clean -fd. I don't recommend it.)
The error has nothing to do with gems. Please try deleting the .idea directory and using "Open Directory" on the same directory again to recreate it.-- Dmitry Jemerov
↑an answer on intellij-support.jetbrains.com
This helped me. I just closed Pycharm, then delete .idea directory , then I open Pycharm again, and the error disappeared.
Please try File -> Invalidate Caches / Restart ...
Had a similar issue with PHPStorm (which is also idea based), caused by a renaming of my project. Solution was simple: I just needed to remove the corresponding line for the module declaration in file <project-directory>/.idea/modules.xml. Re-opening the project was not needed as it seemed to me, but I did it anyway.
Have had this issue with PHPStorm 2017.1.3.
IML file is necessary to load the project.
Locate the folder the .iml file used to be in > right click > Local history > show history.From there you should be able to restore that iml file
you can fix it by select your pom file. right click and then reimport

In IntelliJ, How Do I Fix "These Files Do Not Belong to the Project"?

I recently put several old, yucky git directory structures into one new, clean structure in SVN, then pulled the entire SVN repository back out into a new, clean, local git repository. One IntelliJ project was so messed up I had to import the old IntelliJ project, which created a new .iml file having a better name, and deleted the old .iml file. I reconfigured everything, committed back into SVN, and verified other people could open the project and build.
Today I tried to edit a file for the first time in this project and got the message, "These files do not belong to the project". IntelliJ offers to unlock the file or all non-project files in the current session, but both options sound wrong. What have I done to myself, and how do I fix it?
This happened for me when I ignored the .idea/ files. Just do
rm -rf .idea/
And then File -> Invalidate Caches/Restart -> Invalidate And Restart.
I figured out the problem. The file was still open from before all the shuffling, and was apparently pointing at the original file in its original location! I closed the editor and reopened the file from the project tree without a problem. I hope this helps someone else someday.
From File-> Repair IDE -> Rescan Project Indexes -> Reopen Project worked for me.
Had same problem on Ubuntu (Webstorm), got answer from Intellij.
There are no content roots in your project, so all your files are
treated as non-project files. As I wrote your .idea files are likely
broken, the .iml file and/or modules.xml are either missing or
corrupted. Deleting and re-creating .idea folder should help:
-close the project
-remove it from Recent projects list
-shut down the IDE
-delete the .idea folder
-restart, open the project root folder with File > Open
https://intellij-support.jetbrains.com/hc/en-us/requests/3779670?page=1
This also happened for me when I opened the project through a symlink (parent directory) or when the python interpreter was inside a symlink directory (because of virtualenv).
Reopening through the original directory tree (after fighting hard with the IDE to forget its beloved project settings), solved the issue.
It's probably listed in one of the XML config files in .idea/*.xml.
Just do a find of that folder for the name of the file in question, and remove the entry for it from the XML.
Mine was listed in .idea/workspace.xml within the following node: <component name="TypeScriptGeneratedFilesManager">.
I removed the option, then invalidated caches and restarted, and now the file is marked as a standard, non-generated file again. This way you can keep all your settings without exporting them and importing them.
Similar issue with WebStorm. The difference was I had to shutdown the IDE completely and then remove .idea folder
rm -rf .idea
I tried doing it with the IDE open and going to file File -> Invalidate Caches but that did not fix the problem for me.
Same problem. File was considered not part of the project even if I deleted it and created a new one with the same name.
To fix,I highlighted the project node in the left panel, selected "File/Invalidate caches and restart" from the top menu.
After the restart I had to set my file as a JS file (right click, set as JavaScript), close and reopen the project. All fixed.
For me the above did not help. I ended up going Project Structure -> Modules -> + at the top narrow middle column -> browsed through files to select the Project Folder -> apply -> ok -> all is done and working correctly.
My problem was much simpler than expected: I was trying to run a Jupyter notebook and got the error - because it was inside a folder that was marked "excluded" in the project structure.
Simply moving the notebook out of the excluded folder solved my problem.
In my case it was auto-generated .gitignore, I had entries like:
### npm ###
node
node_modules
frontend-dest
data/
And in project files I had java package called like com.company.test.data which matched last pattern. I strongly recommend to check it before removing .idea/ files and invalidating cache.
This warning is an IDE issue that Android Studio cannot recognise the current directory if it does not include any source files.
So, adding am empty source file, e.g empty_xxx.c under the directory in question and adding below line in CMakeList.txt
add_library(${TARGET_NAME_XXX} SHARED ${SOME_DIR_HAVING_THIS_WARNING}/empty_xxx.c)
will help get rid of this warning.
In my case the above methods didn't help, I just deleted .idea file in project and reset the Jetbrain IDE to default settings and it worked normally.
NB: You will loose all your settings and plugins, but if you don't mind this might help as the last resort like in my case.
I am using Jetbrain,
make sure to include all project files in the project. Use Settings -> project structure.
PyCharm > Preferences > Project > Project Structure > Add Content Root
Somehow PyCharm lost the project root directory in my case
For me it was because I had moved a project to wsl by copying the files from wsl to windows. When I switched branches the file must've been open from before and was the windows version of it and not the wsl one.
I noticed this finally by looking on top of the file tab and seeing the path as C:\User...\filename instead of \\wsl$....\filename.
Close your JetBrains IDE, then open a Terminal window and navigate to your project's root folder, and run these 2 commands:
rm -rf .idea
and then
rm -rf .git
NOTE: you'll probably have to connect your project back to your git repository, so if you have any uncommitted changes make sure to commit and push them beforehand to avoid losing them.

Can't see project folders in IntelliJ IDEA

Every once in a while, I open an old project and I can't see any of the folders in the intelliJ project viewer. I can see all the files at the root.. but no folders. Yes I can delete the .iml file and .idea folder and re-create the project, but come on.. there's gotta be an easier way to fix this.
Is there?
If you look in project settings (ctrl-shift-alt-s), you should see a module structure. If you instead see "Nothing to see", do the following:
In Project Structure -> Modules, press the + button,
press enter (since, for some weird reason, it won't let me click on "New Module")
In the window that pops up, click on the "..." next to Content root, find your root folder, and select it
Press ok
ignore any warning that says the name is already in use (or to that effect)
the simplest solution worked from me, just delete the .idea folder
keep in mind this will delete all of idea's current project configuration, it'll create the folder with default settings when reload the project again... but all other configuration will be lost if not properly backed-up
It might be because the project didn't have any modules defined. Try adding existing source code by hitting File > New > Module from Existing Sources and select the parent directory of the project for source code
Go to pom.xml file -> right click -> maven -> generate source and update folders. You will see your files and folder structures in left hand side.
All the project-specific settings for a project opened through Intellij IDE are stored in the .idea folder.
The .idea folder (hidden on OS X) in the solution root contains
IntelliJ’s project-specific settings files. These include per-project
details such as VCS mapping and run and debug configurations, as well
as per-user details, such as currently open files, navigation history
and currently selected configuration.
So, if you are not able to see the project file structure in your Intellij IDE, just delete the .idea folder,
rm -rf .idea
and reload the project, then after reload you'll be easily able to get your project structure displayed.
Thank you very much. I just remove the .idea folder and works in my case.
rm -rf .idea
For me, the java folder was not showing up. I went into File->Project Structure. In the second column, I selected on _main. In the third column, I selected the tab "sources". In what I call the fourth column, where the "+Add Content Root" is shown, I verified, the java source/folder was present. In my case, there was an extra source folder, which was the current location. I removed this, applied and the java folder immediately showed up.
Right click on the Project name -> Open Module Setting -> Check the application context path set it up at your project location.
Check your idea.log -- it may have some details explaining why or what is happening (Help | Reveal log in Explorer). Possibly one of the config files got corrupted.
You can always backup and delete .idea subfolder (project settings) and re-create project from scratch. When it's wroking again (after basic configuration) you may copy some of the files from that folder back to recover some of your settings (if there were many).
This happened to me on a new computer when I opened up a Java project in the newly installed Intellij.
The problem was that I had not installed any JDK on the machine.
I had to install a JDK and then go into the settings at ctrl-shift-alt-s and add a JDK by specifying the folder where I installed it. It's possible that IntelliJ would have found it if I closed it and reopened it.
In my case the solution was to create a new project, specifying the project type and creating it within the same directory path as the project that does not load the project files correctly.
PhpStorm automatically detects that the directory exists and gives you the option to create project from existing sources.
This can be found under:
File --> New project...
For gradle users: "Reload All Gradle Projects" option should help.

Where are IntelliJ scratch files located?

In IntelliJ IDEA 14, we can create scratch files from Tools > New Scratch File...
Are they stored in some temporary files? If the answer is yes, where are they?
Attempts:
1) I pressed right click > Copy Reference and I pasted it:
1d0b26a2/scratch.2:1
2) I opened .idea\workspace.xml and I have the following part for scratch files:
<file leaf-file-name="scratch.2" pinned="false" current-in-tab="true">
<entry file="scratchpad://1d0b26a2/scratch.2">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="636">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
</file>
For a normal file the entry path starts with file:// instead of scratchpad://.
Starting with 14.1, Scratch Files are stored under .IntellijIdea14/config/scratches.
They are displayed either in Scratches and Consoles or on the Scratches tab (depends on the version you are using).
Current UI:
Earlier UI:
IntelliJ IDEA Help - Scratch files
I upgraded my IntelliJ IDEA to 14.1 and I found the scratch files.
If you create a scratch file, its path can be found in many different ways:
On the title bar
Right click on the tab > Copy Reference
You can paste it anywhere and it will look like:
C:/Users/username/.IntelliJIdea14/config/scratches/scratch
Right click on the tab > Rename File...
Right click on the tab > Local History > Show History
In .idea\workspace.xml it looks like:
<file leaf-file-name="scratch" pinned="false" current-in-tab="false">
<entry file="file://$APPLICATION_CONFIG_DIR$/scratches/scratch">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="4" column="17" selection-start-line="4" selection-start-column="17" selection-end-line="4" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
</file>
You can switch to project view and you'll be able to see them under "Scratches and consoles"
~/Library/Application\ Support/JetBrains/IntelliJIdea2020.1
for macOS this is the location of both
database consoles (all the neat little db helper scripts)
scratch files (stored as plain files, a scratch you created in your idea app under the name scratch.py you will find in this directory as scratch.py)
To migrate your scratches, you just need to copy over these directories to your new environment under the above mentioned path.
However, please mind that this works for IntelliJ version 2020.1 on macOS. I'm not 100% sure where earlier versions used to store scratches and on other operating systems.
Here's another solution if you can't find your scratch files in the Scratches tab as #fnt suggested (which normally is the most convenient way probably).
In my case, I've recently updated my editor from PhpStorm 2018.1 to PhpStorm 2018.2. The scratch files are saved along with all preferences in a path specific to each version of your editor. In case of MacOS it's ~/Library/Preferences/PhpStorm2018.2.
This means that when you update your IDE, it starts using the new path and it doesn't see your old scratches anymore. If you still need to open them, simply navigate to path specific for your OS and all you're scratches are there.
All paths, are listed in official docs.
Opening accidentally closed scratch files can be easily done with Cmd-E, which shows the "Recent Files" popup. Closed scratch files show up there.
#rolf wrote this comment and I want to promote it as the answer here cause it's not already written. But the best way is to
Opening accidentally closed scratch files can be easily done with
Cmd-E, which shows the "Recent Files" popup. Closed scratch files show
up there. – Rolf
Thanks rolf!