-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Confusing error message when elm-test absent in PATH #685
Comments
Yeah, that's probably a nvim-lspconfig thing, as vscode does not capture your focus in that case. |
Oh, but I don't think the error message has been fixed? At least the linked file hasn't been updated |
I think thats a newish regression, previously we ended up at https://github.com/elm-tooling/elm-language-server/blob/main/src/providers/diagnostics/elmMakeDiagnostics.ts#L274 , but we now chain to elm-test if I remember right, which likely causes this |
Not sure why, but if I uninstall elm-test and try this with vscode, I'm getting a hint that I need elm-test |
Hmm. I've just re-checked, I'm getting a message about the "elm compiler", not elm-test. Maybe something has changed since 2.3.0 |
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: elm-language-server/src/compiler/utils/elmUtils.ts Lines 83 to 93 in b22398b
Maybe the error isn’t ENOENT on your system? 🤔 |
Thank you @lydell! Given that I do not have a dev environment set up for elm-language-server, what would be the easiest way to verify your ENOENT hypothesis? |
You could edit the .js files of your elm-language-server installation. They’re pretty similar to the TypeScript source code. I’d add some You could also try running elm-language-server with PATH set so that
Also, looking at the code again, it could be that the error message is wrong, too: elm-language-server/src/providers/diagnostics/elmMakeDiagnostics.ts Lines 303 to 307 in 964a7d0
The condition looks flipped to me: If Also, this line is wrong:
It says “Install Elm via 'npm install -g elm-test'” but it should say “Install elm-test”. This is a very complicated piece of code (unfortunate complexity), and it’s hard to test so it feels like there could be a few bugs hiding… |
If your using https://github.com/elm-tooling/elm-language-client-vscode#contributing--debugging you should be able to setup breakpoints and attach to the server with one of the profiles. It's quiet hard to attach right at the start, but I remember that there's a setting somewhere to wait for a debugger to attach - on the vscode side. |
elm-language-server/src/providers/diagnostics/elmMakeDiagnostics.ts
Line 304 in 964a7d0
I 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:
(note it says
elm
, notelm-test
)The window isn't closed until you press
Enter
once againThis happens on every subsequent
:w
as wellThe workaround I found:
elm-test
to the devshell:w
works fineP.S. I'm not sure if I should open an issue about the pop-up window here or in
nvim-lspconfig
.Either
elm-language-server/src/compiler/utils/elmUtils.ts
Line 96 in b22398b
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)The text was updated successfully, but these errors were encountered: