Refactor rename broken in Intellij IDEA - intellij-idea

Somehow, I managed to break my refactoring capabilities in Intellij IDEA 12. I have somehow disabled it for my project. Renaming a member through Shift+F6 doesn't work. The inline edit box is not drawn, nothing happens.
I know of the refactoring settings in Settings -> Editor, Enable in-place mode and Preselect old name are both checked.
It has to be some kind of project setting. I checked by creating a test project, adding some member and renaming it, which works perfectly.
What setting am I looking for? Or could my project be broken?

There is no way to turn refactoring off in the settings. My guess is that the project's cache/indexes are corrupted. I had a case once where refactoring, especially renames, stopped working. A re-index solved it for me. Go to File >Invalidate Caches, invalidate your caches, restart IDEA, and let IDEA re-index the project (progress is shown in the bottom status bar right of center). Then try the refactoring.
If that does not solve it, take a look in the logs (Help > Show Log) and see if there is any indication in there as to the cause of the issue.

Fo all the MacOS users, do not forget to access Settings -> Keyboard and turn on the flag for the option Use all F1, F2, etc. keys as standard function keys. E.g.:
Otherwise IntelliJ will not get the focus to use the F4 key.

Following step worked for me:
From your IDE, go to: Preferences -> Project Structure -> Add Content Root, then select the folder you want to use.

None of the above steps worked for me in IDEA 2021.2.4 (Ultimate Edition). I got the following error message when trying to rename a file and its usages:
Cannot perform refactoring. Selected file is not located inside the project.
Instead, I had to create a new module.
File > Project Structure > Modules > Add (+) > Import module > Select <root_folder_of_your_project>
This reindexed the whole project, which took a couple of minutes, and restored the Refactor > Rename functionality.

waite for some time it can be due to running Indexing

Related

Why can't I rename package in intellij idea?

Why can't I change package name in intellij idea?
I want to change "java" package to something else, for example "junit" or "jtests":
But when I select Refactor -> Rename I wind up with the dialog window:
then I select Rename current, in the next window I enter desired package name:
and then, no matters whether I click Refactor or Preview button, nothing happens. Nothing at all: no errors, no warnings, no actions. Why can't I rename this package?
It seems to be a bug of IntelliJ IDEA. I found the solution on JetBrains forum. By invalidating the cache and restarting, I got the ability to rename this package.
For me invalidation didn't work. I made a new package and temporarily moved the classes out of the package I wanted to rename. It would disapear when I would rename them, so I would create them again.
Just a bug in intellij. Invalidate the caches and restart. Here's how, it's easy.
Only folders under java are part of the package qualified name.
Example:
If you have a file in a folder located under app/src/main/java/com/my/package then the package will be com.my.package
So, you only want to change folders under java.
However, regarding the "com" folder, the IDE does not provide an option to refactor package name. In this case, you need to manually rename all code occurrences of the old folder and invalidate the cache after renaming the folder.
File > Invalidate caches... > Clear system
For me it was due to memory problem, after increasing memory (heap size) it solved.

Intellij no longer showing "Compare" and "Compare with Local" in VCS tab

I have been using the various compare options frequently but now they do not appear in any project. Restarting intellij has not resolved the issue.
Has anyone else run into this and discovered a solution? Note in the following screenshot:
( a ) The Compare with Local is not shown
( b ) The git options should come up immediately : not in a nested popup.
Update For those who wonder about Compare with local wrt VCS (/git):here ya go..
Diff with local seems to provide the same behavior as Compare with local. To access that feature I had to add keystroke to the Keyamp.
It is beyond strange that the above behavior / problems just suddently popped up. I went ahead and nuked the project and rebuilt it- but no help
The screenshot has all the Compare options in there.
Not sure, but probably you mean the IDEA-171150 issue.
UPD. Compare with local is the action of FileHistory, and it is still there, e.g. for Subversion History
Local changes tab never had this, Git Log and new Git History do not have such now. It is now called Diff with local.
It is not possible to assign a shortcut for the Show Diff with local at the moment, unfortunately. There is a request opened to allow choosing the default behavior: https://youtrack.jetbrains.com/issue/IDEA-82019

Visual Studio 2015 RC missing using option in quick actions

I have no idea what changed, but either using Ctrl+. or right clicking to bring up the quick actions in VS2015 RC (14.0.22823.1) on a token that I haven't added the right using statement used to give me an option to automatically add it for me, along with options to create a new class and a few other things.
The last couple days it's no longer giving me the option to add the using statement for me (I use this shortcut all the time). It still has all the other options.
Anyone else run into this? I recently installed Web Essentials 2015.0 RC and Code Maid (code maid was causing problems so I removed it). Could one of those affect it?
I just had the same problem and solved it by renaming the .suo file in ProjectName\.vs\ProjectName\v14 to something VS will not find, like .suo.bak.
This will reset your project specific preferences, like open files, solution explorer state etc. Make a backup of the file or rename it so you can go back if you are missing something important.
If everything works afterwards you can simply delete the renamed file, VS will create a new one.

