Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a cli script so other editors can collect and use results #11

Open
mrozbarry opened this issue Jan 2, 2018 · 1 comment
Open
Assignees
Milestone

Comments

@mrozbarry
Copy link

Just looking briefly at the source, it looks like this is completely coupled to Atom, which is fine, but it means no other editor can use this really neat tool.

What would be interesting is if this were an npm package, that could be used like:

$ npm install -g elm-lens
$ elm-lens ./src/*.elm

And it would send out (maybe json?) information about each function, maybe something like:

[
  {
    "file": "path/to/file.elm",
    "line": 5,
    "name": "nameOfFunction",
    "definition": "nameOfFunction : Int -> Int",
    "externalReferences": [{ "file": "other/file.elm", "line": 72 }],
    "internalReferences": []
  },
  // ...
]

Not sure you'd need all that information, and maybe you could scope things a little better to make the json output much smaller, but that's the general gist. From there, you could pipe it to a file in unix like elm-lens ./src/*.elm > elm-lens.json, or from an editor, consume that json and show the appropriate information in the editor.

Haven't looked into the source code enough to know what sort of effort this would be, but it will satisfy 100% of the other issues that will crop up of "please support editor x."

@mbuscemi mbuscemi self-assigned this Jan 2, 2018
@mbuscemi mbuscemi added this to the 0.7.0 milestone Jan 2, 2018
@mbuscemi
Copy link
Owner

mbuscemi commented Jan 2, 2018

I had added editor abstraction to the roadmap here: https://github.com/mbuscemi/elm-lens/blob/0.2.0/README.md.

I would like to avoid abstraction work at this stage because of the well-known software development problem of premature optimization. What I have released is only a small portion of Elm Lens's planned functionality, and I think that trying to tack another editor on now would slow me down more in the long run. Once I have developed Elm Lens's major features, I'll be able to approach VS Code (and any other editor that supports JavaScript/Node-based plugins) with a much more coherent strategy for encapsulation of editor details.

Elm Lens is currently not too far off from that goal. I have the "workspace", "project", "navigation" and "text-editor-facade" abstractions that wrap editor-specific calls in a generic JS class. And the Elm part of the plugin is, by its very nature, completely decoupled from the editor, and this, I imagine, can be shared wholesale by any editors. The JS-layer abstraction is not perfect, but to reiterate, I'm wary of trying to perfect it at this stage. I know this will be frustrating for people who would like to see Elm Lens in their favorite editor now, but I think that by taking my time, I will be able to ultimately provide the best experience in those editors when I do execute on that implementation.

@mbuscemi mbuscemi modified the milestones: 0.7.0, 0.8 Jan 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants