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

brittany as invoked by haskell-language-server doesn't match local machine, formats badly #1533

Closed
jlebar opened this issue May 23, 2020 · 8 comments
Labels
component: formatters status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@jlebar
Copy link

jlebar commented May 23, 2020

I am finding that vscode-hie-server is formatting my code differently than when I invoke brittany locally.

Here's me invoking it locally:

$ brittany --version
brittany version 0.12.1.1
[snip]

$ brittany test.hs
f :: [String] -> Int
f (nm : cats : edges) =
  let edges' =
          map ((\[a, b] -> (a, [b])) . (map read . words)) edges :: [(Int, [Int])]
  in  0

In contrast, when I format from the command palette, I get something way worse:

f :: [String] -> Int
f (nm : cats : edges) =
    let edges' =
                map ((\[a, b] -> (a, [b])) . (map read . words)) edges :: [ ( Int
                      , [Int]
                      )
                    ]
    in  0

I am not sure what's going wrong here. Is vscode-hie-server invoking a rogue version of brittany on my machine? Could be. I tried all of the brittany binaries in ~/.stack and they had the first formatting, find ~/.stack -name brittany | xargs -n1 -I{} sh -c '{} test.hs'.

@fendor
Copy link
Collaborator

fendor commented May 23, 2020

vscode-hie-server is compiled with its own brittany version, namely brittany-0.12.1.1.
Maybe we are not picking up every configuration on your system?

@jlebar
Copy link
Author

jlebar commented May 23, 2020

Hi, thanks for your reply!

Maybe we are not picking up every configuration on your system?

I do have a ~/.config/brittany/config.yaml. That's the only config.yaml or brittany.yaml anywhere in my home directory. I didn't create this; the tool must have defaulted it.

Here's what's inside.

conf_debug:
  dconf_roundtrip_exactprint_only: false
  dconf_dump_bridoc_simpl_par: false
  dconf_dump_ast_unknown: false
  dconf_dump_bridoc_simpl_floating: false
  dconf_dump_config: false
  dconf_dump_bridoc_raw: false
  dconf_dump_bridoc_final: false
  dconf_dump_bridoc_simpl_alt: false
  dconf_dump_bridoc_simpl_indent: false
  dconf_dump_annotations: false
  dconf_dump_bridoc_simpl_columns: false
  dconf_dump_ast_full: false
conf_forward:
  options_ghc: []
conf_errorHandling:
  econf_ExactPrintFallback: ExactPrintFallbackModeInline
  econf_Werror: false
  econf_omit_output_valid_check: false
  econf_produceOutputOnErrors: false
conf_preprocessor:
  ppconf_CPPMode: CPPModeAbort
  ppconf_hackAroundIncludes: false
conf_obfuscate: false
conf_roundtrip_exactprint_only: false
conf_version: 1
conf_layout:
  lconfig_reformatModulePreamble: true
  lconfig_altChooser:
    tag: AltChooserBoundedSearch
    contents: 3
  lconfig_allowSingleLineExportList: false
  lconfig_importColumn: 50
  lconfig_hangingTypeSignature: false
  lconfig_importAsColumn: 50
  lconfig_alignmentLimit: 30
  lconfig_allowHangingQuasiQuotes: true
  lconfig_indentListSpecial: true
  lconfig_indentAmount: 2
  lconfig_alignmentBreakOnMultiline: true
  lconfig_experimentalSemicolonNewlines: false
  lconfig_cols: 80
  lconfig_indentPolicy: IndentPolicyFree
  lconfig_indentWhereSpecial: true
  lconfig_columnAlignMode:
    tag: ColumnAlignModeMajority
    contents: 0.7

@jneira jneira transferred this issue from haskell/vscode-haskell Mar 9, 2021
@jneira jneira changed the title brittany as invoked by vscode-hie-server doesn't match local machine, formats badly brittany as invoked by haskell-language-server doesn't match local machine, formats badly Mar 9, 2021
@jneira jneira added component: formatters status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Mar 9, 2021
@jneira
Copy link
Member

jneira commented Mar 9, 2021

@jlebar hi, thanks for the bug report, is still being reproduced with last versions of vscode extension and haskell-language-server?

@jlebar
Copy link
Author

jlebar commented Mar 9, 2021

Hi, I've since moved on from my Haskell stint. Don't know if it's still happening at head and don't have this setup anymore. Sorry!

@jneira
Copy link
Member

jneira commented Mar 9, 2021

no worries and thanks for the heads up, we will try to reproduce in our side

@jneira jneira added status: needs repro and removed status: needs info Not actionable, because there's missing information labels Mar 9, 2021
@michaelpj
Copy link
Collaborator

I think some problems like this are inevitable given #411 ?

@jneira
Copy link
Member

jneira commented Mar 9, 2021

Yeah it might be the cause, thanks for noting it

@hasufell hasufell added status: needs info Not actionable, because there's missing information and removed old_status: needs repro labels Jul 13, 2022
@hasufell
Copy link
Member

Closing in favor of #411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: formatters status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

5 participants