Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use with dockerized phan #53

Open
juanfernandoe opened this issue Jan 29, 2019 · 1 comment
Open

How to use with dockerized phan #53

juanfernandoe opened this issue Jan 29, 2019 · 1 comment
Labels

Comments

@juanfernandoe
Copy link

Hi,

I want to use this plugin with phan inside a Docker container, at the moment I'm able to check my code
with https://github.com/cloudflare/docker-phan but I can't see a way to make it work
together with this plugin.

Could you explain to me if is there any way to do that?

@TysonAndre
Copy link
Owner

TysonAndre commented Jan 30, 2019

Cloudflare's docker repo for Phan is unmaintained and out of date. (as far as I can tell) The latest tag it has is 0.9.3, which predates Phan's language server support - I assume some CI job is automatically triggering build to publish an outdated Phan version. See https://hub.docker.com/r/cloudflare/phan/tags


If you had a working dockerized Phan image running Phan 1.2.1, then:

You could theoretically get it working if /path/to/my-project was mapped to /path/to/my-project inside of a Docker VM (with the --volumes flag). vscode-php-phan offers the "phan.phanScriptPath" setting in user settings for those purposes -

You would change it to point to an executable shell script that runs docker run --rm -i -V /path/to/my-project:/path/to/my-project:ro phan "$@" (-i if you used stdin, which might be easiest on Mac/linux, I think you might have to pass in --language-server-tcp-connect $ACTUAL_HOST_IP:port to get tcp working)

  • Stdin/stdout would be easiest if it works. I'd recommend that.
  • If you're trying tcp, you'd want to figure out what ip your host is running as and change language-server-tcp-connect to that instead of 127.0.0.1 when passing along the CLI args.
  • If you're using Windows, I don't think the folders from the URIs would be the same, and Phan doesn't support using a different folder on the server and the client
src/extension.ts
345:                spawnServer('--language-server-tcp-connect=127.0.0.1:' + server.address().port);

Also see phan/phan#1861 - I'm not sure what steps they used or if they got it working. I don't see any dockerized language server examples after a quick GitHub search or Google search (never mind, that was for the daemon, but I still don't see anything)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants