Skip to content

Commit

Permalink
feat(go): Add auto install for gopls (#4650)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 authored Dec 21, 2024
1 parent 791d9a3 commit 04e4857
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion clients/lsp-go.el
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,16 @@ These are assembled from the customizable variables `lsp-go-server-path'
and `lsp-go-server-wrapper-function'."
(funcall lsp-go-server-wrapper-function (append (list lsp-go-gopls-server-path) lsp-go-gopls-server-args)))

(defun lsp-go--cls-download-server (_client callback error-callback _update?)
"Install/update shader-ls language server using `go install'.
Will invoke CALLBACK or ERROR-CALLBACK based on result.
Will update if UPDATE? is t"
(lsp-async-start-process
callback
error-callback
"go" "install" "golang.org/x/tools/gopls@latest"))

(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection 'lsp-go--server-command)
:activation-fn (lsp-activate-on "go" "go.mod")
Expand All @@ -438,7 +448,8 @@ and `lsp-go-server-wrapper-function'."
:library-folders-fn #'lsp-go--library-default-directories
:after-open-fn (lambda ()
;; https://github.com/golang/tools/commit/b2d8b0336
(setq-local lsp-completion-filter-on-incomplete nil))))
(setq-local lsp-completion-filter-on-incomplete nil))
:download-server-fn #'lsp-go--cls-download-server))

(lsp-consistency-check lsp-go)

Expand Down

0 comments on commit 04e4857

Please sign in to comment.