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.

utils.getElmVersion returns empty version

See original GitHub issue

Expected Behavior

Extension should work (look for Elm packages in right directory) utils.getElmVersion should return Elm version that is installed. 0.19.1 in this case.

Current Behavior

UPDATED: Found that utils.getElmVersion is returning empty value instead of version.


Opening the elm-spa-example project. The only thing that seems to work is syntax highlighting. One of the first errors in output is Error: ENOENT: no such file or directory, open 'C:\Users\janis\AppData\Roaming\elm\packages\NoRedInk\elm-json-decode-pipeline\1.0.0\elm.json' The file is actually located in C:\Users\janis\AppData\Roaming\elm\0.19.1\packages\NoRedInk\elm-json-decode-pipeline\1.0.0\elm.json See the 0.19.1 version part.

The weird thing is that it worked the first time I installed it (moments before I reinstalled it). Basically I installed the extension. It worked. Then noticed numbers next to elm files in file explorer and was wondering if that is extension feature or vscode feature (which I had just updated as well) as I couldn’t understand what they meant. Fastest way to check from where the features comes? Uninstall extension. Uninstalled it, numbers were gone. Ok, so that is extensions feature. Installed it back and it doesn’t work any more.

Then I found the ENOENT error and that I had two version folders inside AppData\Roaming\elm\packages\ - 0.19.0 and 0.19.1. Uninstalled both Elm versions. Deleted elm-spa-example project Deleted elm folder in AppData\Roaming Installed Elm 0.19.1 Cloned project again and built it, but the path is still as AppData\Roaming\elm\0.19.1\packages

Possible Solution

No solution, but seems that extensions is looking for packages in the wrong directory.

Your Environment

  • Version used: v2.0.3

vscode info: Version: 1.53.1 (system setup) Commit: 5d424b828ada08e1eb9f95d6cb41120234ef57c7 Date: 2021-02-08T23:29:42.785Z Electron: 11.2.1 Chrome: 87.0.4280.141 Node.js: 12.18.3 EDIT: Updated to v14.15.5 V8: 8.7.220.31-electron.0 OS: Windows_NT x64 10.0.17134

Full log

[Info  - 7:49:48 PM] Loading Elm tree-sitter syntax from c:\Users\janis\.vscode\extensions\elmtooling.elm-ls-vscode-2.0.3\server\out\tree-sitter-elm.wasm
[Info  - 7:49:48 PM] Found 1 elm.json files for workspace f:/dev/elm-spa-example
[Info  - 7:49:48 PM] Found 1 unique elmWorkspaces for workspace f:/dev/elm-spa-example
[Info  - 7:49:48 PM] Starting language server for folder: file:///f%3A/dev/elm-spa-example
[Info  - 7:49:48 PM] Elm version  detected.
[Info  - 7:49:48 PM] Reading elm.json from f:/dev/elm-spa-example/elm.json
[Error - 7:49:49 PM] Error parsing files for f:/dev/elm-spa-example/elm.json:
Error: ENOENT: no such file or directory, open 'C:\Users\janis\AppData\Roaming\elm\packages\NoRedInk\elm-json-decode-pipeline\1.0.0\elm.json'
[Error - 7:49:49 PM] Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'getTree' of undefined
[Error - 7:49:49 PM] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'getTree' of undefined
  Code: -32603 
[Error - 7:49:49 PM] Request textDocument/codeAction failed.
  Message: Request textDocument/codeAction failed with message: Cannot read property 'getTree' of undefined
  Code: -32603 
[Error - 7:49:49 PM] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'getTree' of undefined
  Code: -32603 
[Error - 7:49:49 PM] TypeError: Cannot read property 'getTree' of undefined delayed processing of request
[Error - 7:49:49 PM] Request textDocument/codeLens failed.
  Message: Request textDocument/codeLens failed with message: Cannot read property 'getTree' of undefined
  Code: -32603 
[Error - 7:53:14 PM] Request textDocument/codeAction failed.
  Message: Request textDocument/codeAction failed with message: Cannot read property 'getTree' of undefined
  Code: -32603 
[Error - 7:53:15 PM] Notification handler 'textDocument/didSave' failed with message: Cannot read property 'getTree' of undefined

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jlocanscommented, Feb 13, 2021

Yeah, I was just following the spa project instructions. Thanks for your help @Razzeee

0reactions
razzeeecommented, Feb 13, 2021

Right, I always recommend to not use elm.js as windows finds this confusing https://github.com/evancz/guide.elm-lang.org/pull/244

Still, this is a new place to show this problem, as we just recently had to introduce that elm --version call

Read more comments on GitHub >

github_iconTop Results From Across the Web

elm-language-server/program.ts at main - GitHub
const readFile = util.promisify(fs. ... return Promise.resolve(cached); ... `Could not figure out elm version, this will impact how good the server works.
Read more >
elm-tooling - Bountysource
After saving a module problems that no longer exist are reported in the Problems panel. ... utils.getElmVersion should return Elm version that is...
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