-
Notifications
You must be signed in to change notification settings - Fork 63
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
Try both haskell-language-server-wrapper
and haskell-language-server
by default
#169
Comments
I've just run into this. I'm surprised this has not been fixed yet. One might say that "Oh, just modify I've tried to set that variable locally to my project by adding an entry in I think ideal is what @michaelpj proposed: setting this variable to a list and defaulting to haskell-language-server-wrapper and haskell-language-server |
I think I have something that works. But I wonder now, how much of a problem is backward compatibility? Should we keep |
I was thinking this --- lsp-haskell.el
+++ lsp-haskell.el
@@ -1,4 +1,17 @@
-(defcustom lsp-haskell-server-path "haskell-language-server-wrapper"
- "Path to the Haskell Language Server executable."
- :type 'string
+(defcustom lsp-haskell-server-path '("haskell-language-server-wrapper" "haskell-language-server")
+ "List of possible paths to the Haskell Language Server executable."
+ :type '(repeat string)
:group 'lsp-haskell)
+
+(defun lsp-haskell--find-server ()
+ "Try each server in `lsp-haskell-server-path` and return the first that works."
+ (seq-find #'executable-find lsp-haskell-server-path))
+
- (defun lsp-haskell--server-command ()
- "Command and arguments for launching the inferior language server process.
- These are assembled from the customizable variables `lsp-haskell-server-path'
- and `lsp-haskell-server-args' and `lsp-haskell-server-wrapper-function'."
- (funcall lsp-haskell-server-wrapper-function (append (list lsp-haskell-server-path "--lsp") lsp-haskell-server-args) ))
+(defun lsp-haskell--server-command ()
+ "Command and arguments for launching the inferior language server process.
+These are assembled from the customizable variables `lsp-haskell-server-path'
+and `lsp-haskell-server-args' and `lsp-haskell-server-wrapper-function'."
+ (let ((server (lsp-haskell--find-server)))
+ (unless server
+ (error "No valid Haskell Language Server found in `lsp-haskell-server-path`"))
+ (funcall lsp-haskell-server-wrapper-function (append (list server "--lsp") lsp-haskell-server-args)))) |
I guess my experience has been that it works well enough with direnv. More generally, it is an example of a common thing: a setting that you want to be different in different locations. So I do feel like we should be able to defer to generic solutions like direnv or |
Might need to make the executable path a list of paths.
The text was updated successfully, but these errors were encountered: