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

Order comments by position #73

Closed
jfmengels opened this issue Jun 21, 2020 · 0 comments · Fixed by #102
Closed

Order comments by position #73

jfmengels opened this issue Jun 21, 2020 · 0 comments · Fixed by #102

Comments

@jfmengels
Copy link
Collaborator

In elm-review, I currently sort comments by their start position.
I seem to remember that the comments were in a somewhat random order, but I can't reproduce anything else than just the reverse order.

Currently we have:

module TestModule exposing (..)

-- 1
a = ""
-- 2

which gives the following comment list:

[ Node <range> "-- 2"
, Node <range> "-- 1"
]

and I think that having it be in the reverse order will be more intuitive and useful:

[ Node <range> "-- 1"
, Node <range> "-- 2"
]

Side-note: I seem to understand that the way documentation is added in post-processing is by going through all comments and looking at ranges.
I think that having sorted them be sorted can lead to optimizations, like not going further down the list if the start range of the item to look for is before the current item's start range (In other words, using a recursive function rather than List.filter + List.head). I am not good at benchmarking, but that does sound faster to me than the current way, and sorting comments would help with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant