haskell-language-server/haskell-language-server.cabal
Nick Suchecki 911fe59d7f
Change Type Signature Plugin (#2660)
* First go

* Match against specific error message.

* Basic Change Type Signature implementation.

This implementation only matches a single GHC Error message:

```
    • Couldn't match type ‘Int’
                     with ‘Data.HashSet.Internal.HashSet Int’
      Expected type: Int -> Int
        Actual type: Data.HashSet.Internal.HashSet Int -> Int
    • In the expression: head . toList
      In an equation for ‘test’: test = head . toList
```

Specifically on `Expected type: ...`, `Actual type:...` and `In an equation ...`.

There are plenty of error messages that match this format but aren't actually valid.

* GHC 9.2.0 compat change

* Lift expectedError message into a separate binding

* Move ChangeTypeAction into it's own plugin

* Add New Error Message parsing.

- Add new regex for matching extra errors message types

- Revamp original regex to match more.

- Add basic test suite.

- Begin adding `tidyActualType` semantics to provide slightly prettier
TyVars

* Added Error Message Validation to ignore bad Messages.

- Add Pretty Printing for Types
- Added a few test scenarios

* Miscellaneous Cleanup.

* Update Tide Type Signature logic.

- Be able to tidy signatures with operators in it
- Use T.words instead of regex matching to split tyVars

* Remove locA (defaults to id in 8.10) to satisfy 9.0+

* Touch up 9.2.1

* Clean up review notes

* Update stack.yamls

* Fix copy-paste error

* Fix Local Signature resolution

* Improve logging (#2558)

* convert to contravariant logging style part 1, uses additional hardcoded log file to see it side by side with original logging

* convert Session to contravariant logging style

* convert Plugin/HLS and FireStore to contravariant logging style

* convert Rules (and most of the universe) to contravariant logging style

* fix tests, allow old style logging and contravariant logging to write to same log file

* fix import inside wrong CPP

* add CPP for LogTactic constructor

* remove redundant import

* fix ghcide tests

* remove unused import

* fix plugin tests

* LSP_TEST_STDERR should apply to contra logger as well

* fix tactic plugin test

* use CPP for Log datatype plugin constructors, remove unused imports

* add a few Pretty instances, add prettyprinter to haskell-language-sever and hls-plugin-api dependencies

* add Pretty Log instances for Session, FileStore, Notifications

* add remaining Pretty Log instances

* add logToPriorities

* fix slight interleaving issue with hslogger and logger both logging, have default logger be mutex stderr or file handle, use stderr if failing to open log file

* forgot to add .cabal files with hslogger dep

* dont use UnliftIO file IO helpers because they are too new

* remove log helper comments, use Doc instead of Text as final console/file logger input, renaming, export Log constructors

* remove accidentally added useless file, removed prettyprinter dep from hls-plugin-api because stack ghc8.6.5 doesnt have it?

* use deprecated prettyprint modules import for the sake of circleci ghc-8.6.5

* use dummy stderr logger for plugin cli commands, use priorityToHsLoggerPriority function instead of manual mapping

* remove old plugin detritus that somehow got committed

* fix prettyprinter imports for 8.6.5

* try enforcing prettyprinter bounds?

* enforcing bound makes no sense

* maybe changing stack yamls does trick

* filter out warnings when their diags are empty to more closely match original

* add ability to select wanted logging columns, match prev ghcide exe logging behaviour

* dont log anything when diags are empty in some defineEarlyCutoff versions

* use non-deprecated prettyprinter imports

* fix ghcide test module

* change logWith to accept priority at call site, remove all logToPriority functions, add cmapWithPrio that contramaps through WithPriority

* remove useless hiding import list, add comments to default recorder makers

* make cradleToOptsAndLibDir take concrete cradle to remove existential type var in Log constructor

* Types.Logger now re-exports prettyprinter, remove unused dependencies on prettyprinter and hslogger

* existential type var to remove boilerplate in Plugins.hs, remove a few Show instances

* add SourceLoc logging column, inline logToDoc functions, add comment explaining hslogger setup existence

* qualify a name to match original source

* fix -WError

* Delete the Telemetry log level (#2727)

It's a bit non-standard, and moreover it's entirely dead.

* Wall and 9.2 fix

* Remove unneeded comments/code

Co-authored-by: J. S <shenjonathan0@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
2022-03-03 23:08:42 +00:00

543 lines
13 KiB
Plaintext

cabal-version: 2.4
category: Development
name: haskell-language-server
version: 1.6.1.1
synopsis: LSP server for GHC
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
homepage: https://github.com/haskell/haskell-language-server#readme
bug-reports: https://github.com/haskell/haskell-language-server/issues
author: The Haskell IDE Team
maintainer: alan.zimm@gmail.com
copyright: The Haskell IDE Team
license: Apache-2.0
license-file: LICENSE
build-type: Simple
tested-with: GHC == 8.6.5 || == 8.8.4 || == 8.10.6 || == 8.10.7 || == 9.0.1 || == 9.0.2 || == 9.2.1
extra-source-files:
README.md
ChangeLog.md
test/testdata/**/*.project
test/testdata/**/*.cabal
test/testdata/**/*.yaml
test/testdata/**/*.hs
flag pedantic
description: Enable -Werror
default: False
manual: True
source-repository head
type: git
location: https://github.com/haskell/haskell-language-server
common common-deps
build-depends:
, base >=4.12 && <5
, directory
, extra
, filepath
, text
, prettyprinter
-- Default warnings in HLS
common warnings
ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing -Wno-unticked-promoted-constructors
-- Allow compiling in pedantic mode
common pedantic
if flag(pedantic)
ghc-options: -Werror
library
import: common-deps
-- configuration
, warnings
, pedantic
exposed-modules:
Ide.Arguments
Ide.Main
Ide.Version
other-modules: Paths_haskell_language_server
autogen-modules: Paths_haskell_language_server
hs-source-dirs: src
build-depends:
, async
, base16-bytestring
, bytestring
, containers
, cryptohash-sha1
, data-default
, ghc
, ghcide ^>=1.6
, githash
, lsp
, hie-bios
, hiedb
, hls-plugin-api ^>=1.3
, hslogger
, optparse-applicative
, optparse-simple
, process
, hls-graph
, safe-exceptions
, sqlite-simple
, unordered-containers
, aeson-pretty
default-language: Haskell2010
default-extensions: DataKinds, TypeOperators
-- Plugin flags are designed for 'cabal install haskell-language-server':
-- - Bulk flags should be default:False
-- - Individual flags should be default:True
-- The intent of this flag is being able to keep the ghc condition for hackage
-- but skip it via flags in cabal.project as plugins for new ghcs usually
-- are buildable using cabal.project tweaks
flag ignore-plugins-ghc-bounds
description: Force the inclusion of plugins even if they are not buildable by default with a specific ghc version
default: False
manual: True
flag class
description: Enable class plugin
default: True
manual: True
flag callHierarchy
description: Enable call hierarchy plugin
default: True
manual: True
flag haddockComments
description: Enable haddockComments plugin
default: True
manual: True
flag eval
description: Enable eval plugin
default: True
manual: True
flag importLens
description: Enable importLens plugin
default: True
manual: True
flag refineImports
description: Enable refineImports plugin
default: True
manual: True
flag rename
description: Enable rename plugin
default: False
manual: True
flag retrie
description: Enable retrie plugin
default: True
manual: True
flag tactic
description: Enable tactic plugin
default: True
manual: True
flag hlint
description: Enable hlint plugin
default: True
manual: True
flag moduleName
description: Enable moduleName plugin
default: True
manual: True
flag pragmas
description: Enable pragmas plugin
default: True
manual: True
flag splice
description: Enable splice plugin
default: True
manual: True
flag alternateNumberFormat
description: Enable Alternate Number Format plugin
default: True
manual: True
flag qualifyImportedNames
description: Enable qualifyImportedNames plugin
default: True
manual: True
flag selectionRange
description: Enable selectionRange plugin
default: True
manual: True
flag changeTypeSignature
description: Enable changeTypeSignature plugin
default: True
manual: True
-- formatters
flag floskell
description: Enable floskell plugin
default: True
manual: True
flag fourmolu
description: Enable fourmolu plugin
default: True
manual: True
flag ormolu
description: Enable ormolu plugin
default: True
manual: True
flag stylishHaskell
description: Enable stylishHaskell plugin
default: True
manual: True
flag brittany
description: Enable brittany plugin
default: True
manual: True
flag dynamic
description: Build with the dyn rts
default: True
manual: True
common example-plugins
hs-source-dirs: plugins/default/src
other-modules: Ide.Plugin.Example,
Ide.Plugin.Example2
common class
if flag(class) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
build-depends: hls-class-plugin ^>=1.0.0.1
cpp-options: -Dclass
common callHierarchy
if flag(callHierarchy)
build-depends: hls-call-hierarchy-plugin ^>=1.0.0.0
cpp-options: -DcallHierarchy
common haddockComments
if flag(haddockComments)
build-depends: hls-haddock-comments-plugin ^>=1.0.0.1
cpp-options: -DhaddockComments
common eval
if flag(eval)
build-depends: hls-eval-plugin ^>=1.2.0.0
cpp-options: -Deval
common importLens
if flag(importLens)
build-depends: hls-explicit-imports-plugin ^>=1.0.0.1
cpp-options: -DimportLens
common refineImports
if flag(refineImports)
build-depends: hls-refine-imports-plugin ^>=1.0.0.0
cpp-options: -DrefineImports
common rename
if flag(rename)
build-depends: hls-rename-plugin ^>= 1.0.0.0
cpp-options: -Drename
common retrie
if flag(retrie) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
build-depends: hls-retrie-plugin ^>=1.0.0.1
cpp-options: -Dretrie
common tactic
if flag(tactic) && (impl(ghc < 9.0.1) || flag(ignore-plugins-ghc-bounds))
build-depends: hls-tactics-plugin >=1.2.0.0 && <1.7
cpp-options: -Dtactic
common hlint
if flag(hlint) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
build-depends: hls-hlint-plugin ^>=1.0.0.2
cpp-options: -Dhlint
common moduleName
if flag(moduleName)
build-depends: hls-module-name-plugin ^>=1.0.0.0
cpp-options: -DmoduleName
common pragmas
if flag(pragmas)
build-depends: hls-pragmas-plugin ^>=1.0.0.0
cpp-options: -Dpragmas
common splice
if flag(splice) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
build-depends: hls-splice-plugin ^>=1.0.0.1
cpp-options: -Dsplice
common alternateNumberFormat
if flag(alternateNumberFormat)
build-depends: hls-alternate-number-format-plugin ^>=1.0.0.0
cpp-options: -DalternateNumberFormat
common qualifyImportedNames
if flag(qualifyImportedNames)
build-depends: hls-qualify-imported-names-plugin ^>=1.0.0.0
cpp-options: -DqualifyImportedNames
common selectionRange
if flag(selectionRange)
build-depends: hls-selection-range-plugin ^>=1.0.0.0
cpp-options: -DselectionRange
common changeTypeSignature
if flag(changeTypeSignature)
build-depends: hls-change-type-signature-plugin ^>=1.0.0.0
cpp-options: -DchangeTypeSignature
-- formatters
common floskell
if flag(floskell)
build-depends: hls-floskell-plugin ^>=1.0.0.0
cpp-options: -Dfloskell
common fourmolu
if flag(fourmolu)
build-depends: hls-fourmolu-plugin ^>=1.0.0.0
cpp-options: -Dfourmolu
common ormolu
if flag(ormolu)
build-depends: hls-ormolu-plugin ^>=1.0.0.0
cpp-options: -Dormolu
common stylishHaskell
if flag(stylishHaskell) && (impl(ghc < 9.0.1) || flag(ignore-plugins-ghc-bounds))
build-depends: hls-stylish-haskell-plugin ^>=1.0.0.0
cpp-options: -DstylishHaskell
common brittany
if flag(brittany) && (impl(ghc < 9.0.2) || flag(ignore-plugins-ghc-bounds))
build-depends: hls-brittany-plugin ^>=1.0.0.1
cpp-options: -Dbrittany
executable haskell-language-server
import: common-deps
-- configuration
, warnings
, pedantic
-- plugins
, example-plugins
, callHierarchy
, changeTypeSignature
, class
, haddockComments
, eval
, importLens
, refineImports
, rename
, retrie
, tactic
, hlint
, moduleName
, pragmas
, splice
, alternateNumberFormat
, qualifyImportedNames
, selectionRange
, floskell
, fourmolu
, ormolu
, stylishHaskell
, brittany
main-is: Main.hs
hs-source-dirs: exe
other-modules: Plugins
ghc-options:
-threaded
-- allow user RTS overrides
-rtsopts
-- disable idle GC
-- increase nursery size
-- Enable collection of heap statistics
"-with-rtsopts=-I0 -A128M -T"
-Wno-unticked-promoted-constructors
if flag(pedantic)
ghc-options: -Werror
if !os(windows) && flag(dynamic)
-- We want to link against the dyn rts just like official GHC binaries do;
-- the linked rts determines how external libs are loaded dynamically by TH.
-- The standard way of doing this is via the --enable-dynamic-executables Cabal option
-- Unfortunately it doesnt' work, see https://github.com/haskell/haskell-language-server/issues/2659
-- One can use --ghc-options=-dynamic but this gets applied to the dependencies as well,
-- which results in massive rebuilds and incompatibilities with profiling.
-- So instead we set the -dynamic flag diretly here.
ghc-options: -dynamic
build-depends:
, aeson
, async
, base16-bytestring
, binary
, bytestring
, containers
, cryptohash-sha1
, deepseq
, ghc
, ghc-boot-th
, ghcide
, hashable
, haskell-language-server
, lsp
, hie-bios
, hiedb
, lens
, regex-tdfa
, hslogger
, optparse-applicative
, hls-plugin-api
, lens
, mtl
, regex-tdfa
, safe-exceptions
, hls-graph
, sqlite-simple
, stm
, temporary
, transformers
, unordered-containers
default-language: Haskell2010
default-extensions: DataKinds, TypeOperators
executable haskell-language-server-wrapper
import: common-deps
, warnings
, pedantic
main-is: Wrapper.hs
hs-source-dirs: exe
other-modules: Paths_haskell_language_server
autogen-modules: Paths_haskell_language_server
ghc-options:
-threaded
-- allow user RTS overrides
-rtsopts
-- disable idle GC
-- increase nursery size
"-with-rtsopts=-I0 -A128M"
build-depends:
, data-default
, ghc
, ghc-paths
, ghcide
, gitrev
, haskell-language-server
, hie-bios
, optparse-applicative
, optparse-simple
, process
if !os(windows)
build-depends:
unix
, containers
default-language: Haskell2010
test-suite func-test
import: common-deps
, warnings
, pedantic
type: exitcode-stdio-1.0
default-language: Haskell2010
build-tool-depends:
haskell-language-server:haskell-language-server -any,
ghcide:ghcide-test-preprocessor -any
build-depends:
, bytestring
, data-default
, hspec-expectations
, lens
, lens-aeson
, ghcide
, hls-test-utils ^>=1.2
, lsp-types
, aeson
, hls-plugin-api
, lsp-test
, containers
, unordered-containers
hs-source-dirs: test/functional test/utils
main-is: Main.hs
other-modules:
Command
Completion
Config
Deferred
Definition
Diagnostic
Format
FunctionalBadProject
FunctionalCodeAction
HieBios
Highlight
Progress
Reference
Symbol
TypeDefinition
Test.Hls.Command
Test.Hls.Flags
default-extensions: OverloadedStrings
ghc-options:
-threaded -rtsopts -with-rtsopts=-N
-- Duplicating inclusion plugin conditions until tests are moved to their own packages
if flag(eval)
cpp-options: -Deval
-- formatters
if flag(floskell) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
cpp-options: -Dfloskell
if flag(fourmolu)
cpp-options: -Dfourmolu
if flag(ormolu)
cpp-options: -Dormolu
test-suite wrapper-test
import: common-deps
, warnings
, pedantic
type: exitcode-stdio-1.0
build-tool-depends:
haskell-language-server:haskell-language-server-wrapper -any,
haskell-language-server:haskell-language-server -any
default-language: Haskell2010
build-depends:
process
, hls-test-utils
hs-source-dirs: test/wrapper
main-is: Main.hs