Closed Nowaker closed 4 years ago
I've managed to hack my way around using sshCmd
and stripping some of the parameters passed to it before passing the rest to the container. The example below is for docker-compose
but there's nothing prevent you from tuning it to do docker exec
, kubectl exec
, machinectl shell
or whatnot.
.vscode/settings.json
{
"perl": {
"enable": true,
"sshAddr": "dummy",
"sshUser": "dummy",
"sshCmd": "bin/shell-into-appserver.sh",
"sshWorkspaceRoot": "/home/code (directory in the container)",
"logLevel": 0,
}
}
bin/shell-into-appserver.sh
:
#!/usr/bin/env bash
COMMAND=$(echo "$@" | sed 's/^.*perl /perl /')
docker-compose exec -u "$UID" -T [SERVICE NAME] $COMMAND
I putted your "ssh" settings example for docker in the README committed in 1bcef8814de898e1bff72397fffc50a158263ae5
Currently, the only way to start a remote language server is using SSH. While this works for truly remote situations, it doesn't fill the bill for modern environments like Docker containers, systemd-nspawn containers, remote containers in Kubernetes clusters, etc. To make this work, we need a way to define a command that provides a TTY for the extension to run its commands. For example, for Docker, it would be something like
docker exec -it [containername] bash
. For Kubernetes,kubectl exec -it [podname] bash
. For systemd-nspawn,machinectl shell [machinename]
. The effect is the same as executing the SSH - acquisition of TTY where commands can be executed. But it's not SSH per say.We need a new configuration options, e.g.
perl.ttyCmd
that is responsible of providing a TTY for the plugin.