How to copy search results in IntelliJ to paste them elsewhere? - intellij-idea

I would like to remember my team the ports used for debugging, for several projects.
A Ctrl-F in a directory, and I have my results under IntelliJ_2021.1.3 Ultimate I'm using,
but I have no way to paste them, like they are on this window, either with Ctrl-C or Ctrl-Ins , on another location in order to send a mail to my teammates.
Does a workaround exist, or has this feature been implemented in a later version I should try to upgrade to?

I don't think there is a simple and direct way to do what you want. However, there is a workaround:
Run your search, and then from the Find in Files window click the Open in Find Window button:
Right-click anywhere within that Find window listing the occurrences, then select Export to Text File from the context menu:
An Export Preview window will open, showing the search results in expanded hierarchical form, reflecting the structure under the directory you searched. Within that window you can select any contiguous portion of text, then right click and select Copy from the context menu:
You can then paste the selected text into any other window, and massage the results as necessary:
Notes:
This is only a workaround because unfortunately I don't see a way to directly copy the results in your screen shot, in which each line shows a both a search occurrence and its file location. That information is still in the copied text, but it may take a bit of effort to get it in the form you want.
The Copy button in the Export Preview window ignores any text selection and blindly copies everything, so use Copy from the context menu instead if selecting a subset of the text.
I used IntelliJ IDEA 2023.1 EAP (Ultimate Edition). I don't know whether this functionality exists in your version.

Related

Possible to manually trigger automatic source code formatting in STM32CubeIDE?

I use STM32CubeIDE version 1.6.1, and have noticed that CubeMX outputs formatted code (e.g. indented with 2 spaces). I would like to reapply this source code formatting manually (that is, manually trigger the source code formatting on selected files).
I have found this post: https://www.openstm32.org/forumthread6435 , which mentions:
go the preferences dialog and select C/C++ > Code Style > Formatter
click on “Edit...” change the tab size field. close the preferences
Then, select all the project you want to apply it, click right and select “Source > Format”
So, I'm not 100% sure the above quote refers to STM32CubeIDE, however, the first part is still there, in Window/Preferences I can get to this:
However, I cannot see how to trigger this source code formatting manually, on selected files. For instance, https://dvteclipse.com/documentation/e/Format_Multiple_Files.html for Eclipse (that STM32CubeIDE is built upon), mentions that by right-clicking source files, one can call the command "Format Source Files"; however, when I click my main.c in the STM32CubeIDE Project Explorer, I cannot see anything like that:
So, is there a way to manually trigger automatic source code formatting on selected (single or multiple) source code files in STM32CubeIDE?
Got it, finally - when you right-click the Core node, or any of its children, in Project Explorer in STM32CubeIDE, you get a "Source >" entry in the right-click context menu, which has only one child, "Format":

Intellij show possible merge conflicts before actual merge

I have a file that was changed in one branch and renamed in another (but from comparison perspective it was deleted). I use IntelliJ for merging. When I merge the branch where the file was changed into the one where it was deleted, in the merge window the IntelliJ shows two panels one for the deleted file which is obviously empty and the other one for modified file with changes highlighted in darker pink.
I need to add these changes to my renamed file. And I can do it manually, np, however I cannot keep the merge/comparison window open. It must be closed before I can do any code modifications.
My question is: is there a way to get the same kind of comparison with possible merge conflicts highlighted before the actual merge.
IntelliJ relies on the command-line git and needs git to attempt the merge before it can show you the merge dialog. So, unfortunately, it is not possible to get the merge dialog without starting the merge.
However, it seems that to solve the task you only need the merge dialog to be non-modal - here is the request for it in JetBrains tracker https://youtrack.jetbrains.com/issue/IDEA-66552
Using version IDEA 2021.3.3 (Ultimate Edition), I am able to open a merge non-modally by:
When the merge dialog appears, click Cancel
Open the Git view
Click on a changed file in the Local Changes tab.
This initially shows the merge diff in the side pane of the Git view.
To open the merge diff in the main editor area, right-click on the file (in the Local Changes tab) and select "Show Diff".
This will open the merge diff in the main editor area.

