I am developing directly on a development container in a container on a (remote) Kubernetes cluster. The container has an ssh-server which means that eglot can start the remote lsp-server through ssh.
Additionally I've set up port-forwarding to forward a port on the local machine to the lsp-server port on the container. In this way eglot can connect to the lsp-server through a port on my localhost.
However I am not able to find the correct commands to automatically make eglot start the lsp-server remotely and subsequently connect to the server on a local port.
With the following command added tot the
eglot-server-programs
I can get eglot to start the remote lsp-server (by running M-x eglot). (PS I run this command after I have opened a file on the remote container through tramp, eglot seems to find out automatically that the command to start the lsp-server should be run on the remote host).
Code:
(add-to-list 'eglot-server-programs '((python-mode python-ts-mode) "pylsp" "--tcp" "--host=0.0.0.0" "--port" "5007"))
When subsequently I add the following to the
eglot-server-programs
and run M-x eglot again:
Code:
(add-to-list 'eglot-server-programs '((python-mode python-ts-mode) "localhost" 5007))
Then eglot seems to connect to the server and things seem to work fine.
But again, I cannot get eglot to perform the two steps above automatically. Is there a way to make eglot preform both steps above by adding only a single entry to the 'eglot-server-programs list?
Or maybe there are two seperate commands that I can run to first start the remote-lsp server and subsequently to connect to the server though the local port?