elm-lang / elm-make

A build tool for Elm projects
BSD 3-Clause "New" or "Revised" License
175 stars 45 forks source link

Add support for filename and line number in json docs #29

Closed ajhager closed 8 years ago

ajhager commented 9 years ago

This is used in, for example, the golang docs to link to the original source files. This could also be used by other tooling for 'jump to definition'.

My suggestion is the source entry in the example docs json below, or something like it:

"values": [{
  "name": "fromElement",
  "comment": "Embed an `Element` as `Html`.",
  "type": "Graphics.Element.Element -> VirtualDom.Node",
  "source": "src/Html.elm#110",
}]
evancz commented 9 years ago

Interesting! That might not be too tough, and it covers a ton of typical cases!

ajhager commented 9 years ago

I have a PR 99% ready for this issue and elm-lang/package.elm-lang.org#35, but it involves minor changes to elm-compiler, elm-package, elm-make, and package.elm-lang.org, so I will coordinate that after work.

Just wanted to mention in case someone else was thinking of working on it soon.

evancz commented 9 years ago

Any word on this? I'm gonna try to get 0.16 out in the next week and this seems like a nice thing to add.

And should the format of the location be more precise? Like { "file": "src/Html.elm", "start": 110, "end": 113 } or something? It feels like a pain to have to parse apart something like src/Html.elm#110-113 unless the intent was for it to go directly to github. I imagine people wanting to use this in editors too though.

And is there any reason to include column information here? I kind of feel like there is not, but I'm not certain.

evancz commented 8 years ago

Tracking from meta issue #98

rundis commented 8 years ago

getting line number [start - to] would be awesome. Allows showing code inline/popup in editors.