如何将IntelliJ中的搜索结果复制以粘贴到其他地方?

huangapple go评论44阅读模式
英文:

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,

如何将IntelliJ中的搜索结果复制以粘贴到其他地方?

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中的搜索结果复制以粘贴到其他地方?
  • 在列出出现次数的查找窗口中的任意位置右键单击,然后从上下文菜单中选择导出为文本文件
    如何将IntelliJ中的搜索结果复制以粘贴到其他地方?
  • 一个导出预览窗口将打开,以扩展的分层形式显示搜索结果,反映了你搜索的目录下的结构。在那个窗口中,你可以选择任何连续的文本部分,然后右键单击并从上下文菜单中选择复制
    如何将IntelliJ中的搜索结果复制以粘贴到其他地方?
  • 然后你可以将所选的文本粘贴到任何其他窗口中,并根据需要修改结果:
    如何将IntelliJ中的搜索结果复制以粘贴到其他地方?

注意:

  • 这只是一个变通方法,因为不幸的是我看不到直接复制你的屏幕截图中显示的结果的方法,其中每一行都显示了一个搜索结果和它的文件位置。这些信息仍然在复制的文本中,但可能需要一些努力才能以你想要的形式呈现出来。

  • 导出预览窗口中的复制按钮会忽略任何文本选择,盲目地复制一切,如果选择文本的子集,请改用上下文菜单中的复制

  • 我使用的是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:

    如何将IntelliJ中的搜索结果复制以粘贴到其他地方?

  • Right-click anywhere within that Find window listing the occurrences, then select Export to Text File from the context menu:
    如何将IntelliJ中的搜索结果复制以粘贴到其他地方?

  • 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:
    如何将IntelliJ中的搜索结果复制以粘贴到其他地方?

  • You can then paste the selected text into any other window, and massage the results as necessary:
    如何将IntelliJ中的搜索结果复制以粘贴到其他地方?

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.

huangapple
  • 本文由 发表于 2023年2月16日 17:26:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/75470174.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定