Double files in "Local changes" window - intellij-idea

My IntelliJ Idea shows me double files in "Local changes" window.
I opened workspace.xml file and in fact, entries are doubled like this:
<change afterPath="$PROJECT_DIR$/ws/MyFile.scala" afterDir="false" />
<change afterPath="$USER_HOME$/someDirectory/ws/MyFile.scala" afterDir="false" />
Two entries, two different paths, the same File!
How can I fix that?

Ensure that only one directory is associated with the version control at Settings (Preferences on macOS) | Version Control in the IDE.

Related

How do I configure Beyond Compare (BC4) to "Open with... Parent Folder" in Windows Explorer for a selected file in Windows 10?

How to Configure BC4 to "Open with... Parent Folder" in Windows Explorer for the selected file(s) in Windows 10
I use Beyond Compare (v4) many times per day, because it offers features that Windows Explorer or Finder do not for sizing folder contents, synchronizing file systems, etc. I frequently need to open the containing (parent) FOLDER for the selected file(s) displayed in BC4 Folder Compare.
Presently, I navigate to the folder containing the file for which I want to open parent folder, but then I must navigate upward and right click and say "Open with ..." and select "Associated Application". These are extra time consuming steps, because I may do this several times per day.
I want to configure an "Open with..." option to open the file's parent folder (in Windows Explorer), NOT the viewer or editor for the selected file(s).
I tried various options, but cannot get it to work. If I set the "Command Line" parameter to Windows Explorer executable (Explorer.exe) by itself, it does not work.
I tried the %P (relative path) and %p (absolute path) with the the or selected, but it did not work.
QUESTION: How do I configure this mouse right-click option to open the file(s) parent folder, and also assign a keyboard shortcut in Beyond Compare 4?
ANSWER: Through trial and error I figured out what the exact syntax and parameter settings are for the fields "Command Line", "Working Folder" and "Accepts Files" and "Accepts Folders" options.
> Description: Folder in Windows File Explorer
> Shortcut: Alt-F Command
> line: C:\Windows\explorer.exe %P <<< enter this without quotes >>>
> Working folder: BLANK Accepts file: CHECKED Accepts folders: CHECKED
> Multiple instances: CHECKED <<< opens only one Explorer, multiple files can be selected.
The relative path (%P) argument is needed alone (WITHOUT THE FILENAME OR FILE EXTENSION) on the command line to get this to work.

Show .idea folder in PhpStorm project tool window

PhpStorm hides the .idea folder in the project tool window by default. However, I'd like to show it in order to inspect the files and add/edit a .idea/.gitignore file to include and exclude specific files from version control. I have searched for project configuration options in order to unhide the .idea folder, but haven't found a way.
I could just use another editor to manage the files in the .idea folder, but I'd like to use the git-integration of PhpStorm to manage these files.
For .idea there is dedicated registry setting for it as well (it is enabled by default for me, in PhpStorm at very least)
Help | Find Action... and look for registry (or via Maintenance Ctrl+Alt+Shift+/ on Windows using Default keymap)
Once inside -- look for projectView.hide.dot.idea entry
Adjust accordingly (before leaving window -- ensure that new value is accepted properly -- e.g. focus another entry)
Took from
As of PyCharm 2022.2.2, this does not appear to work. After trying various ways of unhiding the .idea folder I had hoped this would be it.
edit:
While the registry setting did not work, removing the .idea folder from the Settings/Editor/File Types/Ignored Files and Folders did work!

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!

Is there any way for Intellij to bold or highlight directory that has file changes like Eclipse

Is there any way in Packages or Projects pane to highlight or bold directories/path that has local file changes (diff from VCS repository). Eclipse has this.
I know there is a way to get all the changes if I change the pane to Changed files.
Settings -> Version Control -> Show directories with changed descendants.
On new version of IDE, this settings were moved to:
Settings -> Version Control -> Confirmation and enable "Highlight directories that contain modified files in the Project tree"

Disable intellij indexing on specific folder

In my project I have .deploy folder which is created/updated when I deploy my app locally. Is it possible to disable indexing on that folder? Everything slows down whenever I deploy and it's really annoying - I have to wait a few minutes whilist intellij doing unnecessary indexing. In module view I excluded that folder but it's not helping. Any help would be appreciated.
Mark this folder as Excluded in the File | Project Structure | Modules | Sources tab.
Edit: also make sure it's not added as a library in the project.
On IntelliJ 13+ (don't know for earlier versions), you can right click on a folder > Mark Directory As > Excluded.
if you cannot do it throu the Modules menu because your intellij freezes (like in my case) edit .iml file of your projet and add excludeFolder line as below:
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/features" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/node_modules" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
The option is now called Stop/Start Index, available from the folder context menu in solution explorer. When index is stopped, the folder will appear with "no index" annotation on the right.
I excluded the build output folder and no longer getting lengthy index refreshes after each build. Also full text search is a lot faster (near instant).
After applying the Mark As > Excluded method to a folder you still might see unwanted results.
You have to explicitly mark sub-folders as well to disable certain functionalities for sub-folders.
indexing, find usages etc.
Sometimes it is not possible to mark the folder as excluded. It happens with direct node dependencies.
For that, it's a bit extreme but you can add it to Editor-> File types -> ignored file types and folders. It won't be indexed at all. It won't be shown in the project either