John Davidson

php - vscode-phpcs extension does not work in the editor, but in version control, can I fix it?

0 comments
Message:




I've been trying to get vscode-phpcs extension from ikappas running in VSCode in my project for about 4 days. After ages of back and forth. I noticed, that the extension is scanned open files in the version control. This will also find there the correct errors. But when I open the file in the normal editor, the extension does not scann the file and no errors are displayed.

My attempts to solve the problem:



  • List item

  • uninstall and reinstall the extension

  • New installation of VSCode

  • Installation of phpcs into the project

  • declarating the rigth path

  • declarating the php rules path in setting.json


phpcs gets its rules from a phpcs.xml.dist file from the project. It also runs in the git worktree, but not in the normal editor area.


Here also two screenshots from my VSCode (Please excuse that some things are censored):



Version of the extension:



  • vscode-phpcs 1.0.5


Does anyone have this problem also, or does anyone have a solution for the problem?



My Answer:
It seems like you have tried a lot of troubleshooting steps already. One thing you could try is to check if the extension is enabled for the specific workspace or folder where your files are located. You can do this by clicking on the gear icon in the bottom left corner of VSCode, then selecting "Extensions" and checking if the vscode-phpcs extension is enabled for the workspace.

If the extension is enabled and still not working, you could try updating the extension to the latest version or reaching out to the extension developer for support. They may have more insights into why the extension is not working as expected in your setup.

Additionally, you could try using a different PHP Code Sniffer extension in VSCode to see if that works better for your project. There are several other PHP Code Sniffer extensions available in the VSCode marketplace that you could try out.

Overall, it's important to make sure that the extension is properly configured and enabled for the workspace where your PHP files are located in order for it to work correctly.

Rate this post

4 of 5 based on 2316 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us