Intellij vcs plugin, view changed files AND file changes in the same window

I normally do git diff for this but want to leverage the intellij gui.
The Version Control tab just shows me all the files that changed:
To view the actual changes I have to select a file and choose "Show Diff".
This opens another window. Now from this other window if I want to see changes for another file I have to click this button then open the other file:
I don't like that. Is there a way to have this in the same pane? Where on the left I see a list of the changed files and I just have to select the file to see its changes? Otherwise its very clunky and unusable for being able to see a tree of changed files and selecting the one's changes I want to see
Just found it, I wanted "preview diff"

Howd do I toggle between 'previous searches' inside intellij, in other words, past 'find usages'?

In Eclipse, there used to be a drop-down where i could click on 'past searches' so i could toggle back and forth between various search-history-results sets, is this possible in InteeliJ?
Whenever you search you have a check box of "Open in a new tab". If you do that then the results aren't overridden by a new search.
Right-click the Find view: there is an item named Recent Find Usages (You can also go to it using CTRL+E when you're in the Find view). Usually, CTRL+E is the contextual way to access history.
Please note that it doesn't save the results, but only the query. In other words, it executes the search again each time you use it.
Also note I'm using IntelliJ 10.5.2, not sure about older versions.
In the most recent versions 2019 you either need to right click on search window to get past search results or use shortcut "alt+down" to pick from dropdown list.

Enabling tabs in xcode? Or lessening the pain of not having them?

I am currently using xcode and I find it's lack of tabs quite disturbing.
I currently use command-shift-d to search through all the files, or ctrl-1 to open the history of files that were recently opened.
It works but I find it less effective than just tabbing through the few files i am currently working on.
Is there any way, third party or not, to enable some sort of tabbed organization?
If not, is there any other way to quickly navigate through a subset of files?
XCode 4 now supports tabs. You can enable by selecting "View / Show Tab Bar" menu.
Not really, but one alternative is View > Show Favorites Bar and drag five or six frequently-used source files into it. Not as flexible as tabs but satisfies your request for "quickly navigate through a subset of files".
The traditional way is to use the detail view. Get the files you want in the Detail view by one of these means:
Put them all in the same group, then select the group
Enter a filter expression in the Search Bubble that narrows the items shown
Define a Smartgroup that includes just the files you want
Get a list of the files as a Find in Project result, then select that item in Find Results
Then you can use the Detail View as your list of interesting files and navigate through it quickly with the up and down arrows.
First of all, you can use Textmate (which I believe has Xcode integration). Otherwise:
Window (Menu) -> Organizer (ctrl-command-o)
At the bottom of that window, if you don't have two panes, click the square to the right of the gear. Now drag code files of interest to the left, grey pane--a single click or arrow up/down will open the file in the editor pane.
If you do open a bunch of windows, as vog suggested, you'll need to command-~ through them--not alt-tab.
Cheers.
The Xcode source code editor allows you to choose the file from a list. It's two clicks instead of one (as it would be with tabbing), but it's better than nothing.
In addition, you can simply Alt-Tab through your open source code windows. This is not slower than tabbing, and has the same effect since the source code windows are usually placed exactly one in front of another.
You'll definitely want to read through this. (XCode Tips and Tricks you wish you know about two years ago - SO)
You can navigate between files using "Recent Files"
Write simple applescript:
tell application "Xcode"
tell application "System Events"
keystroke "1" using {control down} -- open "Related Files"
key code 125 -- choose "Recent Files" ("keystroke down" doesn't work)
keystroke return -- enter to "Recent Files"
key code 125 -- choose previous file
end tell
end tell
And bind it to some shortcut using for example FastScripts(free up to 10 bindings)
I have this script on "Control" + "`". (XCode 4)
Hope this will help
You may also try an Xcode plugin I've just released - it's called Code Pilot and solves a lot of issues of Xcode's navigation, making it more TextMate/Eclipse-like.
Check it out here: http://macoscope.net/en/mac/codepilot/
I hope this helps!
It is simple with XCode 7.2
GoTo View>>Show Tab Bar
This will show the tab bar.
RightClick on the New Tab and click -->"NEW TAB"
Then We can see all the files in tabs.