ikappas / vscode-phpcs

PHP CodeSniffer for Visual Studio Code
MIT License
128 stars 56 forks source link

phpcs Reports Errors When Opening Git Diffs (and Also in Random Cases) #200

Open manuth opened 2 years ago

manuth commented 2 years ago

phpcs reports following error:

phpcs: Request workspace/configuration failed with message: Unable to locate phpcs. Please add phpcs to your global path or use composer dependency manager to install it in your project locally.

What's quite strange is that this error not only occurs when opening a git diff view (as this opens a file with a git:/{path}-uri) but also in random cases. For some files, vscode seems to open a git:/{path}-uri without even ever opening a git diff view.

This, again, triggers the error mentioned before.

I think it might be a good idea to completely ignore (or at least provide an option to do so) documents with a git:/{path}-uri.

danielpost commented 2 years ago

I'm having a similar issue. As soon as I open a git diff view in VSCode phpcs fails to lint it and hangs, using 100% CPU:

[Trace - 9:40:21 PM] Received notification 'textDocument/didStartValidate'.
Params: {
    "textDocument": {
        "uri": "git:/Users/danielpost/dev/file.php?%7B%22path%22%3A%22XXX%22%2C%22ref%22%3A%22~%22%7D"
    }
}