phpactor / vscode-phpactor

Phpactor VS Code Extension
MIT License
106 stars 8 forks source link

Couldn't start client Phpactor Language Server #114

Closed ctf0 closed 1 month ago

ctf0 commented 3 months ago

recently i started getting this error when running the app via docker, i have this config which is the same for php.validate.executablePath

"phpactor.executablePath": "/usr/local/bin/docker exec user-demo-laravel.test-1 php",

is there away to get phpactor to work correctly with docker ?

zobo commented 3 months ago

Maybe you could get it working if you make a shell script that calls docker run ... and passes all arguments via $@. However you'll also need to do some very creative volume mounting, so that dockerized php can reach phactor.phar and your workspace.

I have two suggestions:

  1. If you are developing inside a docker container (with volume mounts) try to use VsCode remote Container. Your IDE and PhpActor will run inside the container and this works great.

  2. If you really want to run phpactor in a separate container run it directly and use the "remote" option in vscode-phpactor.

ctf0 commented 3 months ago

and passes all arguments via $@

btw phpunit a config call phpunit.args to do similar thing, is that what u mean ?

Your IDE and PhpActor will run inside the container and this works great

can u share the steps to do so ?

on the other hand, why the extension doesnt use the php executable path i gave to run all its code like normal ?

zobo commented 3 months ago

Because it's not an executable but an executable with arguments.

I suggest to start here https://code.visualstudio.com/docs/devcontainers/containers

Just install vscode remote comtainer extension and attach to your running docker. Then install phpactor extension inside the docker.

ctf0 commented 3 months ago

ok, i did that but honestly thats too much work because

there must be another easier/smoother way to use the extension with docker through config instead of a custom setup.