-
Notifications
You must be signed in to change notification settings - Fork 201
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
Elm Language Server #285
Comments
I don't know. Possibly. Try it out! (add-to-list 'eglot-server-programs '(elm-mode . ("elm-language-server" "--stdio"))) You would have to have some |
I'll try and report here. |
Hi @joaotavora , I'm trying to get this to work based on your instructions:
I have Eglot reports that it connects successfully:
But when I trigger any action like completion at point I get the error:
I'm guessing this might be something simple related to the config - is there anything I can do to debug? Would be great to add Elm to the list of supported language servers, and I'm using Elm in production at the moment so would be happy to help out if I can (and grateful to be able to use it with eglot). |
@jamiecollinson this is a bug in Eglot. It might also be a bug in the
|
Thanks @joaotavora! Here's the backtrace I get when triggering
I'm not sure the
|
What you sent is enough information to start investigating, but the info I need from |
Apologies - thought you only wanted the most recent, here's a full log from a fresh session with the same scenario:
|
Isn't this same as issue #278? There's a chance that 6d87de1 fixed this. @jamiecollinson, can you try to run git version of eglot and see whether the issue still persist? Additionally, if the previous analysis was correct, then the server sends non-standard capabilities reply, because instead of ":completionProvider nil", it should send ":completionProvider :json-false". |
Thanks @nemethf - just checked and I was using Unfortunately no actions seem to work! I'm new to the LSP specification but I presume the following means the
I suspect this is problem with the server not |
Let me start with saying I have no idea what Elm is. But according to its website, it does support code completion. My guess is the default configuration values of the elm language server are not satisfactory in your environment. It's worth trying to configure them. One way to configure them is through the LSP protocol. Here is an example. But you're right, "jumping to definition" should work. You can debug the problem with the following. Write a very simple file just having a jump target and an origin. (A function definition and a function call if those terms make sense in elm.) Put the point (cursor) on the origin. Manually start eglot. Wait a couple of seconds. Call xref-find-definitions (by pressing |
Appreciate you going above and beyond, and thanks for the links to configuration - I'd been wondering that! Elm is a language that compiles to JS, it's strongly inspired by Haskell, and the tooling is downloaded via NPM and installed globally - there's an I've created a basic config in the same dir as the source as
And I can see that's getting sent to the server from the event log:
When I trigger In case it helps here's the find definition I was trying - hopefully understandable even without background knowledge of Elm ( Also in case it helps, this is the config for Elm from https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-elm.el |
Only query :triggerCharacter information if the server has provided it. Elm's doesn't, apparently. * eglot.el (eglot-completion-at-point): Check that completion capability is a list before treating it like one.
There's a lot going on here.
I'm not sure that's the right syntax. Changing the path to a non-existent binary might help to check whether server takes into account the provided value.
Can you create an elm.json file? Does it store configuration for the language server or for the compiler?
The server says it's a hoverProvider, but ...
... it doesn't have a textDocument/hover handler. This error might kill the server. Can you check whether the server is still running after an error like this? For example, does it reply with another error to another hover request? You can try to customize
This is also strange since the server says it's a definitionProvider. What happens when you type:
For me it doesn't. But if you could capture the communication between a working server and a working client, then we would be able to compare that with the events buffer above. |
@nemethf and @jamiecollinson I just refreshed the page and wow that's a big exchange that I can't read right now. I think the fix I pushed to a side branch might solve the issue correctly (and @nemeth I don't think the "handle null capabilities as nil" will do the trick here). But, I didn't actually try the fix, it is a blind fix because downloading Elm is not an option right now. But @jamiecollinson your log seems to confirm my suspicion. Elm supports completion, just not with trigger characters . And it seems to signal this by saying |
Thanks so much for the extensive help (I realise this must not be a priority as Elm is rather niche!) @nemethf your commend about
I was starting
@joaotavora I'm still not getting completion so I assume that's the |
@nemethf mentioned, quite rightly, that a previous fix might have invalidated the fix that I sent you. I you if try the newest commit we will be able to tell if it was it. But the bottom line here is that I believe the server is sending non-compliant capabilities. I'll investigate more tomorrow. |
Thanks @joaotavora - I've just tried with 6d87de1 and get a similar error to before but with different backtrace:
Hope that helps and do let me know if I can help - really appreciate you looking at it (and thanks for |
I think João meant 6dfdfff and not 6d87de1.
Eglot relies on the built-in project.el for determining the project-root. The project package has some useful features and different ways to define the project-root. But I never tried to understand those alternative methods. |
Sorry, that was my typo - I'd actually checked out 6dfdfff and copied the wrong hash from above, so I think the backtrace is correct. |
Re: |
Projectile users might find useful code snippets here. They cloud even try to revive that discussion :) |
Are you absolutely sure? I don't want to doubt gratuitously, but your backtrace doesn't seem to have the crucial
Can you confirm you are working with exactly 6dfdfff and also don't have other stale |
Thanks! I've had a quick read and am actually thinking I can ditch @joaotavora - I've just double checked and the version was correct but I must have had a stale Do you need to communicate anything with the |
Nothing against those projects, but these seem like exactly the outcomes that Eglot aims at: making users use fewers packages, and a leaner Emacs.
Yes.
Not really, as far as I can tell the, the server is compliant (regarding the completion capability imbroglio at least). Its issue #298 that has to be reopened, and that has impacts in the php language server, which is non-compliant. Quickly explained:
|
Thanks so much, for the help here and your work on eglot and yasnippet. I work in a couple of other languages so I'll be trying eglot on them too, and will contribute where I can. |
I take it this means eglot and elm are not to be friends in the near term? If so, I will open an issue over at elm-mode to update the readme and close this rabbit hole to others. |
@cameron I think the comment you pointed to is regarding php-language-server (being non-compliant) elm-language-server seems to be compliant and compatible with eglot once the correct commit is merged. See below.
|
Beautiful, thanks for the clarification! |
This helped me, thanks! TLDR: |
…:triggerCharacters Only query completionProvider -> triggerCharacter information if the server has provided it. Elm's, and probaly other's, do not provide it, which doesn't mean they don't support completion. * eglot.el (eglot-completion-at-point): Check that completion capability is a list before treating it like one.
…:triggerCharacters Only query completionProvider -> triggerCharacter information if the server has provided it. Elm's, and probaly other's, do not provide it, which doesn't mean they don't support completion. * eglot.el (eglot-completion-at-point): Check that completion capability is a list before treating it like one.
Only query completionProvider -> triggerCharacter information if the server has provided it. Elm's, and probaly other's, do not provide it, which doesn't mean they don't support completion. * eglot.el (eglot-completion-at-point): Check that completion capability is a list before treating it like one. #285: joaotavora/eglot#285
Only query completionProvider -> triggerCharacter information if the server has provided it. Elm's, and probaly other's, do not provide it, which doesn't mean they don't support completion. * eglot.el (eglot-completion-at-point): Check that completion capability is a list before treating it like one. GitHub-reference: fix joaotavora/eglot#285
For those with an Elm project with no Git repository, this might help: (add-to-list 'project-find-functions #'project-rootfile-try-detect t)
(add-to-list 'project-rootfile-list "elm.json") |
First of all, Thanks a bunch for this excellent software.
Does Elm Language Server work with eglot ?
If yes, can you add it to the README ?
The text was updated successfully, but these errors were encountered: