question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Confusing error message when elm-test absent in PATH

See original GitHub issue

https://github.com/elm-tooling/elm-language-server/blob/964a7d0b50c123cf0aebe2f87c9bf6bb79fb298a/src/providers/diagnostics/elmMakeDiagnostics.ts#L304

I didn’t quite follow the code, but here’s what I observe at runtime:

  • Running neovim with nvim-lspconfig and elm-language-server=2.3.0

  • Just elm in PATH

  • 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, not elm-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:open
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lydellcommented, Apr 2, 2022

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? 🤔

1reaction
razzeeecommented, Mar 16, 2022

Yeah, that’s probably a nvim-lspconfig thing, as vscode does not capture your focus in that case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · elm-tooling/elm-language-server - GitHub
coc.nvim fails to start language server with error about "unregistered dependency token ... Confusing error message when elm-test absent in PATH.
Read more >
Great compiler messages? Great test failure messages!
In comparison to that, the error message we got from elm-test was lacking in helpfulness. If we only had a single assertion that...
Read more >
Using elm-test in a git hub action - Stack Overflow
Any advice on how to install elm-test inside a git hub action? Edit: Without the sudo the error becomes npm WARN checkPermissions ...
Read more >
exercism/support - Gitter
Hi. I'm getting "Error: You are giving module Main an argument in JavaScript." when I elm-test HelloWorldTests.elm . I can't see any JavaScript...
Read more >
Elmer: An Elm Testing Tool - Show and Tell - Elm Discourse
create beautiful error messages; provide a bunch of support in the elm-test runners easily; use decoders for all the parsing of nodes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found