lspitzner / brittany

haskell source code formatter
GNU Affero General Public License v3.0
690 stars 72 forks source link

Append input path name to UnknownNode errors #185

Closed 5outh closed 6 years ago

5outh commented 6 years ago

Appends the name of the input file to any UnknownNode errors. This is useful when running brittany over a set of source files.

Example output:

ERROR: encountered unknown syntactical constructs when parsing file "library/Application.hs":
HsSpliceE{}
ERROR: encountered unknown syntactical constructs when parsing file "library/Foundation.hs":
HsSpliceE{}
ERROR: encountered unknown syntactical constructs when parsing file "library/FrontRow/Api/ActivityFeed/Handler.hs":
HsBracket{}
HsBracket{}
HsBracket{}
ERROR: encountered unknown syntactical constructs when parsing file "library/FrontRow/Api/DistrictAssessment/Handler/Answers.hs":
HsBracket{}
ERROR: encountered unknown syntactical constructs when parsing stdin:
HsSpliceE{}

Closes #175.

lspitzner commented 6 years ago

I was so free to push another commit. Would you mind confirming if this still works as desired for some multiple-file testcase?

(and tell if you prefer the previous behaviour - i just thought "wait, we really should have the full srcspan info available in ErrorUnknownNode" and used that.)

5outh commented 6 years ago

@lspitzner All works on my end. In fact, that's even better. Thanks!

lspitzner commented 6 years ago

thanks!