-
-
Notifications
You must be signed in to change notification settings - Fork 895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lsp-go: Add possibility to wrap gopls binary (mostly for nix) #4211
Conversation
This allows for example to pick the go version that's provided in a repository's flake.nix Follows the example of lsp-haskell.
clients/lsp-go.el
Outdated
(lsp-register-client | ||
(make-lsp-client :new-connection (lsp-stdio-connection | ||
(lambda () (cons lsp-go-gopls-server-path lsp-go-gopls-server-args))) | ||
(make-lsp-client :new-connection (lsp-stdio-connection (lambda () (lsp-go--server-command))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(lambda () (lsp-go--server-command))
this could be: lsp-go--server-command
Thank you for contributing to |
That was a pleasure. Thanks for accepting the PR :) |
"Command and arguments for launching the inferior language server process. | ||
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-server-path) lsp-go-gopls-server-args))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't lsp-go-server-path
be lsp-go-gopls-server-path
? Without manually setting lsp-go-server-path
lsp-mode doesn't even try to start gopls
Fixes #1933 for
lsp-go
.This allows for example to pick the go version that's provided in a repository's
flake.nix
or by home-manager or NixOS. This follows the example of lsp-haskell.In my
init.el
I have:One of my repos provides the
go
binary with such aflake.nix
(abridged version):And a
shell.nix
(needed for thenix-sandbox
emacs package):And also, the
gopls
binary is provided by home-manager:Now, if I open a file in that repo, I get the
go
binary from theflake.nix
: