英文:
How to copy search results in IntelliJ to paste them elsewhere?
问题
我想提醒我的团队调试时使用的端口,用于多个项目。
在一个目录中使用Ctrl-F
,我在我使用的_IntelliJ 2021.1.3 Ultimate_下获得了我的结果,
但是我无法像这个窗口上那样将它们粘贴,无论是使用Ctrl-C
还是Ctrl-Ins
,到另一个位置,以便将邮件发送给我的团队成员。
是否有某种变通方法,或者这个功能已经在我应该尝试升级到的更高版本中实现了?
英文:
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?
答案1
得分: 4
我认为没有简单直接的方法来实现你想要的。但是,有一个变通方法:
- 运行你的搜索,然后从在文件中查找窗口点击在查找窗口中打开按钮:
- 在列出出现次数的查找窗口中的任意位置右键单击,然后从上下文菜单中选择导出为文本文件:
- 一个导出预览窗口将打开,以扩展的分层形式显示搜索结果,反映了你搜索的目录下的结构。在那个窗口中,你可以选择任何连续的文本部分,然后右键单击并从上下文菜单中选择复制:
- 然后你可以将所选的文本粘贴到任何其他窗口中,并根据需要修改结果:
注意:
-
这只是一个变通方法,因为不幸的是我看不到直接复制你的屏幕截图中显示的结果的方法,其中每一行都显示了一个搜索结果和它的文件位置。这些信息仍然在复制的文本中,但可能需要一些努力才能以你想要的形式呈现出来。
-
导出预览窗口中的复制按钮会忽略任何文本选择,盲目地复制一切,如果选择文本的子集,请改用上下文菜单中的复制。
-
我使用的是IntelliJ IDEA 2023.1 EAP(Ultimate Edition)。我不知道在你的版本中是否存在这个功能。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论