* Document exception handling in Actions/Rules
I also took the liberty of removing the `MonadFail` instance for
`Rules`, since failing in `Rules` seems much worse as it won't
automatically be caught. There was only one use of that, which now has
an appropriately threatening comment.
* Tweak
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Drop min_version_ghc (8.8.4 is min supported)
* Drop conditional glasgow_haskell cpp
* Inline some imports (review feedback)
* Drop hie-compat 8.6 (review feedback)
* Dropping more ghc 8.6 related code and docs
* Eval: Include tests that were broken for 8.6
Use hiedb from hackage
gitlab-ci: remove workaround for windows 9.2.2
gitlab-ci: remove workaround for windows 9.2.2
hie-bios
update hie bios
update hie bios
bounds
hie-bios fixes
hie-bios fixes
lsp 1.6
cabal.project fixes
hie-bios fixes
lsp and hie-bios from hackage
Mark hie-bios error as expectFail
hie-bios fixes
hie-bios fixes
Stack
Stack
stack fixes
All code actions have been moved to hls-refactor-plugin
Mostly straightforward, only slight complication was that completion auto imports
depends on exactprint, but I didn't want to remove all completion logic from ghcide
just for this.
Instead, I added logic to dynamically lookup the plugin that provides
the extend import command, so that auto imports work as expected when you have
hls-refactor-plugin enabled.
Move lookupPluginId out of loop
Replace code actions with lenses in benchmarks
Allow plugins to use GetAnnotatedParsedSource by linking it in when depended on
Move lookupPluginId to IdePlugins
Add default extensions
Move traceAst
Adds a new rule `GetLinkable` which is called on demand by
hscCompileCoreExprHook whenever a linkable is required for a splice.
Adds a MonadUnliftIO instance for Action to faciliate the above
We write Core Files whenever a linkable could potentially be required for a file
(i.e it is in the transitive closure of a module that uses TH/compile time code
execution)
However, we only generate byte/object code when such a linkable is
really required by a splice (i.e. the module is in the transitive closure
of any symbol called from a splice).
No linkables are stored in `HiFileResult`. If a linkable is required, then
it must be obtained via a call to `GetLinkable`.
Also use hashes to do fine grained recompilation checking for TH instead of
mod times. This simplifies recompilation checking quite a bit.
* Collect metrics and expose an EKG server
* register gc metrics locally
* getDatabaseKeys
* fixups
* Abstract monitoring and put EKG behind a Cabal flag
* Add CI for the new flag
* fix double ifdef
* link to GHC docs for eventlogs
* log when stopping the EKG server
* Allow CPP in modules
* Add doc comments
* Apply suggestions from code review
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Compat. with ghc 9.2
* use an ekg-json snapshot that preserves compat. with ghc 8.x
* confine CPP to the EKG module
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* applyWithoutDependency
* delete dead code
* estimateFileVersionUnsafely
For a long time, defineEarlyCutoff has been accessing the Values store directly
to compute GetModificationTime values instead of calling use, breaking the
invariant. The values are used to associate the rule result to a file version,
which gets recorded in the Value as well as used as the key in the Diagnostics
store.
The problem here is that the GetModificationTime rule computes a new version and
mutates the Values store, so if defineEarlyCutoff peeks in the store before
GetModificationTime has run, it will grab the old version. This leads to lost
diagnostics and potentially to misversioned Values
Fixing the problem is tricky, because we cannot simply use GetModificationTime
inside defineEarlyCutoff for all rules. There are three issues:
1. Creating a dependency on GetModificationTime. If everything depends on it,
then we lose the ability to do early cutoff
2. Creating cycles in the build graph, since GetModificationTime has
dependencies itself. Because hls-graph doesn't implement cycle detection (Shake
did), it is a nightmare to debug these cycles.
3. Creating overhead, since GetModification time calls the file system for non
FOIs and in the past this was very expensive for projects with large cartesian
product of module paths and source folders
To work around these I had to introduce a new hls-graph primitive,
applyWithoutDependency, as well as do a bunch of fragile type tests on the key
type to decide on whether to use GetModificationTime or peek into the values
store. The type casts could be cleaned up by introducing a type class, but I'm
not sure the end result would be any better.
To understand the issue and debug the implementation of the fix, I added a
number of opentelemety traces which I'm leaving in place in case they could be
useful in the future.
* Traces for diagnostics
* handle the empty file path
* return Nothing instead of peeking the store
* failing to set the unsafe dynflags is an error
* makeLspRecorder
* include link to the issue tracker
* avoid double popup
* catch another ghc lib dir error
* Add list of merged prs
* Remove branch trigger
* Update release instructions
* Include 9.2.1 in the current release
* Bump up hls version
* remove duplicate mention
* Remove references to branch name
* Fix cabal.project gen
* Correct fail-fast condition
* Bump up minor version
* Bump up major version
* Bump up major version
* Allow brittany only for 9.0.1
* brittany not supported in hackage and 9.0.2
* Not short hls for hackage
* Bump up versions everywhere
* Update hackage index
* Add ghcide in rename plugin
* Apply linter and add selection demo
* Add header linkable
* Add first version of release description
* Add last prs
* Mention wingman
* Grammar corrections
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
* Correct mention
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
* Warn about th in docs
* Remove reference to install doc
* Rephrasing
Co-authored-by: J. S. <document_done@hotmail.com>
* Better style
Co-authored-by: Junyoung "Clare" Jang <jjc9310@gmail.com>
* Use could to stress it likely will not work
* REmove reliable from the warning
* Reorder comments
* Rephrasing
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Update docs/supported-versions.md
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Use last version of internal deps
* Restore original wording
* One more pr
* One more pr
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
Co-authored-by: J. S. <document_done@hotmail.com>
Co-authored-by: Junyoung "Clare" Jang <jjc9310@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Reformat in accordance with pre-commit hook
* Typo fix: add missing comma to documented pre-commit hook
* Exclude failing files from pre-commit hook
'stylish-haskell' seems to always fail with a parse error on several
files under ghcide/. Excluding these files from the pre-commit hook
ensures that this hook can always succeed.
* Add stylish-haskell excludes to Nix pre-commit hook
* Reformat again in accordance with pre-commit hook
This is basically the same as 800c165, but applied to new changes
which have been added since then.
Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
* Enable brittany for ghc-9.0.2
* Make works using cabal freeze
* Add stack 9.2.1 to ci
* Use new *molu versions
* Enable rename for stack 9.2.1
* Use last ghc-lib
* Use correct boot pkgs
* Use last ghc-exactprint
* Reorganize and use lens-5.1
* update retrie
* Comment class plugin package
* Handle Nothing case
* Restore ghc-typelits deps
* More non-exhaustive patterns
* More non-exhaustive patterns
* Set pedantic (-WError) true for cabal
* Remove pedantic as we set it out in cabal.project
* Not set pedantic for ghc-9.2.1
* Set pedantic in cabal.project's
* More non-exhaustive patterns
* Not set pedantic for ghc-9.0.1
* More incomplete patterns
* Fix WErrors
* Dodgy import
* Correct CPP conditions
* Not MonadFail in Prelude
* Fix more warnings
* Restore missing fun
* unused imports
* Enable refine imports
* more fixes
* Enable brittany in nix for 9.0.1
* Use newer prettyprinter
* Return to master
* Enable tactics in stack-9.2.1.yaml
* Enable pedantic in ci
* Avoid deprecation warning with CPP �
* Use default prettyprinter
* Update refinery for ghc-9.2.1
* Ignore deprecations
* Use dev version of ghc-source-gen
* disable wingman for 9.2.1
* Enable wingman for 9.0.2
* disable tactic with flag
* yaml grammar
* Use setup-build action
* Correct workflow
* Build flags for al major os's
* The integer twaek is needed for the solver
* Disable tests beforehand
* flags only affect local packages
* Exclude 8.6.5
* Exclude 8.8.4
* WIP
* progress
* enable 9.2 in CI
* Sort out some compatibility issues (#2511)
* fix mkPrintUnqualifiedDefault
* fix qualified idents
* Fix a few more ghc compats
* Add new orphans
* Fix runtime APIs
* HsParsedModule
* export GHC.Hs.Utils
* 9.2 compat for unloading and hie file generation
* hlint fix
* Remove 'setupFinderCache' as its never actually used
* 9.2 compat for Development.IDE.Core.Compile
* Stub out 'getDocumentation' on GHC 9.2 (Requires a reimplementation in terms of in-tree annotations)
* Expose binds
* Remove a bit of CPP by refactoring it into Compat layer
* Progress on ghc-exactprint stuff
The Exactprint module compiles, but code actions are the next focus.
* Fix compile on 8.10
* 9.2 compat for CodeAction Exactprint
* 9.2 compat for Outline
* 9.2 compat for Pragmas plugin
* Get the rest compiling with 9.2
* WIP: PLEASE, DROP THIS COMMIT BEFORE MERGE
This hook starts caching pipeline inside of the PR.
If this got merged - all PRs would start to run caching workflow (which is
undesirable, because of platform limitations)
* disabling {test,bench} to properly heat-up the cache
`index-state` change means nothing, but allow to run increment action on
dependency cache pile (as otherwise cache stays idempotent to its key id).
* CI: index-state: +1s refresh
Somehow previous run got early termination. Seems like some GitHub bug, since
cache-hit promises to True only on direct key hit (& we had indirect).
Maybe second time the charm.
* CI: fix early termination
GitHub accepted previous code, & did passed the steps, but somehow ... long
story short, it was pretending to have early termination working, while it just
was always skipping those steps silently.
So, `index-state` needs another +1s.
* WIP: PLEASE, DROP BEFORE MERGE
* WIP: PLEASE, DROP BEFORE MERGE
This reverts commit 064a9b7995.
* WIP: PLEASE, DROP THIS COMMIT BEFORE MERGE
This reverts commit 208f4844f4.
* WIP: PLEASE, DROP THIS COMMIT BEFORE MERGE
This reverts commit ba4d618ba5.
* CI: index-state advance to save cache anew
* CI: apparently GitHub uses alias cp='cp -i'
Another day, another bug.
* WIP: PLESE, REVERT TO TEST ALL GHCs
* CI: index-state +1s
* WIP: PLESE, REVERT TO TEST ALL GHCs
* CI: index-state +1s
* WIP: PLESE, REVERT TO PASS HLINT CI REQUIREMENTS
* Enable tests for ghc-9.2.1
* Use cabal-ghc921.project
* Enable tests for all ghcs
To check changes for ghc-9.2.1 do not break other ghcs
* Address or skip hlint
* Last hlint fixes
* Fix loop when setting DynFlags
* Filter out evidence variables in documentHighlight
* Fix getFlds
* fix GRE
* fix formatting
* fix Compat build in 9.0
* fix collectHsBindsBinders
* remove redundant WarnMsg local typedef
* showSDocForUser
* redundant import
* HsLet
* LetStmt
* fix Completions build
* bump cabal index state
* Literals: replace argument patterns by field patterns
Sadly this is not enough to fix the build
* QualifyImportedNames: fix build with ghc <9.2
* fix <9.2 build Splice plugin
* fix <9.2 build QualifyImportedNames plugin
* Fix <9.2 build Wingman
* fix build example
* Disable a whole bunch of plugins
* Move windows test into the matrix
* Make consistent plugin handling
package commented out <-> flags <-> test suite
* Add a not working stack.yaml for ghc-9.2.1
It starts to build though
* Remove wrong comma
* Restore primitive allow-*
* Use correct UnitId when constructing InstalledModules
* Fix 8.8 build
* Fix hls-test-utils
* Build explicit imports plugin
* Drop Windows build blocked on unix-compat
* bump Cabal index and simplify constraints
* Add comment
* Use GhcSessionDeps in getHieAst
* Use hsConDeclsBinders in Outline generation
* Use the right session in typecheckModule
* Restore some cases in Outline
* Fix Outline build with GHC <9.2
* Remove noisy logMessage notifications in tests
I have never found these useful and they make it much harder to read logs. If there is a test that needs them, please use a custom logger instead of forcing this madness on everyone.
* Build ghcide test and bench suites with 9.2
* Revert "Merge branch 'master' into ghc-9.2"
This reverts commit daf43c86e8, reversing
changes made to f951004021.
* The redundant constraints warning has changed in 9.2
* Fix code action regression
* fix 9.2 ghcide build
* Fix completion snippets
* Fix mismerge
* Bifunctor instance for GenLocated
* Build rename plugin with GHC 9.2
* Helpers for tracing ExactPrint ASTs
* Fix exactprint code actions
* Enable import lens plugin
* WIP test run changes
* Fix GHC 9 build
* Undo WIP test changes
* Fix GHC 8.8 build
* Fix 8.6 build
* Fix another exactprint regression
* Add source repository with ghc-exactprint fixes
* Add source repository for retrie (needed for fixed ghc-exactprint)
* fix ghc <9.2 build
* Another exactprint fix
* Fix benchmarks
* Another exactprint fix
* Disable a plugin test (plugin not compatible anymore)
* Enable windows build
* Fix multiple components by using consistent UnitIds
There are multiple sources of truth for the home unit id now, in the DynFlags and in the hsc_units
* Improve error handling for initPlugins
* Fix two hover tests
* Remove retrie and ghc-exactprint source repos
* Fix version of direct-sqlite
Not sure why this is needed, but without it Cabal is selecting an older version
which fails to build with 9.2
* Fix ci update hackage index
* This test is broken because GHC 9.2 built-in libraries lack docs
The interface files have no docs, checked via:
ghc --show-iface ~/.ghcup/ghc/9.2.1/lib/ghc-9.2.1/lib/x86_64-osx-ghc-9.2.1/base-4.16.0.0/Data/Functor.hi
* Sanitize hiding tests
These tests are reimplementing runWithExtraFiles - let's just use it
* Disable another test
* Fix outline
* Revert "Sanitize hiding tests"
This reverts commit 4f016ddca2.
* Extract out ci build setup
* Correct action path
* Add required shell property
* Remove unused cabal version
* Update .github/actions/setup-build/action.yml
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Update .github/actions/setup-build/action.yml
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Update .github/actions/setup-build/action.yml
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Fix remaining tests and some warnings
* Update .github/actions/setup-build/action.yml
Co-Authored-By: @michaelpj
* Copy alt project file unconditionally
* Make freeze strict
* Actually fix tests
* remove unnecessary? allow-newer
* Drop no longer needed source repo for th-extras
* Add module header comments
* Fix or remove commented out code
* more commented out code
* Disable a couple of func-test tests
* All func-test tests passing now
* fix test matrix
* Update cabal-ghc921.project
* do not test class plugin
* Mark hover test broken in Windows and Mac
* Fix hls-pragmas-plugin test suite
* disable testing of refine imports plugin
* disable rename plugin
* Do not test qualify imported names plugin
* addressing hlint suggestions
* Revert hlint change that breaks due to CPP
Co-authored-by: Alan Zimmerman <alan.zimm@gmail.com>
Co-authored-by: Zubin Duggal <zubin.duggal@gmail.com>
Co-authored-by: Anton Latukha <anton.latukha@gmail.com>
Co-authored-by: jneira <atreyu.bbb@gmail.com>
Co-authored-by: Junyoung "Clare" Jang <jjc9310@gmail.com>
Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Show build graph statistics in ghcide-bench
This adds 5 new columns to the benchmark outputs:
- buildRulesBuilt - for which the value didn't change
- buildRulesChanged - for which the value did change
- buildRulesVisited - for which the value was not even recomputed
- buildRulesTotal - including the rules that were not visited in the last build
- buildEdges - total number of edges in the build graph
* Fix build
* backwards compat.
* [hls-graph] clean up databaseDirtySet
When I ported https://github.com/ndmitchell/shake/pull/802/files to hls-graph, I changed the encoding of the dirty set. Instead, Dirty became a constructor in the Status union. But the databaseDirtySet stayed around accidentally, leading to some confusion.
* extract GetEvalComments rule
* override NeedsCompilation rule in eval plugin to generate linkables when Evaluating
In addition, we tune the newness check of the redefined NeedsCompilation rule so that the generated linkables are not thrown away unnecessarily, as described in:
https://github.com/ndmitchell/shake/issues/794
* getLastBuildKeys
* Test that the linkables are being produced
* honor LSP_TEST_LOG_STDERR
* add comments and use custom newness check in ghcide too
* fix build
* fix 9.0 build
When I ported reverse dependencies from Shake[1] I missed an important
detail. While Shake models alwaysRerun as a dependency on an actual rule
(AlwaysRerun), hls-graph models alwaysRerun by setting actionDeps to
Nothing. This is important because dependencies are not computed for
these rules, and therefore reverse dependency tracking doesn't do
anything, which breaks correctness of dirty rebuilds
This commit adds dependency tracking for alwaysRerun rules, and fixes
reverse dependency tracking. The alternative would be following the
Shake approach but I'm not sure what other implications this might have.
[1] - https://github.com/ndmitchell/shake/pull/802
* Rewrite hls-graph to not use the Shake code
* redundant import
* Fix the bug
* add comments and format imports
* Fix another bug
* fix locking in incDatabase
* avoid calling withNumCapabilities on every build
* faster cleanup
* implement reverse deps
* --conservative-change-tracking
* Avoid grabbing the db lock when updating reverse deps
* update reverse deps asynchronously
* Profiling graph builds
* extend up profiling to record visiting steps
The main benefit of reverse dependency tracking is that we avoid unnecessary node lookups. However, these lookups were not shown in hls-graph profiles, hiding their real cost.
Concretely, if the number of lookups per build is proportional to the number of transitive dependencies of a node, which in turn is proportional to the number of transitive imports of a module, then we have an O(edges) complexity instead of an O(nodes) complexity, which is really bad for large projects.
This Diff extends the recorded data and the profiling UI to keep track
of visited nodes and to show them in a new column "Visited" of the "Rules" tab. The cost of doing this is storing an additional Int per node at runtime.
While I was editing the profiling UI, I took the chance to remove the command tabs, update the README and add some missing files
* include dirty set in profiles
* actionFork
* avoid spawning threads for simple lookups
* Fix a flaky test
* record changes to GetKnownTargets
* Readme for hls-graph
* Bump version numbers
* Drop dependency on Shake
* explain why we restart a Shake session
* clean up Internal.Database
* add a new benchmark example cabal-1module
* Fix masking and further reduce threading
* Trace aborted rule evaluations
* Fix code actions after cradle edit experiment
* Avoid spawning threads for build rules with 1 or fewer deps
* simplify a test
* hlint
* Add a test for off-editor changes
* Fix flaky tests
* fix incomplete pattern match in Tactics test suite
* Fix flaky tests
* attempt to fix tactics test suite in Windows
Co-authored-by: Neil Mitchell <ndmitchell@gmail.com>
* Tell Shake what has changed
* Insert placeholders for missing Shake features
* disable run subset if the client doesn't support file watches
* fix another cradle test
* Add a function addRule, which abstracts over addBuiltinRule
* Newtype wrap the Action, Rules and ShakeOption types
* Replace addShakeExtra with newShakeExtra
* Move the internals of hls-graph around a bit
* Expose shakeTimings and shakeAllowRedefineRules through ShakeOptions
Co-authored-by: Potato Hatsue <1793913507@qq.com>