diff --git a/changelog.d/5-internal/unclutter-ormolu-script b/changelog.d/5-internal/unclutter-ormolu-script new file mode 100644 index 0000000000..ffb56f1bde --- /dev/null +++ b/changelog.d/5-internal/unclutter-ormolu-script @@ -0,0 +1 @@ +ormolu: don't redundantly add language extensions from dead package-defaults.yaml diff --git a/docs/src/developer/developer/editor-setup.md b/docs/src/developer/developer/editor-setup.md index 7b39f8a463..45504975da 100644 --- a/docs/src/developer/developer/editor-setup.md +++ b/docs/src/developer/developer/editor-setup.md @@ -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`. @@ -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. diff --git a/package-defaults.yaml b/package-defaults.yaml deleted file mode 100644 index eec3552b4a..0000000000 --- a/package-defaults.yaml +++ /dev/null @@ -1,49 +0,0 @@ -ghc-options: -- -O2 -- -Wall -- -Wincomplete-uni-patterns -- -Wincomplete-record-updates -- -Wpartial-fields -- -fwarn-tabs -# These errors pop up from time to time but haven't caused any serious trouble yet -- -optP-Wno-nonportable-include-path - -default-extensions: -- AllowAmbiguousTypes -- BangPatterns -- ConstraintKinds -- DataKinds -- DefaultSignatures -- DerivingStrategies -- DerivingVia -- DeriveFunctor -- DeriveGeneric -- DeriveLift -- DeriveTraversable -- EmptyCase -- FlexibleContexts -- FlexibleInstances -- FunctionalDependencies -- GADTs -- InstanceSigs -- KindSignatures -- LambdaCase -- MultiParamTypeClasses -- MultiWayIf -- NamedFieldPuns -- NoImplicitPrelude -- OverloadedStrings -- PackageImports -- PatternSynonyms -- PolyKinds -- QuasiQuotes -- RankNTypes -- ScopedTypeVariables -- StandaloneDeriving -- TupleSections -- TypeApplications -- TypeFamilies -- TypeFamilyDependencies -- TypeOperators -- UndecidableInstances -- ViewPatterns diff --git a/tools/ormolu.sh b/tools/ormolu.sh index 44a9452e70..901baa11e0 100755 --- a/tools/ormolu.sh +++ b/tools/ormolu.sh @@ -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 @@ -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