Elm-language-server with Vim CoC

Hi all, new to elm here and trying to set up vim to work with it.

I’ve spent a few hours now trying to set up CoC for the first time to work with the elm-language-server. The coc-json plugin works turnkey, but I run into issues with Elm.

Currently, the LS doesn’t start properly:
[coc.nvim] Server languageserver.elmLS failed to start: Error: Request initialize failed with message: Attempted to resolve unregistered dependency token: "ElmWorkspaces"

My CoC configuration:

{               
    "coc.preferences.formatOnSaveFiletypes": [    
      "elm"             
    ],                              
    "languageserver": {    
      "elmLS": {    
        "command": "elm-language-server",    
        "filetypes": [    
          "elm"    
        ],    
        "rootPatterns": [    
          "elm.json"    
        ],    
        "trace.server": "verbose",    
        "initializationOptions": {    
          "elmPath": "elm",    
          "elmFormatPath": "elm-format",    
          "elmTestPath": "elm-test",    
          "disableElmLSDiagnostics": false,    
          "skipInstallPackageConfirmation": false    
        }    
      }    
    }    
  }    

CocInfo shows:

## versions

vim version: NVIM v0.4.4
node version: v16.3.0
coc.nvim version: 0.0.80-1377f3bfcc
coc.nvim directory: /home/joshua/.local/share/nvim/plugged/coc.nvim
term: tmux
platform: linux

## Log of coc.nvim

2021-06-17T22:25:14.721 INFO (pid:47782) [services] - registered service "languageserver.elmLS"
2021-06-17T22:25:14.730 INFO (pid:47782) [services] - elmLS state change: stopped => starting
2021-06-17T22:25:14.735 INFO (pid:47782) [plugin] - coc.nvim 0.0.80-1377f3bfcc initialized with node: v16.3.0 after 89ms
2021-06-17T22:25:14.741 INFO (pid:47782) [language-client-index] - Language server "languageserver.elmLS" started with 47799
2021-06-17T22:25:15.338 INFO (pid:47782) [services] - elmLS state change: starting => stopped
2021-06-17T22:25:15.341 ERROR (pid:47782) [services] - Server languageserver.elmLS failed to start: ResponseError2: Request initialize failed with message: Attempted to resolve unregistered dependency token: "ElmWorkspaces"
    at handleResponse (/home/joshua/.local/share/nvim/plugged/coc.nvim/build/index.js:14139:40)
    at processMessageQueue (/home/joshua/.local/share/nvim/plugged/coc.nvim/build/index.js:13994:13)
    at Immediate.<anonymous> (/home/joshua/.local/share/nvim/plugged/coc.nvim/build/index.js:13980:11)
    at processImmediate (node:internal/timers:464:21) {
  code: -32603,
  data: undefined
}
2021-06-17T22:27:14.714 INFO (pid:47782) [attach] - receive notification: showInfo []

Really appreciate any help, I’ve been stumbling at this for a few days now.

Nevermind, for some reason the plugin works now. Maybe it needed more time to initialize.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.