禁止针对特定文件夹或文件的错误消息/检查(Suppress error messages / inspections for for specific folders or files)

我正在使用Composer,我不希望PhpStorm对vendor文件夹运行任何错误检查或检查,因为它显示了vendor/composer/autoload_static.php文件中某些代码的误报,因此突出显示了文件,左侧窗格中的文件本身以及它的父文件夹以及所有带有红色下划线的文件,这会分散注意力。

根据这个问题 ,这基本上是我遇到的问题,PhpStorm目前还不够聪明,意识到这实际上并不是一个错误。

这是实际文件中的问题:

我一直在努力弄清楚如何让PhpStorm如何忽略这些文件夹或文件,我似乎无法弄明白!?

我曾尝试点击右下方的“带帽子的小家伙”并更改检查级别,但似乎没有任何区别。

我怎样才能让PhpStorm忽略这些文件夹并摆脱烦人的红线?

我正在使用PhpStorm 2017.3

I'm using Composer and I don't want PhpStorm to run any error checking or inspections on the vendor folder as it is showing a false positive for some code in the vendor/composer/autoload_static.php file and hence is highlighting the lines in the file, the file itself on the left pane and it's parent folders as well all with a red underline and it's distracting.

According to this question, which is basically the issue I am having, PhpStorm isn't currently smart enough to realize this isn't actually an error.

Here is the issue from the actual file:

I have been trying to work out how to get PhpStorm how to ignore these folders or file and I can't seem to figure it out!?

I have tried clicking on the "little guy with the hat" at the bottom right and changing the inspection levels but it doesn't seem to make any difference.

How can I get PhpStorm to ignore these folders and get rid of the annoying red lines?

I'm using PhpStorm 2017.3

最满意答案

“错误”严重性的问题不应显示在第三方代码的“项目视图”面板中(例如,Composer包)。 他们正在展示的事实 - IDE没有以理想的方式管理包(见下文)或项目尚未完全编入索引。

一般来说:如果您有Settings/Preferences | Languages & Frameworks | PHP | Composer --> Add packages as libraries Settings/Preferences | Languages & Frameworks | PHP | Composer --> Add packages as libraries Settings/Preferences | Languages & Frameworks | PHP | Composer --> Add packages as libraries启用Settings/Preferences | Languages & Frameworks | PHP | Composer --> Add packages as libraries选项,IDE会将所有作曲家包文件夹标记为已排除( Settings/Preferences | Directories )..然后将它们重新添加为单独的包含路径( Settings/Preferences | Languages & Frameworks | PHP ) - 那时你可能会看到它们旁边的library root文本。 这足以让IDE在“项目视图”面板中停止显示此类文件的错误(因为此类文件不再被视为项目代码/而不是代码的一部分)。

PS即使您仍然在“项目视图”面板中看到红色欠射波...当您重新打开项目时它将消失(并且不会再次打开该文件)。


错误突出显示的实际问题:最有可能是这一个: https : //youtrack.jetbrains.com/issue/WI-29871 ( Closure::bind )。


如果你仍然希望摆脱那些“错误”,即使在文件本身:只需右键单击它(在项目视图中)并选择Mark as Plain Text - 此文件将不再被视为PHP,因此没有语法检查。

您还可以使用自定义范围(包括此类不需要的文件)并在Settings/Preferences | Editor | Inspections禁用该范围的特定检查 Settings/Preferences | Editor | Inspections Settings/Preferences | Editor | Inspections ..但它不适用于已排除的文件(因为范围仅适用于项目文件)。 这可以在其他情况下使用,但您希望在文件/文件夹范围内检查抑制。

Issues of "Error" severity should NOT be shown in Project View panel for 3rd party code (e.g. Composer packages). The fact that they are showing -- packages are not managed in ideal way by IDE (see below) or project is not fully indexed yet.

In general: if you have Settings/Preferences | Languages & Frameworks | PHP | Composer --> Add packages as libraries option enabled, IDE will mark all your composer packages folders as excluded (Settings/Preferences | Directories) .. and then re-add them back as individual Include paths (Settings/Preferences | Languages & Frameworks | PHP) -- that's when you may see a library root text next to them. This is enough for IDE to stop showing errors for such files in Project View panel (as such files are no longer treated as part of the project code / not your code).

P.S. Even if you still see that red underwave in Project View panel .. it will disappear when you re-open the project (and will not open that file again).


The actual issue with the error highlighting: most likely will be this one: https://youtrack.jetbrains.com/issue/WI-29871 (Closure::bind).


In case if you still want to get rid of those "errors" even in the file itself: just right click it (in Project View) and chose Mark as Plain Text -- this file will no longer be treated as PHP so no syntax checks.

You could also use custom Scope (that will include such unwanted files) and disable particular inspection(s) for that scope in Settings/Preferences | Editor | Inspections .. but it will not work for already excluded files (as Scopes work with project files only). This can be used in other cases though where you want to have file/folder-wide inspection suppression.

