How to search through TODO comment list in IntelliJ IDEA? - intellij-idea

I'm working on a huge project that has thousands of TODO items. So when I go to the TODO tool window in IntelliJ IDEA it shows all of them. How can I search for a specific one?

If you want to define which TODOs should be found, you are able to set filter and patterns.
In TODO panel click on Filter TODO Items and select Edit Filters
Here you are able to set filters and patterns which should be used. More about that is on their site https://www.jetbrains.com/help/idea/2016.2/defining-todo-patterns-and-filters.html.
Keep in mind that after you define a new filter, Intellij will start with Indexing (long proccess for huge projects:( )
Also Intellij IDEA TODO tool lets you select from which part you want to see a TODOs (top bar on uploaded image) or you can simply show all TODOs and start typing (classic searching).

First, expand all the todos (view the side menu or by pressing CTRL+numpad +. Then just start typing, and IntelliJ will take you to the first place the string you searched for appears, be it a name of a folder, file or the text of the todo comment itself. Like any other search in IntelliJ, you can use the ↑ and ↓ keys to jump between items matching your search string.

If you are using a mac, keys ⌘6 (command key and number 6 key) will do the magic.

Press alt+6 to search *TODO* comment.

You might also want to view only the TODOs you have added in your current branch. You can use the Default Changelist tab for this:
The Scope Based tab also gives you some useful options for narrowing down the TODOs too:

This is not the exact answer to the given question, but it helped for me, so maybe it will also help someone else :)
What I haven't notice earlier is that TODO Tool Window/tab has some child tabs on the top. For me, the most usefull one, was the tab „Current file”. I was made aware of this feature after looking in official IDE documentation:
https://www.jetbrains.com/help/idea/todo-tool-window.html

Related

How to undo in Intellij IDEA replace in files?

In intellij 2022.1, I use Ctrl+Shift+R to bring up the Replace in Files window - it shows 100+ matches in 40+ files. The search string and the replace string differ in only one character, for example: this.bar.is.fooed and this.barf.is.fooed. I only need to replace certain instances based on nearby text.
I'm in the groove, clicking the Replace button, checking the next entry, clicking, checking, ... and thinking my brain can keep things straight (it can't; neither can yours:-) I'm halfway through when I realize the last few replaces were wrong.
How can I undo them? Ctrl+Z is grayed out. This related SO question doesn't say and neither does the JetBrains documentation!
Use Local History to revert the changes.
Undo/redo is not supported for Replace dialog, vote for the related request.

How to make my own Code abbreviation in intellij idea

in IDEA ,I can type soutto represent System.out.println();and I want to know how to make my own code abbreviation.For example, alias System.out.print(); to sounor any other names
This is called a Live Template in IntelliJ.
Go to File > Settings > Editor > Live Templates. From there, select Java and on the right, you'll see a plus sign. By clicking it, you'll get a 1. Live Template and that will get you a new abbreviation.
Name it soun and the text should be
System.out.print($END$);
Once you're done, make sure you've enabled that abbreviation by clicking the check box next to it.
The docs of IntelliJ cover in detail what the syntax is for these templates.
The $END$ syntax indicates the position of the cursor when the code snippet is complete, and you can no longer press Tab to jump to the next variable.
There are more variables to look at as well and other configurations to do!
Edit: there is an answer here for this question, but it looks like it doesn't necessarily answer the question asked on that post, so that's why I've decided to post a dedicated answer (tackling the issue at hand).

How to list all suggested quick actions

Is there a way to list all the suggested Quick Actions for an open project in VS2017 (v15.3.3)?
I do not see any listed in the Error List window (even with "Build + IntelliSense" selected), though I do see other types of IntelliSense warnings such as CS warnings (e.g. CS1591).
(Quick Actions being the items that are marked in the gutter with a light bulb and accessed with either Alt +Enter or Ctrl+.)
Thanks to a response from the #VisualStudio twitter account, I've come across this MS Docs page that answers this question: https://learn.microsoft.com/en-us/visualstudio/ide/code-styles-and-quick-actions?utm_source=t.co&utm_medium=referral
It describes how to set code style preferences by opening the Tools > Options window and selecting Text Editor > C# / Basic > Code Style > General.
Here there are a list of the code style preferences. To see where they are suggested in one's own code the severity of each can be changed, say from "None" to "Suggestion" or "Warning". Then, during a build, the locations for the related style will be listed in the Build Output or Errors windows
This isn't exactly the same as what you're looking for, but could help you make changes much more quickly to the entire document, project, or solution:
When you try to apply a quick action (using Ctrl + .), you'll get a preview of the changes it will make. At the bottom of that preview is a button that says
"Apply to all occurrences in ..."
This will save you from having to go to every single occurrence in a certain scope and fixing it, which is what I've done for a couple of hours now :(

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.

IntelliJ Idea - search for a value in debugger

I need to know if it is possible to search for a value in debugger in IntelliJ Idea.
Example: you have a huge object tree and you need to find string variable that is set to same particular value.
Is there any way to do that?
Expand this tree so that you see all those strings, and start typing what you search for. The speed search should do the rest. To get to the next/previous results press the down/up arrows respectively.
Sorry to disappoint you, I don't think that this option exists.
The quick search will only look for values in expanded objects.
You can use some other tool to create a memory dump of this object, and look for your data there.
In the "Find action ..." menu, you select "Fully expand tree node" or use Numpad *