在 PyCharm 中查找多个项目的文件 [英] Find in files of multiple projects in PyCharm

查看:95
本文介绍了在 PyCharm 中查找多个项目的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用在文件中查找"选项?(Ctrl + Shift + F⇧⌘F) 适用于 PyCharm 中的多个或所有项目?例如,如果我有项目foo"和项目bar",我如何使用在文件中查找"?当我在项目foo"中时还想看bar"的搜索结果吗?

解决方案

如何使用在文件中查找"选项?(Ctrl+Shift+F 或 ⇧⌘F) 用于 PyCharm 中的多个或所有项目?

在 PyCharm 的上下文中,所谓的项目" 是一个基本目录,其中包含一个 .idea 文件夹,PyCharm 在您创建新项目时生成该文件夹.

当您使用在文件中查找"时搜索的是当前在项目工具窗口"中打开的项目中的文件(注意复数);(Alt + 1).这对应于 File > Settings > Project > Project Dependencies 或您在 PyCharm 窗口中打开的第一个项目的文件 .idea\misc.xml.

例如,在屏幕截图中打开了两个项目(这是通过使用 Attach 完成的,请参阅

以这种方式运行在文件中查找"显示两个项目中发生的事件.

<块引用>

如果我有项目foo"和项目bar",我如何使用在文件中查找"?当我在项目foo"中时还想看bar"的搜索结果

简单的答案是:在同一个 PyCharm 窗口中打开两个项目.



但是让我们从更一般的意义上重新表述原始问题:

<块引用>

是否可以使用在文件中查找"来搜索多个项目?如果它们未在当前窗口中打开?

答案是:.

PyCharm 的在文件中查找"提供了几种不同的搜索功能.像自定义范围"(以及其他像到处搜索).但是它们都没有提供同时搜索当前未打开的多个项目的功能.这样做的原因可能不直观,但请注意,这些搜索功能还可以包括在外部库"、数据源"、划痕和控制台"等中进行搜索……因此,为了提供这些上下文,PyCharm 必须打开各个项目并进行一些处理.这不仅仅是在文件和目录中进行文本搜索.

因此,如果您要查找的只是全文搜索"在选定的目录列表中,而不在 PyCharm 项目工具窗口中打开它们,最简单的方法(我使用的)是使用操作系统的搜索功能或具有这种搜索功能的其他 IDE(如 Notepad++).

(我尝试找到一个 PyCharm 插件,但显然在目前还没有集成那种搜索功能.)

How can I use the option "Find in files" (Ctrl + Shift + F or ⇧⌘F) for multiple or all projects in PyCharm? For example if I have project "foo" and project "bar", how can I use "Find in files" when I am in the project "foo" and also want to see the search results of "bar"?

解决方案

How can I use the option "Find in files" (Ctrl+Shift+F or ⇧⌘F) for multiple or all projects in PyCharm?

In the context of PyCharm what is called "a project" is a base directory containing an .idea folder that PyCharm generates when you create a new project.

When you use "Find in Files" what is searched are the files in the projects (notice the plural) currently opened in the "Project tool window" (Alt + 1). This corresponds to the projects listed in File > Settings > Project > Project Dependencies or the file .idea\misc.xml of the first project you opened in that PyCharm window.

For example, in the screenshot two projects are opened (this is done by using Attach, see "Open multiple projects" ) in the Project tool window and both are searched (the screenshots were edited for a side-by-side view).

This way running "Find in Files" shows occurrences in both projects.

if I have project "foo" and project "bar", how can I use "Find in files" when I am in the project "foo" and also want to see the search results of "bar"

The simple answer is: Open both projects in the same PyCharm window.



But lets rephrase the original question in its more general sense:

Is it possible to search several projects using "Find in Files" if they are not open in the current window?

The answer is: No.

PyCharm provides several different search functions with its "Find in Files" like "Custom Scopes" (and others like Search everywhere). But none of them provide the functionality to simultaneously search multiple projects that aren't currently opened. The reason for this might not be intuitive, but notice these search functions can also include searching in "External Libraries", "Datas Sources", "Scratches and Consoles", etc... So to provide these contexts PyCharm has to open the individual Projects and do some processing. It's more than just a textual search in files and directories.

So if what you are looking for is just "full-text-search" in a chosen list of directories without opening them in the PyCharm Project tool window, the easiest way (what I use) is using the OS's search function or a different IDE (like Notepad++) that have that kind of search functionality.

(I tried finding a PyCharm plugin but apparently at the moment there is none that integrates that kind of search function.)

这篇关于在 PyCharm 中查找多个项目的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