Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5-internal/unclutter-ormolu-script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ormolu: don't redundantly add language extensions from dead package-defaults.yaml
11 changes: 5 additions & 6 deletions docs/src/developer/developer/editor-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,18 @@ or check the entire repository. This takes about 10 seconds.
Vim integration is [linked
here](https://github.com/tweag/ormolu#editor-integration).

If you use sdiehl's module, you you need to collect the language extensions from `package-defaults.yaml`:
If you use sdiehl's module, you may need to collect the language extensions from a cabal file:

```
let g:ormolu_options = ["--ghc-opt -XAllowAmbiguousTypes --ghc-opt -XBangPatterns --ghc-opt -XConstraintKinds --ghc-opt -XDataKinds --ghc-opt -XDefaultSignatures --ghc-opt -XDerivingStrategies --ghc-opt -XDeriveFunctor --ghc-opt -XDeriveGeneric --ghc-opt -XDeriveLift --ghc-opt -XDeriveTraversable --ghc-opt -XEmptyCase --ghc-opt -XFlexibleContexts --ghc-opt -XFlexibleInstances --ghc-opt -XFunctionalDependencies --ghc-opt -XGADTs --ghc-opt -XInstanceSigs --ghc-opt -XKindSignatures --ghc-opt -XLambdaCase --ghc-opt -XMultiParamTypeClasses --ghc-opt -XMultiWayIf --ghc-opt -XNamedFieldPuns --ghc-opt -XNoImplicitPrelude --ghc-opt -XOverloadedStrings --ghc-opt -XPackageImports --ghc-opt -XPatternSynonyms --ghc-opt -XPolyKinds --ghc-opt -XQuasiQuotes --ghc-opt -XRankNTypes --ghc-opt -XScopedTypeVariables --ghc-opt -XStandaloneDeriving --ghc-opt -XTemplateHaskell --ghc-opt -XTupleSections --ghc-opt -XTypeApplications --ghc-opt -XTypeFamilies --ghc-opt -XTypeFamilyDependencies --ghc-opt -XTypeOperators --ghc-opt -XUndecidableInstances --ghc-opt -XViewPatterns"]
```

If you want to be playful, you can look at how `tools/ormolu.sh`
collects the language extensions automatically and see if you can get
it to work here.
**EDIT:** this may no longer be necessary, as the ormolu version we
use consults the cabal files for enabled language extensions.

## VSCode

The project can be loaded into the [Haskell Language Server](https://github.com/haskell/haskell-language-server).
The project can be loaded into the [Haskell Language Server](https://github.com/haskell/haskell-language-server).
This gives type checking, code completion, HLint hints, formatting with Ormolu, lookup of definitions and references, etc..
All needed dependencies (like the `haskell-language-server` and `stack` binaries) are provided by `shell.nix`.

Expand All @@ -115,5 +114,5 @@ Setup steps:
- Reload the window as proposed by the `Nix Environment Selector` plugin

An alternative way to make these dependencies accessible to VSCode is to start it in the `direnv` environment.
I.e. from a shell that's current working directory is in the project. The drawbacks of this approach are
I.e. from a shell that's current working directory is in the project. The drawbacks of this approach are
that it only works locally (not on a remote connection) and one VSCode process needs to be started per project.
49 changes: 0 additions & 49 deletions package-defaults.yaml

This file was deleted.

5 changes: 2 additions & 3 deletions tools/ormolu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ if [ "$(git status -s | grep -v \?\?)" != "" ]; then
fi
fi

readarray -t EXTS < <(sed -n '/^default-extensions:/,$ { s/^- //p }' < package-defaults.yaml)
echo "ormolu mode: $ARG_ORMOLU_MODE"
echo "language extensions: ${EXTS[@]}"
echo "language extensions are taken from the resp. cabal files"

FAILURES=0

Expand All @@ -84,7 +83,7 @@ for hsfile in $files; do
FAILED=0

# run in background so that we can detect Ctrl-C properly
ormolu --mode $ARG_ORMOLU_MODE --check-idempotence ${EXTS[@]/#/'-o -X'} "$hsfile" &
ormolu --mode $ARG_ORMOLU_MODE --check-idempotence "$hsfile" &
wait $! && err=0 || err=$?

if [ "$err" == "100" ]; then
Expand Down