phpactor/vscode-phpactor

Couldn't start client Phpactor Language Server

Closed this issue · 4 comments

ctf0 commented

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",
  • console log error
Couldn't start client Phpactor Language Server
c @ notificationsAlerts.ts:42
log.ts:439   ERR spawn /usr/local/bin/docker exec user-demo-laravel.test-1 php ENOENT: Error: spawn /usr/local/bin/docker exec user-demo-laravel.test-1 php ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:284:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
  • vscode logger error
[Error - 6:59:35 PM] Starting client failed
Launching server using command /usr/local/bin/docker exec user-demo-laravel.test-1 php failed.

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

zobo commented

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

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

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

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

  • now i have to install phpactor as a composer dep per project instead of global as i have currently
  • any custom config files, needs to be copied to the container

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