I'm trying to run lsp-mode
for elm development and according to lsp-mode elm is supported. Also according to that link, I should only have to clone the elm-language-server repository, run npm install
and then tsc
, all of which I did, without any errors.
After configuring emacs with the following from here
(require 'lsp-mode)
(add-hook 'elm-mode-hook #'lsp)
(setq lsp-elm-server-install-dir "~/Projects/elm-language-server")
everything should be set to go.
When I do this, everything seems to work. lsp-mode
starts when I open an elm file and it starts the elm-language-server
. I end up with an *lsp-log*
buffer, an *elm-ls*
buffer and an *elm-ls::stderr*
buffer.
The output from the *lsp-log*
buffer doesn't look too suspicious:
Command "node /home/chris/Projects/elm-language-server/out/index.js --stdio" is present on the path.
Found the following clients for /home/chris/Projects/select-elm/src/Main.elm: (server-id elm-ls, priority -1)
The following clients were selected based on priority: (server-id elm-ls, priority -1)
Rebuilding tree-sitter for local Electron version
Fetching tree-sitter
Downloading from https://github.com/tree-sitter/node-tree-sitter/releases/download/v0.14.0/tree-sitter-v0.14.0-node-v57-linux-x64.tar.gz
Fetching tree-sitter-elm
Downloading from https://github.com/razzeee/tree-sitter-elm/releases/download/v2.2.4/tree-sitter-elm-v2.2.4-node-v57-linux-x64.tar.gz
Rebuild succeeded!
initializing - folder: "file:///home/chris/Projects/select-elm/"
Reading elm.json from /home/chris/Projects/select-elm/elm.json
2 source-dirs found
Found 39 files to add to the project
Adding /home/chris/Projects/select-elm/src/01-button.elm
Received new elm-analyse report with 1 messages
Received new elm-analyse report with 1 messages
Adding /home/chris/Projects/select-elm/src/form.elm
Adding /home/chris/Projects/select-elm/src/Main.elm
Adding /home/chris/Projects/select-elm/src/select.elm
Adding /home/chris/Projects/select-elm/src/text.elm
....
although the "-1" in (server-id elm-ls, priority -1)
might be an indicator something is wrong.
The *elm-ls*
buffer is empty and the *elm-ls::stderr*
is where there is a definite problem:
(node:30435) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: "file" argument must be a non-empty string
(node:30435) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:30435) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: ENOENT: no such file or directory, open 'file:///home/chris/Projects/select-elm/src/Main.elm'
(node:30435) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): TypeError: "file" argument must be a non-empty string
(node:30435) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): Error: ENOENT: no such file or directory, open 'file:///home/chris/Projects/select-elm/src/Main.elm'
(node:30435) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): TypeError: "file" argument must be a non-empty string
Unfortunately I haven't been able to find anything on the web about this. In my elm buffer I simply get an error message on the very first line "Error parsing file". The file does compile using elm make
though.
Anyone have any idea how to debug this? I'm using elm 0.19.0 and unfortunately the normal elm-mode isn't an option for me because elm 0.19.0 has created a lot of breaking changes that the maintainers of elm-mode are having a hard time fixing.