Skip to content

Commit

Permalink
Add lsp-erlang-server-connection-type custom var to specify between '…
Browse files Browse the repository at this point in the history
…tcp and 'stdio (#1166)
  • Loading branch information
jfacorro authored and yyoncho committed Nov 10, 2019
1 parent 2eab4de commit 8a159ec
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lsp-erlang.el
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,25 @@
:risky t
:type 'file)

(defcustom lsp-erlang-server-connection-type
'tcp
"Type of connection to use with the Erlang Language Server: tcp or stdio"
:group 'lsp-erlang
:risky t
:type 'string)

(defun lsp-erlang-server-start-fun (port)
`(,lsp-erlang-server-path
,(number-to-string port)))
"--transport" "tcp"
"--port" ,(number-to-string port)))

(defun lsp-erlang-server-connection ()
(if (eq lsp-erlang-server-connection-type 'tcp)
(lsp-tcp-connection 'lsp-erlang-server-start-fun)
(lsp-stdio-connection `(,lsp-erlang-server-path "--transport" "stdio"))))

(lsp-register-client
(make-lsp-client :new-connection (lsp-tcp-connection 'lsp-erlang-server-start-fun)
(make-lsp-client :new-connection (lsp-erlang-server-connection)
:major-modes '(erlang-mode)
:priority -1
:server-id 'erlang-ls))
Expand Down

0 comments on commit 8a159ec

Please sign in to comment.