halohalospecial / atom-elmjutsu

A bag of tricks for developing with Elm. (Atom package)
https://atom.io/packages/elmjutsu
MIT License
192 stars 24 forks source link

elmjutsu seems to stop looking for elm-package.json at Main.elm folder #96

Closed raffomania closed 6 years ago

raffomania commented 6 years ago

My elm files live in a subfolder of my project:

├── client
│   ├── Animations.elm
│   ├── Main.elm
│   ├── Messages.elm
│   ├── Model.elm
│   ├── Stylesheets.elm
│   ├── Update.elm
│   └── View.elm
├── elm-package.json

elmjutsu is, after updating to 7.0.5, no longer able to find elm-package.json. I'm not sure why, as elm-package.json is definitely in my atom project root.

I have the same problem with atom-linter-elm-make; When telling it to generate elm-package.json for me, it creates a new one in the client folder, so I suppose both blugins might stop looking after finding Main.elm?

raffomania commented 6 years ago

Repo in question: https://github.com/Nukesor/spacesurvival

raffomania commented 6 years ago

I had a look at the code, the offending line seems to be https://github.com/halohalospecial/atom-elmjutsu/blob/b9727c27485633d3c2dda8a6819689d28f670d24/lib/helper.js#L614

making elmjutsu always stop searching one folder beneath the project root, as parentDirectory does not contain a trailing path separator, in comparison to the second argument, e.g.:

!containsPath('projects/foo', 'projects/foo' + '/') // == true

A quick fix would be removing the path.sep addition at the end of the line, but I don't know why it's there in the first place so maybe that would break something?

timjs commented 6 years ago

I have the same problem but reverting to 7.0.2 (which I had installed before) doesn't help. Maybe it is regression in Atom's core from 1.21.1 to 1.21.2? I updated it at the same time.

saturday06 commented 6 years ago

@timjs downgrading elmjutsu and linter-elm-make works for me.

apm uninstall elmjutsu
apm install elmjutsu@7.0.4
apm uninstall linter-elm-make
apm install linter-elm-make@0.26.2
timjs commented 6 years ago

Works too for me!

halohalospecial commented 6 years ago

Sorry, was busy earlier. I'll publish a fix in a few minutes. Thanks for the report!

halohalospecial commented 6 years ago

Hi! Can you try elmjutsu v7.0.6 and linter-elm-make v0.27.1? Thanks!

saturday06 commented 6 years ago

Both updates work fine for me. Thanks!

raffomania commented 6 years ago

Works for me too, thanks for the incredibly fast response!

halohalospecial commented 6 years ago

@raffomania, thanks for providing a sample repo! It was working on my setup :)

timjs commented 6 years ago

Works great! Thanks a lot!