Closed jg314 closed 6 months ago
That's very odd @jg314, especially that it is resolved by resetting the settings. I'll take a look at this and see if I can figure it out. Thanks for all of the additional information, it really helps!
Thanks a ton for taking a look @ObliviousHarmony. I really appreciate it.
I wasn't able to replicate it on macOS, I've got a few questions @jg314:
phpcs
installed globally at /.config/composer/vendor/bin/phpcs
?phpcs
installed?I'll try it out on my Windows machine once I get a chance, but maybe the above can help me replicate it here.
Again, I really appreciate you diving into this. Here are the answers to your questions:
Is your phpcs installed globally at /.config/composer/vendor/bin/phpcs?
I believe so. It appears to be located at /home/username_replaced/.config/composer/vendor/bin/phpcs
.
What's the path to your project directory?
Here's the project's path: /home/username_replaced/wp-local-docker-sites/wired-test/wordpress
Does your project have phpcs installed? No, phpcs is not installed in the project via composer.json.
Let me know if you need anything else. Thanks again.
Hi @jg314,
I tried this out on a Windows machine this morning and wasn't able to reproduce the issue. I used the same configuration that you gave above. Out of curiosity, how are you getting phpcs
into your $PATH
? I wonder if there's some reason that phpcs
wouldn't be available on first run but after the settings were reset would become available. Could you share your settings.json
configuration for phpCodeSniffer
at the user, remote, and workspace levels?
If it isn't too much trouble, you could also clone the repo and do a little debugging! All you'd need to do is run npm install
and then VS Code's Run > Start Debugging
will take care of the rest. It will open a debug instance of VS Code that you can use to explore a project and use breakpoints and the like in the original editor. You could also just add console.log()
calls! In particular, it would be useful to see what Worker::createProcess()
has for executable
and processArguments
.
I think I may have found the issue. I went through all the settings related to the extension and found this in my user settings JSON:
"phpCodeSniffer.executable": "/.config/composer/vendor/bin/phpcs",
That path is incorrect and when I remove it, everything starts working correctly and the errors goes away. What's strange is that there's no setting for this within the settings UI. I also doubt I would have set that manually since it's the wrong location for the executable.
In any case, I'm hoping this resolves the issue for good. Thanks a ton for all your help troubleshooting this. I really appreciate the time and the work you did to make the extension available inside VS Code.
I figured that might be it @jg314 :smile: When I tested this on my Windows machine I ran into the exact same problem from an old configuration I had in place to test Docker executables out. I'm not sure why it doesn't show up in the settings but that's probably an upstream problem in VS Code. It's supposed to display a setting as deprecated when markdownDeprecationMessage
is set, and it used to work, but it doesn't seem to anymore.
I'm glad we got it figured out. Thank you again!
Description
When I load VS Code I get the following error in the Output panel: 'The PHPCS executable "/.config/composer/vendor/bin/phpcs" could not be found.' This errors continues to pop up many times as I make edits.
What's strange is that if I go into the settings and toggle any the options, it starts working without an issue, even if I don't change anything. For example, if I turn on and off the same checkbox, everything starts working as expected.
Technical Setup
In case it's helpful, here are some details on my configuration:
Computer OS: Windows PC VS Code Loaded In: Windows Subsystem for Linux (WSL2 running Ubuntu) Composer Version: 2.5.8
I've also included a screenshot of some of the settings in VS Code below in case that's helpful.
Thanks a ton.