Is there any way to save breakpoints in IntelliJ and restore later? - intellij-idea

Can I define a set of breakpoints, and save this definition in IntelliJ and restore later on?
Like I have breakpoints at line 40 and 50 for Class A. Can I save them, and later restore in any way?

You can find all breakpoints in project-dir/.idea/workspace.xml -> <component name="DebuggerManager">. You can save their manually.

You cannot save/restore breakpoints in IntelliJ, but if you want to work with different "groups" of breakpoints in different situations without having to enable/disable or delete them one by one, you can do that in the current version (IDEA 2016.3.1).
You can create named groups of breakpoints and enable/disable them as a group with a single click.
https://www.jetbrains.com/help/idea/2016.3/working-with-groups-of-breakpoints.html

This feature is currently not available (not even in Intellij Cardea EAP).
However, there is an IDEA feature request up for this: http://youtrack.jetbrains.com/issue/IDEA-15540.
Want to up-vote the feature request ?

On Android studio you can select multiple break points -> Right click -> Move to group -> new breakpoint group.
After this you can enable/disable entire group just like importing previously saved breakpoints.

In ver14 component name is XDebuggerManager.
You must be careful about the breakpoint url, especially the path must have variable $PROJECT_DIR$.

Since year 2021 you can do it by IDEA plugin Breakpoint Manager.

Related

PHPStorm Live templates not expanding

I've just started to play araound with PHPStorm and I can't get the live templates to work. For example there's one for a public function..'pubf' then tab to expand however when I tab mine out it looks like this...
<pubf></pubf>
What's going on? Is there a setting I need to enable to get it to work?
Thanks
Just for a little more clarity:
Even though you're under the PHP branch, you still need to apply the abbreviation to an application. Click the "Define" link and check the PHP box.
It was a question of scope for the template, just needed to select the appropriate file types.
Try:
Settings / Emmet and changing the default 'Expand abbreviation with' from tab to say custom
Make sure the context is selected underneath your template text. There is a small 'Change' link there where you set the context. I had to choose all contexts.

Refactor rename broken in 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

IntelliJ - Delete list of previously opened projects?

Is there a way in IntelliJ IDEA to delete previously used projects? I am referring to a list on the main page when the application starts. Please look at the image.
File -> Open Recent -> Clear List
Edit: For versions of 2016+ this is no longer available. Use This solution: File -> Open Recent -> Manage Recent Projects / Startup Dialog, ctrl+a (select multiple with ctrl+click) -> del
File -> Open Recent -> Manage Projects .... CTRL-A then Delete to remove all, or hit the X to remove individual.
IntelliJ IDEA 2016.2.5
Locate config\options\other.xml file and manually edit the list of recent projects inside the XML under <component name="RecentProjectsManager"> node.
There is no way to remove individual projects from the UI. See Dan's reply otherwise.
In IntelliJ15, you can remove them from welcome screen, works ctrl+a and then remove all of them.
In MAC, ~/Library/Preferences/IdeaIC14/options/recentProjects.xml is the file to easily edit the list when you do not want to lose everything. (It is for IdeaIC14).
In idea 2022 for MAC it is located under ~/Library/Application Support/JetBrains/IntelliJIdea2022.3/options
In Idea 2019 it is located in Idea Colder\config\options\recentProjects.xml
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
Close all projects till you reach the welcome screen. Right click on the project and choose Remove Selected from Welcome Screen. Or click on the cross arrow on the upper right corner of the selected project.
idea22 on windows10 system, recent projects on the path C:\Users\****\AppData\Roaming\JetBrains\IntelliJIdea2022.3\options\recentProjects.xml, I delete all the <entry><\entry> labels

Is there a way in Intellij IDEA to see the name of the method the current line belongs to?

In our code base there are a few very long methods (several pages worth of code). When reading the code, it would sometimes be good to be able to see the name of the method the current line belongs to, without paging up to the beginning of the method. Is this possible in Intellij IDEA? I am using Intellij IDEA 7.0.3.
You can use View | Context Info (Alt+Q, Ctrl+Shift+Q on Macs). It will display a pop-up on the top of the editor with the current context information (class/method signature).
IntelliJ 2018
This is shown by default at the bottom.
Unfortunately, the method is shown only by name (not including the parameters). If a method is overloaded you won't know for sure where you are.
If you want to move it from bottom to top, go to File > Settings... > Editor > General > Breadcrumbs > check Top:
In the structure panel select the "Autoscroll from source" option.
This way when you place the cursor inside any method the structure panel will show which method you're in.
Intellij now has support for breadcrumbs. Go to settings > appearance and tick "Show breadcrumbs". In this way you can view class/method name without Alt+Q.
For some reason (Alt-Q) wasn't consistent in Android Studio for me. I find (Ctrl-F12) to be pretty satisfactory for this purpose (Navigate|File Structure) though it can be a little laggy in larger files. And by pressing the hotkey again it will populate the list with all the inherited methods as well.

Watching variables in SSIS during debug

I have a project in SSIS and I've added an Execute SQL Task which sends its result out to a variable. I wanted to confirm the value because I was worried that it would try to write it out as a resultset object rather than an actual integer (in this case I'm returning a COUNT).
My first thought was just to run it in debug mode and add the global variable to my Watch window. Unfortunately, when I right-click on the Watch window, the option to "Add Variable" is greyed out. What am I missing here?
I've gotten around confirming that my variable is set correctly, so I'm not interested in methods like putting a script in to do a MsgBox with the value or anything like that. For future reference I'd like to be able to watch variables in debug mode. If there are some kind of constraints on that then I'd like to know the what and why of it all if anyone knows.
The help is woefully inadequate on this one and every "tutorial" that I can find just says, "Add the variable to the Watch window and debug" as though there should never be a problem doing that.
Thanks for any insight!
I believe you can only add variables to the Watch window while the debugger is stopped on a breakpoint. If you set a breakpoint on a step, you should be able to enter variables into the Watch window when the breakpoint is hit. You can select the first empty row in the Watch window and enter the variable name (you may or may not get some Intellisense there, I can't remember how well that works.)
Drag the variable from Variables pane to Watch pane and voila!
I know this is very old and possibly talking about an older version of Visual studio and so this might not have been an option before but anyway, my way would be when at a breakpoint use the locals window to see all current variable values ( Debug >> Windows >> Locals )
Visual Studio 2013: Yes to both adding to the watch windows during debugging and dragging variables or typing them in without "user::". But before any of that would work I also needed to go to Tools > Options, then Debugging > General and had to scroll right down to the bottom of the right hand pane to be able to tick "Use Managed Compatibility Mode". Then I had to stop and restart debugging. Finally the above advice worked. Many thanks to the above and to this article: Visual Studio 2015 Debugging: Can't expand local variables?