unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.78k stars 270 forks source link

Look into whether ormolu is expected to be able to format just imports #2746

Closed aryairani closed 2 years ago

aryairani commented 2 years ago

See https://github.com/unisonweb/unison/pull/2713/files#r765360035

Towards #2666, #1760

aryairani commented 2 years ago

Do you mean that when you tried moving {- ORMOLU_DISABLE -} below the imports, ormolu still didn't format the imports?

Yes, that's what I observed, but didn't dig into why that's the case (it didn't seem super important)

I'm observing the same (in vscode); kind of frustrating that the auto-formatter doesn't auto-format!

aryairani commented 2 years ago
% ormolu parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs
parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs
  AST of input and AST of formatted code differ.
  Please, consider reporting the bug.
% 

I alo get this error when I try formatting it manually, under various scenarios, I think it's related to the above.

It has something to do with {- ORMOLU_DISABLE -}, as auto-formatting in the IDE and at the command-line work without it. Adding {- ORMOLU_ENABLE -} doesn't obviously help.

mitchellwrosen commented 2 years ago

I reported this upstream; here's a workaround in the meantime: https://github.com/tweag/ormolu/issues/856#issuecomment-1007982154

aryairani commented 2 years ago

It is expected to, just without comments on the same line as the DISABLE directive.