-
I have a docker compose with two containers: db and web. I am developing a Ruby on Rails app. It appears as if there are currently two choices to connect to a language server. Either I can have my language server in another image and use I think what I’d like in my case instead is to simply do: docker exec -it app-web-1 /root/bin/solargraph stdio because the I see there is a I’m tempted to hack on |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
If I am reading this correctly, you want to run the server in existing container, right? Then lsp-docker-launch-existing-container seems to be doing what you want? (I haven't touched this code base for a lot of time) |
Beta Was this translation helpful? Give feedback.
-
So far, I can not get lsp-mode to call anything within lsp-docker.el. I asked a question on the Emacs Stack Exchange. I see such things as I'm trying to figure out how to call There are a lot of mysterious "id"s like server-id, client-id, etc, which I'm trying to puzzle out what they mean and where they come from. |
Beta Was this translation helpful? Give feedback.
-
I wrote some lisp code for my particular set up. (require 'lsp-docker)
;; In the lsp-mode directory (where lsp-mode.el lives) is a
;; subdirectory called "clients". In there is a list of "clients". I
;; can't figure these terms out BUT the list below is a list of these
;; "clients" that you want to be enabled inside the client / server /
;; THING that you are defining / creating. In my case, as far as I
;; know, I want just the Solargraph "client".
;;
;; Actually this list is just a list of packages to `require' at the
;; time the THING is registered -- so... it is much ado about nothing?
(setq lsp-docker-client-packages
'(lsp-solargraph))
;; From reading, I guess they call the external server the "server"
;; and the piece either inside or outside of Emacs talking to the
;; server, the "client". But it gets very confusing (keep reading).
;;
;; Emacs has structures which are defined via `cl-defstruct'.
;; `lsp-clients' is a hash of `lsp--client' structures which has a
;; "slot" `server-id' whose comment is: "Unique identifier for
;; representing the client object.".
;;
;; As mentioned `lsp-clients' is a hash (key value pairs) with the
;; keys being the `server-id' (which is also within the structure).
;;
;; With all that in mind, then:
;;
;; :server-id -- needs to be an existing entry in lsp-clients. You
;; can see the list and their priorities by executing:
;;
;; (maphash
;; (lambda (key value)
;; (insert (format "%S %d\n"
;; key
;; (lsp--client-priority value))))
;; lsp-clients)
;;
;; in the *scratch* buffer.
;;
;; :docker-server-id -- The name or id of the new "client object"
;; a.k.a. the `server-id'. The existing entry is found via the
;; `server-id', updated, and entered as a new client using the
;; docker-server-id.
;;
;; :server-command -- This string is munged via
;; `lsp-docker-launch-new-container' into a list of strings which
;; is used to start the language server inside the Docker
;; image/container. Basically it will turn into:
;;
;; docker run --name TBD1 --rm -i TBD2 TBD3 `server-command'
;;
;; TBD1 is `docker-container-name'; TBD2 are `path-mappings' that
;; have been transformed into a list of "-v" options. TBD3 is
;; `docker-image-id'
;;
;; `docker-container-name' and `docker-image-id' will be specified below.
;;
(setq lsp-docker-client-configs
'((:server-id ruby-ls :docker-server-id rubyls-docker :server-command "/root/bin/solargraph stdio")))
(lsp-docker-init-clients
:path-mappings '(("/Users/pedz/Source/hatred" . "/hatred"))
:docker-image-id "pedzsan/hatred:1.0"
:docker-container-name "docker-ruby-lsp"
:priority 10
:client-packages lsp-docker-client-packages
:client-configs lsp-docker-client-configs)
(provide 'lsp-docker-start) |
Beta Was this translation helpful? Give feedback.
-
I was documenting, for myself, what I had found and started wondering. I'll cut to the chase. If you want to read more, you can read about it on this reddit post I was trying to do I've not tried it but had I tried I'm posting this for others to find and perhaps learn from my mistakes. |
Beta Was this translation helpful? Give feedback.
I wrote some lisp code for my particular set up.