How can I connect to an ensime server on a remote host? My netbook is a bit slow for that kind of stuff. I copied the data over and use tramp to edit the files remotely. I ran bin/server
to create the server and an ssh forwarding to be able to connect to it. I use ensime-connect
to connect to the port on localhost. The ensime server on the remote server answers with Got connection, creating handler...
, but that's about it. Ensime is in [ENSIME: wtf]
mode in the emacs status line. How do I fix this?
Connect emacs to a remote ensime server
The problem is the ensime can not find "config" of the connection (made through ensime-connect).
and then following line will throws error:
(if (and loose (ensime-file-in-directory-p file project-root))
because project-root is nil.
By setting the connection to ensime-buffer-connection, the problem can be fixed. try adding following function to your ensime.el
and using the ensime-stackoverflow-connect
to connect.
(defun ensime-stackoverflow-connect (host port)
(interactive (list
(read-from-minibuffer "Host: " ensime-default-server-host)
(read-from-minibuffer "Port: " (format "%d" ensime-default-port)
nil t)))
(let ((c (ensime-connect host port))
(config (ensime-config-load "/Users/whunmr/lab/scala/.ensime")))
(ensime-set-config c config)
(setq ensime-buffer-connection c))
)
remember to change the config path in the code: "/Users/whunmr/lab/scala/.ensime"
EDIT1: the ".ensime" file was created by M-x ensime command, in your scala project folder. actually, by just hardcode the config, you can ignore the file.
(defun ensime-my-connection (host port)
(interactive (list
(read-from-minibuffer "Host: " ensime-default-server-host)
(read-from-minibuffer "Port: " (format "%d" ensime-default-port)
nil t)))
(let ((c (ensime-connect host port))
(config '(:project-name "test" :project-package "com.whunmr" :sources ("./src") :compile-jars ("./" "../../apps/scala/lib/") :target "./bin" :root-dir "/Users/twer/lab/scala/")))
(ensime-set-config c config)
(setq ensime-buffer-connection c))
)
How do I generate the config file / what goes in there? –
Inclinatory
hi @Tass, see the EDIT1 for your question. –
Eponymy
Wouldn't it be possible to partially read the config from e.g. the tramp connection? –
Inclinatory
I think it can be read through tramp connection. just specify your .ensime url like "<name>@<ip>:/Users/...<path>.../.ensime" –
Eponymy
try first open the .ensime file through tramp mode. then connect. to see if it will read properly. if it not works, i think, need hard code the config. –
Eponymy
let us continue this discussion in chat –
Inclinatory
© 2022 - 2024 — McMap. All rights reserved.
$HOME
. – Inclinatory.ensime
had absolute paths. I changed them, but I don't know how to pointensime
on the remote server to the new conf. – Inclinatory