sandhje / vscode-phpmd

VSCode PHP Mess Detector extension
MIT License
15 stars 4 forks source link

How to use local (project based) phpmd? #50

Closed gcg closed 4 years ago

gcg commented 4 years ago

Hey there,

Sorry if this is a stupid thing to ask but for the life of me I can't figure out how to use phpmd from the project vendor directory? In my vim setup it looks for vendor/bin/phpmd and if it's there it uses it, if it does not, it simply don't run phpmd.

Is this an oversight or i am simply missing something really basic?

sandhje commented 4 years ago

Hi Guney,

Did you enable the verbose logging and check that? Generally that is the best spot to look if all paths are configured correctly and if php and phpmd are loaded from the spot you expect them to be. It will also provide you some feedback if something else goes wrong.

gcg commented 4 years ago

hey @sandhje thank you for your quick reply.

I think the issue is like 98% of me being a vs code noob and 2% is missing stuff on readme :)

If you are using code with a folder (so if you add your project folder to it and that is the root), setting the command path as vendor/bin/phpmd works like a charm.

The reason I wasn't able to use this for my first day was, I was using a workspace and adding multiple folders inside of that workspace. So the code assumed the root folder is some fictional folder instead of the php project that is currently opened. So if you are using workspaces and set a relative path for phpmd executable, that will fail.

I am closing it since I don't think there is anything we can do from this side to improve this except to add this as a warning to readme maybe.