Elm autocomplete with Vim?


I’m using Vim with ALE. Syntax highlighting works. Errors highlighting works, so it is clear that ALE is able to communicate with the language server.
However, I can’t find a way to get autocomplete to work.

Say I have a model such as

type alias Model =
    { speed: Float
    , username: String

Before Vim I used to use Atom. When using a variable that had type Model, I was be able to write


then I’d be suggested speed or username.
But it doesn’t work in Vim with ALE. Even when typing “Ctrl + n” to trigger the autocomplete, I’m basically suggested all the words that have been typed in the source file. I guess this is the default behavior for autocomplete in Vim. But I’d like to have autocomplete specifically for Elm, just like in Atom.
Is that possible ?

Replying to my own question. The problem stemmed from an incompatibility between the version of nodejs on my system and the elm language server. The nodejs version installed was 18, it didn’t work with that version of nodejs. I installed nodejs version 16 instead and now the autocompletion is working as it should, and I even have the function definitions, that I was missing as well.

cf Error on elm-language-server attach due to node 16 and higher · Issue #692 · elm-tooling/elm-language-server · GitHub


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