elm-language-server: utils.getElmVersion returns empty version

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

About this issue

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

Most upvoted comments

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