禁止针对特定文件夹或文件的错误消息/检查(Suppress error messages / inspections for for specific folders or files)

我正在使用Composer,我不希望PhpStorm对vendor文件夹运行任何错误检查或检查,因为它显示了vendor/composer/autoload_static.php文件中某些代码的误报,因此突出显示了文件,左侧窗格中的文件本身以及它的父文件夹以及所有带有红色下划线的文件,这会分散注意力。

根据这个问题 ,这基本上是我遇到的问题,PhpStorm目前还不够聪明,意识到这实际上并不是一个错误。

这是实际文件中的问题:

我一直在努力弄清楚如何让PhpStorm如何忽略这些文件夹或文件,我似乎无法弄明白!?

我曾尝试点击右下方的“带帽子的小家伙”并更改检查级别,但似乎没有任何区别。

我怎样才能让PhpStorm忽略这些文件夹并摆脱烦人的红线?

我正在使用PhpStorm 2017.3

I'm using Composer and I don't want PhpStorm to run any error checking or inspections on the vendor folder as it is showing a false positive for some code in the vendor/composer/autoload_static.php file and hence is highlighting the lines in the file, the file itself on the left pane and it's parent folders as well all with a red underline and it's distracting.

According to this question, which is basically the issue I am having, PhpStorm isn't currently smart enough to realize this isn't actually an error.

Here is the issue from the actual file:

I have been trying to work out how to get PhpStorm how to ignore these folders or file and I can't seem to figure it out!?

I have tried clicking on the "little guy with the hat" at the bottom right and changing the inspection levels but it doesn't seem to make any difference.

How can I get PhpStorm to ignore these folders and get rid of the annoying red lines?

I'm using PhpStorm 2017.3

最满意答案

“错误”严重性的问题不应显示在第三方代码的“项目视图”面板中(例如,Composer包)。 他们正在展示的事实 - IDE没有以理想的方式管理包(见下文)或项目尚未完全编入索引。

一般来说:如果您有Settings/Preferences | Languages & Frameworks | PHP | Composer --> Add packages as libraries Settings/Preferences | Languages & Frameworks | PHP | Composer --> Add packages as libraries Settings/Preferences | Languages & Frameworks | PHP | Composer --> Add packages as libraries启用Settings/Preferences | Languages & Frameworks | PHP | Composer --> Add packages as libraries选项,IDE会将所有作曲家包文件夹标记为已排除( Settings/Preferences | Directories )..然后将它们重新添加为单独的包含路径( Settings/Preferences | Languages & Frameworks | PHP ) - 那时你可能会看到它们旁边的library root文本。 这足以让IDE在“项目视图”面板中停止显示此类文件的错误(因为此类文件不再被视为项目代码/而不是代码的一部分)。

PS即使您仍然在“项目视图”面板中看到红色欠射波...当您重新打开项目时它将消失(并且不会再次打开该文件)。


错误突出显示的实际问题:最有可能是这一个: https : //youtrack.jetbrains.com/issue/WI-29871 ( Closure::bind )。


如果你仍然希望摆脱那些“错误”,即使在文件本身:只需右键单击它(在项目视图中)并选择Mark as Plain Text - 此文件将不再被视为PHP,因此没有语法检查。

您还可以使用自定义范围(包括此类不需要的文件)并在Settings/Preferences | Editor | Inspections禁用该范围的特定检查 Settings/Preferences | Editor | Inspections Settings/Preferences | Editor | Inspections ..但它不适用于已排除的文件(因为范围仅适用于项目文件)。 这可以在其他情况下使用,但您希望在文件/文件夹范围内检查抑制。

Issues of "Error" severity should NOT be shown in Project View panel for 3rd party code (e.g. Composer packages). The fact that they are showing -- packages are not managed in ideal way by IDE (see below) or project is not fully indexed yet.

In general: if you have Settings/Preferences | Languages & Frameworks | PHP | Composer --> Add packages as libraries option enabled, IDE will mark all your composer packages folders as excluded (Settings/Preferences | Directories) .. and then re-add them back as individual Include paths (Settings/Preferences | Languages & Frameworks | PHP) -- that's when you may see a library root text next to them. This is enough for IDE to stop showing errors for such files in Project View panel (as such files are no longer treated as part of the project code / not your code).

P.S. Even if you still see that red underwave in Project View panel .. it will disappear when you re-open the project (and will not open that file again).


The actual issue with the error highlighting: most likely will be this one: https://youtrack.jetbrains.com/issue/WI-29871 (Closure::bind).


In case if you still want to get rid of those "errors" even in the file itself: just right click it (in Project View) and chose Mark as Plain Text -- this file will no longer be treated as PHP so no syntax checks.

You could also use custom Scope (that will include such unwanted files) and disable particular inspection(s) for that scope in Settings/Preferences | Editor | Inspections .. but it will not work for already excluded files (as Scopes work with project files only). This can be used in other cases though where you want to have file/folder-wide inspection suppression.