Elm Extension for VSCode (by Elm Tooling) Only Works for One Elm Application

Since the old VSCode extension for Elm (by Elm) got deprecated, I moved on to Elm Tooling’s Elm extension. Using version 0.7.4, the extension works perfectly for only one Elm application only within my workspace. For the other applications, the analysis report does not update at all (the warnings/errors are generated only once when VSCode starts up); formatting on the other side does not work at all; no errors or warning hinting any issue related to the extension is shown.

My workspace is essentially a directory representing a Phoenix application, within which there are 2 Elm applications. You can get some idea about the structure here:

As you can see, I got 2 Elm applications, namely - page_definition_editor, and user_permissions_manager. Each having its own elm.json file, and src directory.

Here are my settings for the extension:

Can anyone help me out with this?

1 Like

You might try creating separate vscode workspaces at the base of each of your elm apps (one each in the same folders where your elm.json files are). Then you open them in separate vscode windows.
It’s not a perfect solution, but I think it should work.

2 Likes

You’re right, it does work separately. This extension isn’t simply capable of managing multiple Elm apps in a workspace. The “elm-stuff” content is also messed up by the extension since it generates the object files for all the Elm files it can find on the workspace in every single app. In this age of building apps with multiple languages, this extension wasn’t simply expected to work with no more than 1 Elm app at once. Besides this, it was a wonderful extension. Thank you for your response, I’ll have to keep one Elm app in one workspace - no more, no less.

Okay, I found a fix for this issue. It’s a bug in elm-language-server upon which this extension is based. Sentience got a fix for this in his fork. As of now, this fix hasn’t been merged, so you may need to do it yourself if you can’t wait.

How to rebuild the extension with the fix:

  • Clone the VSCode extension; doesn’t matter if you do it recursively or not cause we’ll be replacing the server in the next step.
  • Clone the fixed version of the elm-language-server.
  • Replace server in the VSCode extension’s directory with contents of the fixed version of elm-language-server.
  • Build the source in both the repositories as per as the instructions in the GitHub repositories.
  • Package the whole thing together as a VSCode Extension based on the instructions here.

Install the newly packaged extension and it should fix the issue for you!

Note: It’s better to wait for the fix to get merged and released. It’s going to get released any day now.

1 Like

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