Closed brandonchinn178 closed 1 year ago
Thanks! I merged only the first commit though because I'm not sure about the benefits vs mental cost of the others.
@mrkkrp Thanks! I do think the refactor is an improvement for overall understandability. e.g. it's a bit confusing IMO for CabalInfo to be different for the same cabal file but different source files. Do you mind if I open a separate PR to discuss that?
CabalInfo
could be construed as "Cabal information for this particular module we are formatting". Feel free to open a separate PR though.
Resolves #1032
Technically, only the first commit is necessary to solve the issue. But I refactored the
CabalInfo
subsystem to ensure that the formerCabalFileNotFound
+CabalFileDidNotMention
branches used the same logic. Specifically, this change allowsrefineConfig
to be the sole source of truth for defining the Cabal information for both a cabal file not existing and a cabal file not mentioning a source file (previously, this was two different locations:parseCabalInfo
was doing it forCabalFileDidNotMention
andrefineConfig
was doing it forCabalFileNotFound
).Test
Add the following Haskell file:
Running
ormolu
on it formats the same in both cases: