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

Some features not working when files have CRLF line endings #38

Closed mandrolic closed 7 years ago

mandrolic commented 7 years ago

Don't seem to get hyperlinks for the functions declared local to a file, Elmjutsu -> Go to definition also has no effect

halohalospecial commented 7 years ago

Hi! Maybe you can post a screen capture that shows the issue? Thanks!

mandrolic commented 7 years ago

Hard to convey with screenshots, but with hyperclick installed, here is me pressing the ctrl key: image

and here is me doing the same thing on the 'foo' function. No hyperlink, and the Elmjutsu context menu does not work either image

This is with the latest version (2.17 I think) on Windows 10

halohalospecial commented 7 years ago

Hmm.. I copied the code in the screenshot and it's working for me (using Lubuntu). How about sample project files? I don't have a Windows 10 machine though :cry:

mandrolic commented 7 years ago

This happens with just the Main.elm you see in the clipping, sadly, so the only other thing in the directory is the default elm-package.json that you get with 'elm-package install', i.e:

{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "5.0.0 <= v < 6.0.0",
        "elm-lang/html": "2.0.0 <= v < 3.0.0"
    },
    "elm-version": "0.18.0 <= v < 0.19.0"
}

Must be a platform issue. Can't help you with a Win 10 machine - but if there is an easy way for me to switch on debugging etc I can help that way.

halohalospecial commented 7 years ago

You can try running Atom using atom -d and check the console (Ctrl-Shift-i) for errors.

Are the other features working? You mentioned that Go To Definition is also not working. Maybe the plugin is not parsing your project files properly for some reason. Try to toggle the Sidekick panel to check if it's showing information for the symbols in the file.

mandrolic commented 7 years ago

Sidekick panel shows for dependencies, but not for project types. So it agrees with the Go-to definition in that sense.

Looking at the console, elmjutsu does scan the files, and there are no errors logged:

[elmjutsu] Parsing project directory C:\dev\elmjutsuTest... [elmjutsu] Parsing C:\dev\elmjutsuTest\A.elm [elmjutsu] Parsing C:\dev\elmjutsuTest\Main.elm [elmjutsu] Parsed project directory C:\dev\elmjutsuTest

mandrolic commented 7 years ago

OK it's a good old EOL issue. Atom on Windows by default is using CRLF, on *nix you'll only have LF, and probably that's all the downloaded dependency coded uses too, which explains why they work. I'm not sure what the actual fix is but from stepping through the code, the regexes in indexing.js are failing to match. Perhaps they could be tweaked?

halohalospecial commented 7 years ago

Hi @mandrolic! Thank you so much for taking the time to debug this. Can you check if the latest version (2.17.2) works? I was able to replicate the issue by changing the line ending in Atom to CRLF.

mandrolic commented 7 years ago

Hooray! that fixed it. Great thanks, that will make some Elm/Windows users happier (assuming it's not just me)

halohalospecial commented 7 years ago

I'm still wondering why this is the first time someone brought this up :thinking: Thanks again for debugging :tada:

OvermindDL1 commented 7 years ago

I'd not encountered it because I already had my line endings set that way. 😅