ghcide/ghcide.cabal
Pepe Iborra 0d4e3b9499
Fix diagnostics update bug (#959)
* Preventively switch to uninterruptible mask in withMVar'

withMVar' is used to update the shakeSession var and it's crucial that the
third argument is not interrupted.

'mask' can still be interrupted for I/O actions and, while we were careful to
ensure none was used, if it ever breaks it will lead to very hard to debug
problems.

* refactor: move to RuleTypes

* Add a TestRequest to wait for arbitrary ide actions

Closes #955

* expectCurrentDiagnostics

* Add a test suite for cancellation

* Introduce --test-no-kick to fix cancellation tests reliability

* delete unsafeClearDiagnostics (unused)

* GetModSummaryWithoutTimestamps - remove StringBuffer

Since the contents of the buffer are not tracked by the fingerprint.

* Fix diagnostics bug

Given a FOI F with non null typechecking diagnostics D, imagine the following scenario:

1. An edit notification for F is received, creating a new version
2. GetModTime is executed, producing 0 diagnostics.
  2.1 updateFileDiagnostics is called
  2.2 setStageDiagnostics is called
  2.3 LSP.updateDiagnostics is called with a new version, resetting all the
  diagnostics for F
  2.4 newDiags=[] in updateFileDiagnostics, which is different from D (the last
  published diagnostics), which enqueues a new publishDiagnostics [] in the
  Debouncer
3. An edit notification for F is received before typechecking has a chance to
run which undoes the previous edit
4. The debouncer publishes the empty set of diagnostics after waiting 0.1s
5. GetFileContents runs and since the contents of the file haven't changed since
the last time it ran, early cutoff skips everything donwstream

Since TypeCheck is skipped, the empty set of diagnostics stays published until
another edit comes.

The goal of this change is to prevent setStageDiagnostics from losing
diagnostics from other stages. To achieve this, we recover the old diagnostics
for all stages and merge them with the new stage.

* Fix hlint

* Use Map.insert for clarity

* Fix redundant imports

* Fix "code actions after edit" experiment"
2020-12-21 06:06:51 +00:00

410 lines
11 KiB
Plaintext

cabal-version: 1.20
build-type: Simple
category: Development
name: ghcide
version: 0.6.0.1
license: Apache-2.0
license-file: LICENSE
author: Digital Asset and Ghcide contributors
maintainer: Ghcide contributors
copyright: Digital Asset and Ghcide contributors 2018-2020
synopsis: The core of an IDE
description:
A library for building Haskell IDE's on top of the GHC API.
homepage: https://github.com/haskell/ghcide#readme
bug-reports: https://github.com/haskell/ghcide/issues
tested-with: GHC>=8.6.5
extra-source-files: include/ghc-api-version.h README.md CHANGELOG.md
test/data/hover/*.hs
test/data/multi/cabal.project
test/data/multi/hie.yaml
test/data/multi/a/a.cabal
test/data/multi/a/*.hs
test/data/multi/b/b.cabal
test/data/multi/b/*.hs
source-repository head
type: git
location: https://github.com/haskell/ghcide.git
flag ghc-lib
description: build against ghc-lib instead of the ghc package
default: False
manual: True
library
default-language: Haskell2010
build-depends:
aeson,
array,
async,
base == 4.*,
binary,
bytestring,
case-insensitive,
containers,
data-default,
deepseq,
directory,
extra,
fuzzy,
filepath,
fingertree,
Glob,
haddock-library >= 1.8,
hashable,
haskell-lsp-types == 0.22.*,
haskell-lsp == 0.22.*,
hie-compat,
mtl,
network-uri,
parallel,
prettyprinter-ansi-terminal,
prettyprinter-ansi-terminal,
prettyprinter,
regex-tdfa >= 1.3.1.0,
rope-utf16-splay,
safe,
safe-exceptions,
shake >= 0.18.4,
sorted-list,
stm,
syb,
text,
time,
transformers,
unordered-containers >= 0.2.10.0,
utf8-string,
hslogger,
opentelemetry >=0.6.1,
heapsize ==0.3.*
if flag(ghc-lib)
build-depends:
ghc-lib >= 8.8,
ghc-lib-parser >= 8.8
cpp-options: -DGHC_LIB
else
build-depends:
ghc-boot-th,
ghc-boot,
ghc >= 8.6,
-- These dependencies are used by Development.IDE.Session and are
-- Haskell specific. So don't use them when building with -fghc-lib!
ghc-check >=0.5.0.1,
ghc-paths,
cryptohash-sha1 >=0.11.100 && <0.12,
hie-bios >= 0.7.1 && < 0.8.0,
implicit-hie-cradle >= 0.3.0.2 && < 0.4,
base16-bytestring >=0.1.1 && <0.2
if os(windows)
build-depends:
Win32
else
build-depends:
unix
c-sources:
cbits/getmodtime.c
default-extensions:
BangPatterns
DeriveFunctor
DeriveGeneric
FlexibleContexts
GeneralizedNewtypeDeriving
LambdaCase
NamedFieldPuns
OverloadedStrings
RecordWildCards
ScopedTypeVariables
StandaloneDeriving
TupleSections
TypeApplications
ViewPatterns
hs-source-dirs:
src
include-dirs:
include
exposed-modules:
Development.IDE
Development.IDE.Compat
Development.IDE.Core.Debouncer
Development.IDE.Core.FileStore
Development.IDE.Core.IdeConfiguration
Development.IDE.Core.OfInterest
Development.IDE.Core.PositionMapping
Development.IDE.Core.Preprocessor
Development.IDE.Core.Rules
Development.IDE.Core.RuleTypes
Development.IDE.Core.Service
Development.IDE.Core.Shake
Development.IDE.Core.Tracing
Development.IDE.GHC.Compat
Development.IDE.GHC.Error
Development.IDE.GHC.Orphans
Development.IDE.GHC.Util
Development.IDE.Import.DependencyInformation
Development.IDE.LSP.HoverDefinition
Development.IDE.LSP.LanguageServer
Development.IDE.LSP.Outline
Development.IDE.LSP.Protocol
Development.IDE.LSP.Server
Development.IDE.Spans.Common
Development.IDE.Spans.Documentation
Development.IDE.Spans.AtPoint
Development.IDE.Spans.LocalBindings
Development.IDE.Types.Diagnostics
Development.IDE.Types.Exports
Development.IDE.Types.KnownTargets
Development.IDE.Types.Location
Development.IDE.Types.Logger
Development.IDE.Types.Options
Development.IDE.Types.Shake
Development.IDE.Plugin
Development.IDE.Plugin.Completions
Development.IDE.Plugin.CodeAction
Development.IDE.Plugin.Test
-- Unfortunately, we cannot use loadSession with ghc-lib since hie-bios uses
-- the real GHC library and the types are incompatible. Furthermore, when
-- building with ghc-lib we need to make this Haskell agnostic, so no
-- hie-bios!
-- We also put these modules into a separate hs-source-dirs so we can avoid
-- compiling them at all if ghc-lib is not set
if !flag(ghc-lib)
hs-source-dirs:
session-loader
exposed-modules:
Development.IDE.Session
other-modules:
Development.IDE.Session.VersionCheck
other-modules:
Development.IDE.Core.Compile
Development.IDE.Core.FileExists
Development.IDE.GHC.CPP
Development.IDE.GHC.Warnings
Development.IDE.Import.FindImports
Development.IDE.LSP.Notifications
Development.IDE.Plugin.CodeAction.PositionIndexed
Development.IDE.Plugin.CodeAction.Rules
Development.IDE.Plugin.CodeAction.RuleTypes
Development.IDE.Plugin.Completions.Logic
Development.IDE.Plugin.Completions.Types
Development.IDE.Types.Action
ghc-options: -Wall -Wno-name-shadowing -Wincomplete-uni-patterns
executable ghcide-test-preprocessor
default-language: Haskell2010
hs-source-dirs: test/preprocessor
ghc-options: -Wall -Wno-name-shadowing
main-is: Main.hs
build-depends:
base == 4.*
benchmark benchHist
type: exitcode-stdio-1.0
default-language: Haskell2010
ghc-options: -Wall -Wno-name-shadowing -threaded
main-is: Main.hs
hs-source-dirs: bench/hist bench/lib
other-modules: Experiments.Types
build-tool-depends:
ghcide:ghcide-bench
default-extensions:
BangPatterns
DeriveFunctor
DeriveGeneric
FlexibleContexts
GeneralizedNewtypeDeriving
LambdaCase
NamedFieldPuns
RecordWildCards
ScopedTypeVariables
StandaloneDeriving
TupleSections
TypeApplications
ViewPatterns
build-depends:
aeson,
base == 4.*,
shake-bench == 0.1.*,
directory,
filepath,
shake,
text,
yaml
executable ghcide
if flag(ghc-lib)
buildable: False
default-language: Haskell2010
hs-source-dirs: exe
ghc-options:
-threaded
-Wall
-Wincomplete-uni-patterns
-Wno-name-shadowing
-- allow user RTS overrides
-rtsopts
-- disable idle GC
-- disable parallel GC
-- increase nursery size
"-with-rtsopts=-I0 -qg -A128M"
main-is: Main.hs
build-depends:
aeson,
base == 4.*,
data-default,
directory,
extra,
filepath,
gitrev,
hashable,
haskell-lsp,
haskell-lsp-types,
heapsize,
hie-bios,
ghcide,
lens,
optparse-applicative,
text,
unordered-containers
other-modules:
Arguments
Paths_ghcide
default-extensions:
BangPatterns
DeriveFunctor
DeriveGeneric
FlexibleContexts
GeneralizedNewtypeDeriving
LambdaCase
NamedFieldPuns
OverloadedStrings
RecordWildCards
ScopedTypeVariables
StandaloneDeriving
TupleSections
TypeApplications
ViewPatterns
test-suite ghcide-tests
if flag(ghc-lib)
buildable: False
type: exitcode-stdio-1.0
default-language: Haskell2010
build-tool-depends:
ghcide:ghcide,
ghcide:ghcide-test-preprocessor
build-depends:
aeson,
base,
binary,
bytestring,
containers,
directory,
extra,
filepath,
--------------------------------------------------------------
-- The MIN_GHC_API_VERSION macro relies on MIN_VERSION pragmas
-- which require depending on ghc. So the tests need to depend
-- on ghc if they need to use MIN_GHC_API_VERSION. Maybe a
-- better solution can be found, but this is a quick solution
-- which works for now.
ghc,
--------------------------------------------------------------
ghcide,
ghc-typelits-knownnat,
haddock-library,
haskell-lsp,
haskell-lsp-types,
network-uri,
lens,
lsp-test >= 0.11.0.6 && < 0.12,
optparse-applicative,
process,
QuickCheck,
quickcheck-instances,
rope-utf16-splay,
safe,
safe-exceptions,
shake,
tasty,
tasty-expected-failure,
tasty-hunit,
tasty-quickcheck,
tasty-rerun,
text
if (impl(ghc >= 8.6))
build-depends:
record-dot-preprocessor,
record-hasfield
hs-source-dirs: test/cabal test/exe test/src bench/lib
include-dirs: include
ghc-options: -threaded -Wall -Wno-name-shadowing -O0
main-is: Main.hs
other-modules:
Development.IDE.Test
Development.IDE.Test.Runfiles
Experiments
Experiments.Types
default-extensions:
BangPatterns
DeriveFunctor
DeriveGeneric
FlexibleContexts
GeneralizedNewtypeDeriving
LambdaCase
NamedFieldPuns
OverloadedStrings
RecordWildCards
ScopedTypeVariables
StandaloneDeriving
TupleSections
TypeApplications
ViewPatterns
executable ghcide-bench
default-language: Haskell2010
build-tool-depends:
ghcide:ghcide
build-depends:
aeson,
base,
bytestring,
containers,
directory,
extra,
filepath,
ghcide,
lsp-test >= 0.11.0.2 && < 0.12,
optparse-applicative,
process,
safe-exceptions,
shake,
text
hs-source-dirs: bench/lib bench/exe
include-dirs: include
ghc-options: -threaded -Wall -Wno-name-shadowing -rtsopts
main-is: Main.hs
other-modules:
Experiments
Experiments.Types
default-extensions:
BangPatterns
DeriveFunctor
DeriveGeneric
FlexibleContexts
GeneralizedNewtypeDeriving
LambdaCase
NamedFieldPuns
OverloadedStrings
RecordWildCards
ScopedTypeVariables
StandaloneDeriving
TupleSections
TypeApplications
ViewPatterns