phpstan-vscode icon indicating copy to clipboard operation
phpstan-vscode copied to clipboard

Multiple Workspaces

Open SirLouen opened this issue 4 months ago • 3 comments

I've read that this theoretically works with multiple workspaces But I've been unable to make it work. When I open the project individually, it works well, but inside my group of 4 projects within the same workspace, it fails and doesnt scan for anything

I have the .vscode/settings.json set in the specific folder I'm willing to run the phpstan analysis, but all elements are greyed out and say something lke:

This setting cannot be applied in this workspace. It will be applied when you open the containing workspace folder directly.

And since I cannot specify the config path, log is reporting: [error] PHPStan: failed to find config file in "phpstan.neon,phpstan.neon.dist,phpstan.dist.neon"

In the docs it says:

Does this extension support checking multiple workspaces? The extension currently doesn't support checking multiple workspaces. You can use the extension just fine in a multi-workspace project, but only a single PHPStan configuration can be checked. The one that will be checked is configurable using the above configuration options. If you really would like multi-workspace support, feel free to mention so in this issue and I might eventually add support for it if there's enough demand.

May I assume that to configure phpstan in a multiple workspace environment, I must use the global configs only?

SirLouen avatar Sep 21 '25 23:09 SirLouen

That is correct. The message from VSCode indeed means that the settings in those individual projects aren't actually used unless you open the project by itself. The only way to use this extension is to use a global/workspace config

SanderRonde avatar Sep 22 '25 18:09 SanderRonde

So it's impossible to use this in a multiple workspace? Are there any work around a to say least target one of the multiple workspaces, without having to open it independently?

SirLouen avatar Sep 22 '25 18:09 SirLouen

You can use a global or shared-workspace-level config that targets one of the individual workspaces

SanderRonde avatar Sep 22 '25 20:09 SanderRonde