-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
With Ormolu as the formatting provider, need BangPatterns (el al.) without putting it in every file #382
Comments
When used via HLS, Ormolu should be picking up extensions from your environment. I'd guess maybe you need an explicit |
I'm personally still on HIE+Brittany, just evaluating the transition to HLS+Ormolu. I routinely work with multi-root workspace, with each workspace having multiple targets (libs and exes), I've got the impression that |
It's a lot broader than that - it's essentially a way of describing your build system to the IDE. HLS has much better support for working with multiple components than HIE, but it requires a The implicit-hie tool can often write this file for you. |
I wonder what prevented similar treatments to be implemented by HLS, in case no I've been assuming by far, that the Cabal library can determine precise GHC compiler options for each src file, given either cabal or stack project information. I can understand that's not enough for static analysis against semantic AST of the whole program, for the IDE to perform, but for formatters, they'd better work on a per-src-file basis, where ghc command line options ought to be enough. And tried [implicit-hie], got empty response :( For the record, I use another package manager to automatically generate both
|
It'll happen: #186
It can, but neither Ormolu nor HLS depend on Cabal the library. Anyway, once you have
I guess that means your setup is too complicated. You'll need to write a manual |
Thanks @georgefst for the prompting answers, things are promising as always, but I don't think my Or there's some tool/technique to quickly decipher the complication in my project setup those preventing the desired result? |
@complyue hls is using a new implicit cradle so maybe your project can be fully loaded without an explicit |
labeled as a bug cause hls/ourmolu plugin should pick the default extensions |
I just reproduced with hls built from master (0.6.0+) $ git clone https://github.com/e-wrks/edh.git
Cloning into 'edh'...
remote: Enumerating objects: 915, done.
remote: Counting objects: 100% (915/915), done.
remote: Compressing objects: 100% (467/467), done.
remote: Total 7797 (delta 511), reused 646 (delta 258), pack-reused 6882
Receiving objects: 100% (7797/7797), 1.95 MiB | 451.00 KiB/s, done.
Resolving deltas: 100% (4699/4699), done.
$ code edh
cradle:
stack:
- path: "./pub"
component: "edh:lib"
- path: "./src"
component: "edh:lib:edh-internal"
- path: "./repl/Main.hs"
component: "edh:exe:edh"
- path: "./repl/Repl.hs"
component: "edh:exe:edh"
- path: "./runfile/Main.hs"
component: "edh:exe:runedh"
- path: "./runmodu/Main.hs"
component: "edh:exe:edhm"
- path: "../lossless-decimal/src"
component: "lossless-decimal:lib" vscode-haskell output:
I suspect |
And I tried to put one https://github.com/e-wrks/edh/blob/master/hie.yaml which is one dir level up, error remains similar
|
I got correct formatter behavior with another simpler package, but only after eliminated the internal-lib structure, specifically this mod: complyue/els@2703d25#diff-48645bb09bcfe26a8bd6b7059b050b157b96ffabba9b2e0f83f28a04fba5e03a And an explicit So I think this issue can be closed now. And do we have a dedicated issue to track internal-lib support? I see #509 some related, but hls won't work at all in my case with internal-lib present. |
stack internal/private libraries are not supported for now: #114
well, not sure about that, or at least it works for some cases; it seems is working for me with a stack.yaml in the project dir and a .cabal in a supackage:
|
Update: a reminder for readers later, I'm refactoring structure of my packages from internal/private lib into separated packages, then HLS+Ormolu works very nice, much smoother than HIE+Brittany as before. Also as HIE has been archived, now is good time to shift to HLS :D Thanks @jneira and @georgefst I'm closing this issue. For the record, my cymp:edh-universe cyue$ cat stack.yaml
# Please change the resolver and other Stack settings per your needs
resolver: lts-16.11
ghc-options:
elr: -O0
edh: -O0
## FOLLOWING CONTENTS GONNA BE OVERWRITTEN BY EPM ##
local-bin-path: /fw/m3cyue/edh-universe/bin
packages:
- /fw/m3cyue/edh-universe/e-wrks/edh/lossless-decimal
- /fw/m3cyue/edh-universe/e-wrks/edh/elr
- /fw/m3cyue/edh-universe/e-wrks/edh/host.hs
- /fw/m3cyue/edh-universe/e-wrks/nedh/host.hs
- /fw/m3cyue/edh-universe/e-wrks/sedh/host.hs
- /fw/m3cyue/edh-universe/e-wrks/hasdim/host.hs
- /fw/m3cyue/edh-universe/e-wrks/haskit/host.hs
- /fw/m3cyue/edh-universe/e-wrks/els/host.hs
cymp:edh-universe cyue$ cymp:edh-universe cyue$ find . -name \*.cabal
./e-wrks/edh/lossless-decimal/lossless-decimal.cabal
./e-wrks/edh/elr/elr.cabal
./e-wrks/edh/host.hs/edh.cabal
./e-wrks/nedh/host.hs/nedh.cabal
./e-wrks/sedh/host.hs/sedh.cabal
./e-wrks/hasdim/host.hs/hasdim.cabal
./e-wrks/haskit/host.hs/haskit.cabal
./e-wrks/els/host.hs/els.cabal
cymp:edh-universe cyue$ cymp:edh-universe cyue$ gen-hie
gen-hie: No .cabal files found under/fw/m3cyue/edh-universe
You may need to run stack build.
CallStack (from HasCallStack):
error, called at app/Main.hs:32:21 in main:Main
cymp:edh-universe cyue$ cymp:edh-universe cyue$ cd e-wrks/els/host.hs
cymp:host.hs cyue$ gen-hie
gen-hie: user error (InvalidYaml (Just (YamlException "Yaml file not found: /fw/m3cyue/edh-universe/e-wrks/els/host.hs/stack.yaml")))
cymp:host.hs cyue$ |
@complyue thank you to spend time debugging and reporting the errors I am gonna open an issue in |
* Update to latest hie-bios * Remove explicit usage of type parameter Void from Cradle
Subject of the issue
With Ormolu as the formatting provider, need BangPatterns (el al.) without putting it in every file
Language extensions (those not enabled by Ormolu automatically), if not put in every source file, can only be specified on the command line of ormolu according to tweag/ormolu#650
Until it can obtain enabled extension list from the project's .cabal file, we need a way to customize Ormolu's command line to tell such extensions, when not willing to put them into every source file.
Your environment
haskell-language-server --probe-tools
orhaskell-language-server-wrapper --probe-tools
Which lsp-client do you use
Describe your project (alternative: link to the project)
https://github.com/e-wrks/edh
Contents of
hie.yaml
No this file
Steps to reproduce
Make sure Ormolu is selected as the "Formatting Provider"
Format some file uses BangPatterns syntax but doesn't contain a pragma for it.
Expected behaviour
File content formatted.
Actual behaviour
File content not formatted.
Include debug information
The text was updated successfully, but these errors were encountered: