bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.63k stars 94 forks source link

Run diagnostics on all files in workspace #1467

Open johnbillion opened 4 years ago

johnbillion commented 4 years ago

Feature description or problem with existing feature

It's not currently possible to run diagnostics for all files within a workspace without opening them all and making an edit.

Describe the solution you'd like

I'd love a command in the command palette to run diagnostics on all files in the workspace. I can then use the various "Problems" navigation in VS Code to navigate any problems.

johnbillion commented 4 years ago

Happy for this to be a premium feature, by the way!

andreshg112 commented 3 years ago

As an alternative, we can use https://github.com/phpstan/phpstan. However, I also would like to see the errors in the navigation of Problems in VS Code.

johnbillion commented 3 years ago

Related: https://github.com/microsoft/vscode/issues/13953

AnrDaemon commented 7 months ago

As a simple helper to prevent silly mistakes, you could install a pre-commit hook

.git/hooks/pre-commit:

#!/bin/sh

if git rev-parse --verify HEAD >/dev/null 2>&1
then
    against=HEAD
else
    # Initial commit: diff against an empty tree object
    against=$( git hash-object -t tree /dev/null )
fi

# Redirect output to stderr.
exec 1>&2

git diff --cached --diff-filter=d --name-only -z $against -- \*.php | xargs --null --no-run-if-empty --max-args=1 php -l > /dev/null