SanderRonde / phpstan-vscode

PHPStan plugin for VSCode
https://marketplace.visualstudio.com/items?itemName=SanderRonde.phpstan-vscode
MIT License
37 stars 7 forks source link

Implement editor actions #72

Closed zeroSal closed 2 months ago

zeroSal commented 2 months ago

Implement an editor code action that executes the "Scan project for errors" command. Editor actions reference: https://code.visualstudio.com/api/ux-guidelines/editor-actions

Editor action example: image

SanderRonde commented 2 months ago

Hmm I'm not sure if this really is something I should add to the extension. I don't really see any other linting-related extensions doing this. But maybe this is useful for users that have check-on-save turned off. Is that the case for you or do you just want an easy way to trigger it manually apart from the command bar?

zeroSal commented 2 months ago

I have the check-on-save turned on, but working with PHP CS-Fixer, sometimes, PHPStan (your extension) marks as wrong the incorrect line number as PHP CS-Fixer fixed the code style after the PHPStan linting.

SanderRonde commented 2 months ago

Ahh yeah that's a tough problem. I guess not really something I can fix from within the extension though. I think there may be some extensions out there for manually determining the order of such commands. Then you can manually set up the flow of format first then check.

I think generally though the Scan project for errors command should be sufficient no? Otherwise there may very well be an extension that adds a programmable button to the editor actions field or to the status bar. I think that this is maybe a bit too specific of a case to really build generic support for it into the extension.

zeroSal commented 2 months ago

It makes sense. Thanks for having replied ;)