ElmCast / elm-vim

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

Add elm.json fallback to FindRootDirectory #167

Closed H12 closed 5 years ago

H12 commented 5 years ago

Was running into an issue with :ElmTest in elm 0.19.0 where it was unable to find the root directory. Did a little digging, and found that elm#FindRootDirectory only looks for elm-package.json, and not elm.json.

So I added a fallback so that if an elm-package.json cannot be found, FindRootDirectory will look for an elm.json file before returning an empty string. After Pluging my forked repo, this fix appears to have the desired behavior.

I'm a total vimscript noob, though, so please let me know if anything looks off.

mdxprograms commented 5 years ago

@H12 This looks solid to me. Only feedback is I think we can combine the two if statements since they are checking for the same result here: https://github.com/ElmCast/elm-vim/blob/dab5d39895d8df0ac5ecfd53cfbde7ab5de6d0fc/autoload/elm.vim#L351

H12 commented 5 years ago

@mdxprograms Thanks, I've updated so that the match for elm-package.json and elm.json have their own variables, rather than re-assigning the original match variable.

mdxprograms commented 5 years ago

👍 LGTM!