ElmLS 2.0.0 is out!

New versions of the server and the vscode extensions are out, welcome to version 2.0.0.

It’s a very big release, so read the changelog below and ask questions. Here’s the complete diff https://github.com/elm-tooling/elm-language-server/compare/1.13.2...master

The most obvious behavior changes, will probably be, that we try to report errors whenever you type and only run elm make when you save a file. Followed by that elm-analyse has been removed and replaced by our own linter.

2.0.0

Features

  • Enabled type checking diagnostics that update on document change. These include parsing errors, type mismatch errors, value not found errors, etc

  • Support file events APIs (Previously VSCode only)

    • On file create, the module name will be inserted
    • On file rename, the module name and all references will be updated
  • A new “extract function” code action. Select a complete expression and it can be extracted to a function in the top level or the enclosing let expression (if there is one)

  • A new “install package” code action. When you try to import a module that is not installed, a code action will offer to install it. (we only check your local elm cache for possible packages and there is a setting to control skipping confirmation)

  • Replaced elm-analyse with our own diagnostics, there might be missing rules for you due to this

  • Show inferred type information on hovers

  • Support linked editing ranges. When editing a function name, the type annotation name will auto rename, or vice versa (needs to be enabled in most clients)

  • Watch elm.json for changes. The server will restart when a change is detected

  • Run elm make on server init

  • Improve record completions

  • Ports now have codeLenses, can find references and have correct types on mouseover

Bug Fixes

  • Greatly improve performance of diagnostics and type inference
  • Fix some type inference cases
  • Fix module resolution to be more like how the compiler resolves modules
  • Fix some incorrect unused value diagnostics
  • Fix how errors from third party binaries are shown
  • Fixed test dependencies being available in non test modules

Other Changes

  • Update package rankings
  • Update our parser

We had contributions from @jmbockhorst, @dmy, @lydell and myself this iteration.

Please consider sponsoring our work on this and other projects:

If you find any bugs or have ideas for new features, feel free as always to create an issue on GitHub.

https://marketplace.visualstudio.com/items?itemName=Elmtooling.elm-ls-vscode

49 Likes

Nice! Looking forward to test it out tomorrow :slight_smile:

1 Like

That all sounds amazing :+1:

A question on the major version: Should people expect breaking changes in a way? Is the removal of elm-analyse the only possible breaking change? Or is it more of a major version because it reached a level of features/stability which you are happy with?

1 Like

Thanks, upgraded and immediately got 78 problems in the current project :rofl: - but they were from your linter so all good. (I hadn’t run elm-analyse after a big refactor).

Maybe I wasn’t set up correctly with 1.5.3, but I previously had to run elm-analyse from the terminal in vscode, whereas in 2.0.0 your linter picks up issues instantly with no config required which is great.

:+1:

1 Like

It’s just a big changelog and kind of a paradigm shift, as we run checks on typing now. So it’s type, see if we complain -> move on. Previously you had to save after each change, to see errors. You will need to do that now too, but it should be far less and hopefully we can phase it out completly.
And yes, we choose not to migrate some of the elm-analyse rules for now.

We had to make elm-analyse opt in at one point, as it was too slow. Especially on bigger projects.

3 Likes

2.0.0 is amazing! I really like that I see my errors while typing instead of seeing it on save! :slight_smile:

2 Likes

Even though I am not using Elm anymore, its always amazing to see your progress.

Your language server is a living proof that sometimes you need to just start doing things instead of eternally questioning “is this the right way?”

2 Likes

Always awesome when a new update arrives :slight_smile:

1 Like

Is there a way to configure ElmLS diagnostics? Is my elm-analyse.json file useless now?

No, should still pick up your elm-analyse.json - but there are some rules we thought are not worth to port. See elm-language-server/elmLsDiagnostics.ts at 4f8634f43db0ab879abdb39f13e2268c219743de · elm-tooling/elm-language-server · GitHub and let us know, if there are rules that you think are valuable, that we missed.

1 Like

Awesome. As long as excludedPaths is supported, I’m fine :grin:

1 Like

Pushed a hotfix:

2.0.1

  • Fix elm package install command

  • Updated language server

    • Fixed test files not being recognized correctly on windows
    • Fixed some type inference problems
    • Fixed linked editing ranges breaking, when deleting a whole word
    • Remove file entry from symbolproviders (Outline, Go to symbol and breadcrumbs)
    • Don’t show files from dependencies in WorkspaceSymbolProvider (Go to symbol in workspace)
4 Likes

Thank you for that, I find the outline view experience to be much better now :+1:

1 Like

After upgrading, anyone having problems with Vim and Ale?

I am see parsing errors on Elm code that is correct. I will open a Github issue, unless there is something know about Vim/Ale – perhaps I got the setup wrong. Although I did try a clean Vim setup.

What I have discovered is running :ALEReset will fix the issues and then display the expected warnings or errors.

Pushed some more hotfixes, likely more to come:

  • Updated language server
    • Updated dependency, so that Apple M1 based laptops should work
    • Improve unused import diagnostics
    • Fix the disableElmLSDiagnostics setting not working
    • Don’t crash if server fails to initialize
    • Fix wrong display of fix record diff
    • Handle kernel code usages better
    • More type checker improvements
5 Likes

Next round of fixes:

  • Updated language server
    • Add setting to disable diagnostics on change
    • Improve performance of unused diagnostic
    • Improve completions
    • Fix problem with type inference caching
7 Likes

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