ElmCast / elm-vim

Elm plugin for Vim
BSD 3-Clause "New" or "Revised" License
572 stars 102 forks source link

Error when you open vim from a different folder than elm.json is located #166

Closed wellyal closed 5 years ago

wellyal commented 5 years ago

I always have to cd for the root folder where elm.json is located so the elm-format plugin triggers correctly. Otherwise I keep receiving this error message.

I couldn't figure out what version of Elm you are using!

You should either run elm-format from the directory containing
your elm.json (for Elm 0.19) or elm-package.json (for Elm 0.18),
or tell me which version of Elm with --elm-version=0.19 or --elm-version=0.18
Hermanverschooten commented 5 years ago

I have the same issue, but not all the time and not in all projects. running :ElmFormat works fine.

Hermanverschooten commented 5 years ago

The difference between the 2 projects is: working:

problem:

wellyal commented 5 years ago

The problem is that the plugin is not using the latest version of elm (0.19) while the elm-webpack-loader is using elm 0.19. Run elm --version in case your elm version is updated to the latest version try this code as the ElmComponent wrapper instead of this plugin.

ckipp01 commented 5 years ago

I may be mistaken, but I believe this pull request should have fixed this issue no that it will fall back to FindRootDirectory. Are you able to check and report back?

Hermanverschooten commented 5 years ago

@ckipp01 Your PR is working for every command except format... The reason? elm format is being called with system and not s:ExecuteInRoot

ckipp01 commented 5 years ago

@Hermanverschooten I'll look into that. I have another PR that is dealing with elmMake so hopefully if that gets merged in I can start working on some of the other issues with various commands, including what you just mentioned.

EDIT: Actually, just seeing you sent a PR in to fix that. Cool. :+1:

Hermanverschooten commented 5 years ago

Ok, thanks

emarthinsen commented 5 years ago

This would be awesome to have a fix for.

dtaskoff commented 5 years ago

The problem was with elm-format itself, and it's already fixed there (version 0.8.2).