Closed vasil-sokolov closed 1 year ago
Hi, first of all thank you for the kind words.
Regarding the folder-scanning, I'm leaning towards not adding it. The reason is that the benefits (a few people who have this same setup) imo do not weigh up against the downsides (everyone now has an extra contextmenu entry on every folder). Some ways to make this work anyway: if every module gets its own (dummy) phpstan.neon you can open the individual folders on their own in VSCode. Then the extension treats it like a single big project. Another alterative might be to just scan the entire thing. Theoretically PHPStan cache should make it so it only scans the files that were changed, so you'll effectively only need to scan the folder you changed.
For your second request (if still revenant without the first one) I think you can make this work with the phpstan.enabled
setting. Then you can scan manually using the "scan current file" command. Does that help?
Thank you for the prompt response. The idea is clear, thank you for that. But I don't think it works for me. There are a hundred modules and it's too exhausting to open each module as a separate project. It's easier to scan the entire project. But thanks anyway.
As for the second question, I didn't get your suggestion. In my case the situation is the following: scanning /modules/Core returns 2 errors in /modules/Core/test.php. But if I scan /modules/Core/test.php it reports about 10 errors. It happens with phpstan.phar as well. And it sees the autoloader file, I checked that. Because of that then I scan a folder (using the other extensions) it reports about 2 errors but then I open the file to fix the errors and get more errors. I asked you about disabling auto file scanning because your extension already has the option to disable that on file save. In my case, it's not enough and I need the ability to disable that at all.
I wrote to you because the other PhpStan extensions are abandoned. I could fork one of them and did the required changes but really don't want to create one more extension that will for fine for me but not for most. Your extension will be better anyway.
Thank you for the help.
Ah sorry to hear it won't work. I can imagine with that many modules it becomes hard.
Your second point sounds like a bug. phpstan.enabled
being false should also disable auto-scanning on file open. That should at least be fixed in the new version, hopefully then setting phpstan.enabled
to false works for you :)
Hmm I just checked and it looks like it doesn't scan files on-open for me when phpstan.enabled
is set to false. Are you sure it still scans when that's the case?
Hi,
Yes, you are right, if phpstan.enabled
is set to false it doesn't scan files automatically. But without the ability to scan a separate folder, it has no sense to me because scanning the entire is not an option in my case.
Ok, I have tried to do this anyway and it works. It took about 5 minutes to scan the entire project but this is acceptable. Thank you for the help.
But I still hope you may consider the ability to scan folders in the future. It can be disabled by default and be controlled via settings. Thank you in advance.
Ah that makes sense. Looked into it a little further and I did initially consider doing it (by indeed making it an option) but I think this might be surprisingly complicated technically. The way VSCode handles errors in files that are not open is quite weird, and accounting for that was quite hard when I built the project-wide scan. Adding it for individual folders would be pretty hard too, and would also require quite a few changes to the architecture to move away from just files/projects to folders too. So I'll be closing this issue for now.
Hi, Thank you for implementing of PhpStan analyzer. Your extension works really well. I compared it with many other extensions and each had some problems. But it would be awesome if you are able to improve it a bit. In my case, a project I'm working on consists of many modules. Some of them are highly relevant but other less. It could be great if your extension allows scanning a separate folder instead of the entire project. The second option that will be great to have is the ability to disable file check when it's opened additionally to onSave option. It's required because PhpStan produces different results for a folder and a separate file in this folder. For a separate file, it returns more errors. I believe it's a problem with PhpStan since running it in the console gives the same results. Also, I was debugging the other extensions and checking if the parameters that are sent to PhpStan are the same and they are. So this looks like the particularity of PhpStan.
Hope you will find the changes I'm asking about sensible. Thanks.