Open dfalling opened 1 month ago
alas, sorry this got you. i have some loose heuristics that try to do the least damage possible, but don't currently have a good solution here. likely sourceror's comment algorithm would do a better job, but last i checked it's not fast enough to be run as part of mix format 🤔
on the upside, once you fix the comments up once styler won't keep throwing things around. it's just that first sort where things can 💥
thanks for the issue ❤️ this is at least more data to try to tune things to behave better
Thanks for the response! I've manually fixed the comments for this styler upgrade. Sadly it's something that can sneakily resurface when new config with comments is added in the future. Devs have to be attentive in PRs to make sure the comments go with the code.
Sadly it's something that can sneakily resurface when new config with comments is added in the future
I'd be really interested in a repro for this, haven't experienced it myself. Likely because I'm only working in enormous config files...
A fresh mix phx.gen.new
will reproduce this.
Right, i mean specifically for "can sneakily resurface when new config with comments is added". I'd love one where adding one or two new config messes up an already-sorted config
came up with my own repro yesterday, sad bug indeed. no easy fix currently, so this may unfortunately sit a while longer
Hi, first off thanks for this great lib! I've been using it for quite a while now and really love the improvements over the stock formatter.
Issue
Styler 1.0.0's extensive reformatting of config files separates many code comments from the lines they're annotating.
Versions
Elixir 1.17.1 (compiled with Erlang/OTP 25)
Stacktrace / Current Behaviour
Notice several blocks of code have been separated from their respective comments:
# Env variables
# We don't run a server during test. If one is required,
In my more complex config files (prod, runtime, dev), it's even messier.
Is there a different style of code commenting I should be using to prevent this? The majority of my config comments are scaffolded from the generators, so I won't be alone in hitting this.