Confusing error message when elm-test absent in PATH
See original GitHub issueI didn’t quite follow the code, but here’s what I observe at runtime:
-
Running
neovim
withnvim-lspconfig
andelm-language-server=2.3.0
-
Just
elm
inPATH
-
Apply any edits to
src/Whatever.elm
and write,:w
-
Neovim interrupts with a pop-up window saying:
The ‘elm’ compiler is not available. Install Elm via ‘npm install -g elm’. I’m looking for commands at …
(note it says
elm
, notelm-test
) -
The window isn’t closed until you press
Enter
once again -
This happens on every subsequent
:w
as well
The workaround I found:
- Add
elm-test
to the devshell :w
works fine
P.S. I’m not sure if I should open an issue about the pop-up window here or in nvim-lspconfig
.
Either https://github.com/elm-tooling/elm-language-server/blob/b22398b3398b20640cbdd9cc6d6b70a14826b800/src/compiler/utils/elmUtils.ts#L96 is the wrong way to report an error to the lsp client, or nvim-lspconfig
handles it improperly, but the pop-up capturing the input makes for a very fragile UX (given that configuration issues just do happen from time to time)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top GitHub Comments
I wrote the code you linked to.
For files that are ambiguous – that might be tests, or might be not-yet-imported regular Elm code – the idea is to try type checking with elm-test, but not require it. The code tries to fall back on using elm.
If your workaround is to install elm-test, then the problem isn’t a confusing error message: The problem is that the fallback to plain elm doesn’t seem to work for you.
You can see here how we try the next command in the list if there’s an ENOENT error:
https://github.com/elm-tooling/elm-language-server/blob/b22398b3398b20640cbdd9cc6d6b70a14826b800/src/compiler/utils/elmUtils.ts#L83-L93
Maybe the error isn’t ENOENT on your system? 🤔
Yeah, that’s probably a nvim-lspconfig thing, as vscode does not capture your focus in that case.