How to delete projects in IntelliJ 12?

I created some dummy projects. Now I don't see any way to delete the projects that I don't want. Per this suggestion I can delete files, the project is going away but there is traces of it still available. For example, on the Recent Projects you can still see the name of the project you just deleted. So I am thinking there should be another (and really easy way) to delete a project.
Press the Del (or fn and delete) key to delete a project from the Recent Projects list.
Vote for this issue to make it more obvious and user friendly.
close project first, or until this dialog appear, then hover your mouse on project you want to delete from history, then press Del
you'll be asked for confirmation
On occasion, even with deletion of the project, some tidbits are left behind in the following Windows paths:
C:\Users\username.domain\.IntelliJIdea2017.1\system\compiler
C:\Users\username.domain\.IntelliJIdea2017.1\system\compile-server
C:\Users\username.domain\.IntelliJIdea2017.1\system\frameworks\detection
C:\Users\username.domain\.IntelliJIdea2017.1\system\conversion
C:\Users\username.domain\.IntelliJIdea2017.1\config\componentVersions
C:\Users\username.domain\.IntelliJIdea2017.1\config\tasks
This has been proven to be problematic - for example, if a new project is created using a previously deleted project name, it will create the project with data stored in the above paths, at least, this has been my experience.
The only way to TRULY delete the project is to get rid of all the garbage left behind in the aforementioned folders. I would suggest using Search Everything to find more tidbits left in the users temp folders.
In case your project is imported as a module, you can also go to File --> Project Structure and click 'Modules' in the left section. Now you can hit the minus button to remote the module from the project.
You can also click File -> Open project ...
When a file menu appears, you can right click the unwanted project folder and select Delete.
Just figured, I am using Idea Community edition 13.1.1 and the cleanest and easiest way is to go to File > Reopen project > Clear List. I just stumbled upon this menu today. I always thought that is just to clear the latest projects from the view inside the IDE and just realized it is clearing the projects from the main Dialog too.
-VRS
Also, in IDEA 13.x.x you can go File-> Close Project and you'll land in the window with Recent Projects tab. There pressing Del of Fn + Del on selected project helps .
On OSX Mountain Lion and IDEA 14, with the project open and focused, you can go to file -> close project, then delete the project from your filesystem. This removed all references to the project.
Note that if the project you are deleting is the only project open, closing it will show the welcome dialog, which will still show the project. Deleting the project manually from within your operating system is the next step, and the project will still appear in the welcome dialog until it is closed and shown again, usually by opening another project from the list, or quitting and restarting IDEA.
In my case, I had to delete home/.IntelliJIdea2017.2/config/options/recentProjects.xml
. In my file system (Ubuntu) this file appeared for some weird reason not writable and hold a list of projects I couldn't get rid of. Deleting this file and restarting will force Intellij IDEA to create a new one with an empty list of projects.
All you have to do is go to file - close project - to avoid seeing them again in the menu list and then you delete them from the projects directory.

Xcode 4 code loses syntax coloring when importing project from Xcode 3

I have just upgraded to the new Xcode 4 and the code is not colored has it should be.
I am trying to use a project that I created on Xcode 3.
For instance, the string 'NSString' is not colored in my custom code, but when I switch to Apple's code (NSString.h for ex.) everything is well colored.
How can I fix that?
Thanks a lot,
Martin
Open the Organizer (Window > Organizer) and select the Projects mode. Select your project in the left-hand view and then click the Deleteā€¦ button for the project's Derived Data.
This will delete the code sense index for the project and force Xcode to rebuild the index, which should fix the problem.
I got it to work by prefixing all my project search paths with "$(SOURCE_ROOT)/" instead of just using a project relative path. Eg "Include" becomes "$(SOURCE_ROOT)/Include".
Do this and then force a rebuild of the index by deleting the projects derived data from the organizer.
After trying most, if not all, of the steps above, I have succeeded in restoring my colorful Xcode eye candy by finding and deleting (in Finder) all of the derived data created from my project (there were several folders for my project that were lingering even after deletion from the Window > Organizer menu).
My project's folders that needed deletion were located in ~Library/Developer/Xcode/DerivedData
Also try this, select all(command + A) from your Prefix.pch file -> cut it(command + X) -> Build(command + B)(don't worry for error) -> paste(whatever you copy from Prefic.pch file in that file only)(commmand + V) -> Build again (command + B).
Try Product -> Clean and then Product -> Build
Remove the files from your project (just remove, don't delete them!) and re-import them.
Its possible that the permissions on the folder where Xcode stores the code-sense cache is broken. If the cache cannot be correctly written or read when you launch Xcode, it will behave as you describe.
Try locating the folder (you can locate it in the organizer. Hit the arrow next to the path.) and reset its permissions in the Get Info dialog.
There is another cause for this issue, it had been happening to me with beta versions of Xcode, you need to check that the .m file is added to the target in order to make it add color to the classes and enable the autocompletion.
You can check it out in the Xcode inspector
Hope this helps,
best regards,
Jorge.