emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.75k stars 868 forks source link

question about proper setup of TRAMP for Spacemacs #2822

Open xyderos opened 3 years ago

xyderos commented 3 years ago

I have set up my Golang language server(gopls) and some helper extensions as mentioned in the go layer at Spacemacs.

I tried to ssh into a pc via TRAMP and open a file remotely, I opened the file but I thought that gopls would work locally(it didn't).

I got this output from Spacemacs:

`1. The language you are trying to use does not have built-in support in lsp-mode. You must install the required support manually. Examples of this are lsp-java or lsp-metals.

  1. The language server that you expect to run is not configured to run for major mode go-mode. You may check that by checking the :major-modes that are passed to lsp-register-client.
  2. lsp-mode doesn't have any integration for the language behind go-mode. Refer to https://emacs-lsp.github.io/lsp-mode/page/languages and https://langserver.org/ .
  3. You are over tramp. In this case follow https://emacs-lsp.github.io/lsp-mode/page/remote/.
  4. You have disabled the lsp-mode clients for that file. (Check lsp-enabled-clients and lsp-disabled-clients). `

I installed gopls on the remote, added it in the path and I also made a .dir-locals.el file on the remote.

Since the connection is over TRAMP, I checked the link given but I am fairly new to emacs and I dont know where to place the script given, is there a guide or a "plug and play" way to set it up? I tried to put the function inside the user-init() function but I got an error that the function is of type void.

Below is the code snippet I found from the 4th option from the output(:

(lsp-register-client (make-lsp-client :new-connection (lsp-tramp-connection "<binary name (e. g. pyls, rls)>") :major-modes '(python-mode) :remote? t :server-id 'pyls-remote))

zilti commented 3 years ago

It is currently broken anyway (see #2709 ) so you'd be better off avoiding LSP-over-TRAMP at the moment

xyderos commented 3 years ago

any updates on this?

sstepashka commented 2 years ago

Any updates?

uncomfyhalomacro commented 1 year ago

no updates

uncomfyhalomacro commented 1 year ago

@xyderos here you go

https://codeberg.org/uncomfyhalomacro/erudite-macs/src/commit/463256c5ab046fd458fb86098d936b5362a7ef02/modules/erudite-languages.el#L42-L49

Tested on a go project zk:

image