Commit Graph

49 Commits

Author SHA1 Message Date
Lei Zhu
faa88f685e
A plugin for GADT syntax converter (#2899)
* initial hls-gadt-plugin

* Correct condition

* Render context correctly

* Fix typo

* Support from ghc-8.6 to ghc-9.0

* ghc8.6 compat

* Try to fix test for ghc-8.6

* Pretty name

* Add GADTs pragma automatically

* Enrich Readme

* Clean up

* Update hls docs

* Update CODEOWNERS

* Fix typo

* Rename withTempDir with withCanonicalTempDir

* Add @michaelpj's suggestions

* Pass PluginId through descriptor

* Explicit forall
2022-05-26 17:13:09 +08:00
Lei Zhu
df6cc3cccd
Expand input to pragma if available (#2871) 2022-04-30 15:36:23 +01:00
Lei Zhu
c14cbdbdd4
Support hls-hlint-plugin and hls-stylish-plugin for ghc9.0 and ghc9.2 (#2854)
* hls-hlint-plugin & hls-stylish-haskell-plugin rush to ghc92

* Restore allow-newer

* Add BufSpan for lower version ghc

* Add Cabal constraint for stack-9.0.1.yaml

* Try ghc-lib-parser for BufSpan

* Loose tactic compiling constraint

* Rename hlint34

* Rerun test

* Update doc

* Comment ghc-exactprint requirements

* Add test for apply-refact-0.10

* Use hackage stylish-haskell

* ghc-exactprint constraints for hls-class-plugin

* Remove uncompiled if

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-04-28 17:36:25 +00:00
Zubin Duggal
5ce21d0a77
Bump hls-test-utils to 1.3
Also need to bump the minor versions of all packages which were not bumped since 1.6.1.1
and had changes to their testsuite.
2022-04-23 16:45:47 +05:30
Zubin Duggal
41b30b5706 Prepare 1.7.0.0 2022-04-21 14:08:10 +05:30
George Thomas
129e584e6b
Merge branch 'master' into fourmolu-cli 2022-03-10 23:33:30 +00:00
George Thomas
594777a463 Refactor: Allow passing plugin config to goldenWithHaskellDocFormatter 2022-03-10 01:13:20 +00:00
Pepe Iborra
6a8dc225ae
Implement cycle detection in hls-graph (#2756) 2022-03-08 10:34:57 +00:00
J. S
3b687a52ac
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
2022-02-20 21:50:28 +00:00
hololeap
78305f2178
Remove getHspecFormattedConfig which is no longer used (#2721) 2022-02-18 21:57:55 +00:00
Jan Hrcek
074593987e
Get rid of some head usages (#2651)
* Get rid of come head usages

* Fix typo

* Use pattern guard, move util to hls-test-utils

* Revert the change in ghcide tests

* Fix nonexaustive pattern warning
2022-01-30 16:28:40 +01:00
Javier Neira
ce41b6459a
Prepare 1.6.0 release (#2642)
* 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>
2022-01-28 09:06:56 +00:00
Kobayashi
310e6a4683
support selection range lsp feature (#2565)
* add selection range support

* add the whole import area as a selection step

* add selection range plugin to all project files

* merge type signature with value definition

* support ghc 9

* fix it for ghc-9.0

* remove unnecessary import

* reformat GhcIde.hs

* selection range: make it easier to understand

* selection range: improve error handling

* update lsp-types to 1.4.0.1

* add selection range to doc

* fix comment for findSelectionRangesByPositions

* remove a use of partial function

* update author & maintainer

* use foldlM1 instead of foldl1

* add testdata to cabal file

* update performace tips and log level

* update lsp-types in nix

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2022-01-24 13:13:56 +00:00
Pepe Iborra
4386396624
Build with GHC 9.2 (#2503)
* 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>
2022-01-12 21:57:36 +00:00
Michael Peyton Jones
7518a3a7eb
Upgrade to new version of lsp libraries (#2494)
* Update to latest version of lsp libraries

* Compute completions on kick

This is not only for faster completions.
 It's also needed to have semi-fresh completions after editing.
This is specially important for the first completion request of a file - without this change there are no  completions available at all

* Emit LSP custom messages on kick start/finish

useful to synchonize on these events in tests

* Fix completions tests after https://github.com/haskell/lsp/pull/376

* Restore cabal update with comments

* Use new lsp in stack 9.0.1

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: jneira <atreyu.bbb@gmail.com>
2021-12-29 09:45:25 +01:00
Javier Neira
b05e14d7fb
Prepare 1.5.1 (#2393)
* Rerun tests between run attempts

* without quotes

* Bump up versions for hackage

* Add support for auth github requests

As anonymous ones reach the api limit quickly
Via a unique argument with a github oauth token

* Add changelog for 1.5.1

* Fix makrdownlint warnings

* Bump up index state

* Bump up plugin version

* build with -v3 on error

* More backjumps for tests and benchs

* Add last prs

* eval plugin needs ghcide>=1.5.0.1

* Include #2395 in the changelog

* Ignore deferred tests for win and 9.0.1

* Ignore tactics tests for ubuntu+8.6.5
2021-11-28 12:54:17 +00:00
hololeap
8945881780
Update ghcide dependency for various plugins (#2368)
* hls-class-plugin: Update ghcide dependency

`hls-class-plugin-1.0.1.1` imports `Development.IDE.GHC.Compat.Util`, which doesn't exist until version `1.5.0`

```
Building library for hls-class-plugin-1.0.1.1..
[1 of 1] Compiling Ide.Plugin.Class ( src/Ide/Plugin/Class.hs, dist/build/Ide/Plugin/Class.o, dist/build/Ide/Plugin/Class.dyn_o )

src/Ide/Plugin/Class.hs:27:1: error:
    Could not find module ‘Development.IDE.GHC.Compat.Util’
    Perhaps you meant
      Development.IDE.GHC.Compat (from ghcide-1.4.2.2)
      Development.IDE.GHC.Util (from ghcide-1.4.2.2)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
27 | import           Development.IDE.GHC.Compat.Util
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

* hls-fourmolu-plugin: Update ghcide dependency

```
src/Ide/Plugin/Fourmolu.hs:18:1: error:
    Could not find module ‘Development.IDE.GHC.Compat.Util’
    Perhaps you meant
      Development.IDE.GHC.Compat (from ghcide-1.4.2.2)
      Development.IDE.GHC.Util (from ghcide-1.4.2.2)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
18 | import qualified Development.IDE.GHC.Compat.Util as S
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

* hls-hlint-plugin: Update ghcide dependency

```
src/Ide/Plugin/Hlint.hs:79:1: error:
    Could not find module ‘Development.IDE.GHC.Compat.Core’
    Perhaps you meant Development.IDE.GHC.Compat (from ghcide-1.4.2.2)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
79 | import           Development.IDE.GHC.Compat.Core                    hiding
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
```

* hls-ormolu-plugin: Update ghcide dependency

```
src/Ide/Plugin/Ormolu.hs:14:69: error:
    Module ‘Development.IDE.GHC.Compat’ does not export ‘hsc_dflags’
   |
14 | import           Development.IDE.GHC.Compat      (moduleNameString, hsc_dflags)
   |                                                                     ^^^^^^^^^^

src/Ide/Plugin/Ormolu.hs:16:1: error:
    Could not find module ‘Development.IDE.GHC.Compat.Util’
    Perhaps you meant
      Development.IDE.GHC.Compat (from ghcide-1.4.2.2)
      Development.IDE.GHC.Util (from ghcide-1.4.2.2)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
16 | import qualified Development.IDE.GHC.Compat.Util as S
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

* hls-retrie-plugin: Update ghcide dependency

```
src/Ide/Plugin/Retrie.hs:60:56: error:
    Module ‘Development.IDE.GHC.Compat’ does not export ‘Outputable’
   |
60 |                                                        Outputable,
   |                                                        ^^^^^^^^^^

src/Ide/Plugin/Retrie.hs:64:56: error:
    Module
    ‘Development.IDE.GHC.Compat’
    does not export
    ‘SourceText(..)’
   |
64 |                                                        SourceText (..),
   |                                                        ^^^^^^^^^^^^^^^

src/Ide/Plugin/Retrie.hs:68:56: error:
    Module ‘Development.IDE.GHC.Compat’ does not export ‘hm_iface’
   |
68 |                                                        hm_iface, isQual,
   |                                                        ^^^^^^^^

src/Ide/Plugin/Retrie.hs:68:66: error:
    Module ‘Development.IDE.GHC.Compat’ does not export ‘isQual’
   |
68 |                                                        hm_iface, isQual,
   |                                                                  ^^^^^^

src/Ide/Plugin/Retrie.hs:69:56: error:
    Module ‘Development.IDE.GHC.Compat’ does not export ‘isQual_maybe’
   |
69 |                                                        isQual_maybe,
   |                                                        ^^^^^^^^^^^^

src/Ide/Plugin/Retrie.hs:72:56: error:
    Module
    ‘Development.IDE.GHC.Compat’
    does not export
    ‘nameModule_maybe’
   |
72 |                                                        nameModule_maybe,
   |                                                        ^^^^^^^^^^^^^^^^

src/Ide/Plugin/Retrie.hs:73:56: error:
    Module ‘Development.IDE.GHC.Compat’ does not export ‘nameRdrName’
   |
73 |                                                        nameRdrName, occNameFS,
   |                                                        ^^^^^^^^^^^

src/Ide/Plugin/Retrie.hs:73:69: error:
    Module ‘Development.IDE.GHC.Compat’ does not export ‘occNameFS’
   |
73 |                                                        nameRdrName, occNameFS,
   |                                                                     ^^^^^^^^^

src/Ide/Plugin/Retrie.hs:74:56: error:
    Module ‘Development.IDE.GHC.Compat’ does not export ‘occNameString’
   |
74 |                                                        occNameString,
   |                                                        ^^^^^^^^^^^^^

src/Ide/Plugin/Retrie.hs:79:56: error:
    Module ‘Development.IDE.GHC.Compat’ does not export ‘rdrNameOcc’
   |
79 |                                                        rdrNameOcc, rds_rules,
   |                                                        ^^^^^^^^^^

src/Ide/Plugin/Retrie.hs:81:1: error:
    Could not find module ‘Development.IDE.GHC.Compat.Util’
    Perhaps you meant
      Development.IDE.GHC.Compat (from ghcide-1.4.2.2)
      Development.IDE.GHC.Util (from ghcide-1.4.2.2)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
81 | import           Development.IDE.GHC.Compat.Util      hiding (catch, try)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

* hls-retrie-plugin: Update ghcide dependency

```
src/Ide/Plugin/Splice.hs:48:1: error:
    Could not find module ‘Development.IDE.GHC.Compat.Util’
    Perhaps you meant
      Development.IDE.GHC.Compat (from ghcide-1.4.2.2)
      Development.IDE.GHC.Util (from ghcide-1.4.2.2)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
48 | import qualified Development.IDE.GHC.Compat.Util as Util
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

* hls-stylish-haskell-plugin: Update ghcide dependency

```
src/Ide/Plugin/StylishHaskell.hs:13:1: error:
    Could not find module ‘Development.IDE.GHC.Compat.Util’
    Perhaps you meant
      Development.IDE.GHC.Compat (from ghcide-1.4.2.2)
      Development.IDE.GHC.Util (from ghcide-1.4.2.2)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
13 | import qualified Development.IDE.GHC.Compat.Util as Util
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

* hls-tactics-plugin: Update ghcide dependency

```
src/Wingman/Metaprogramming/Lexer.hs:14:1: error:
    Could not find module ‘Development.IDE.GHC.Compat.Core’
    Perhaps you meant Development.IDE.GHC.Compat (from ghcide-1.4.2.2)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
14 | import           Development.IDE.GHC.Compat.Core (OccName, mkVarOcc)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Wingman/Range.hs:7:1: error:
    Could not find module ‘Development.IDE.GHC.Compat.Core’
    Perhaps you meant Development.IDE.GHC.Compat (from ghcide-1.4.2.2)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
7 | import           Development.IDE.GHC.Compat.Core
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Wingman/Range.hs:8:1: error:
    Could not find module ‘Development.IDE.GHC.Compat.Util’
    Perhaps you meant
      Development.IDE.GHC.Compat (from ghcide-1.4.2.2)
      Development.IDE.GHC.Util (from ghcide-1.4.2.2)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
8 | import           Development.IDE.GHC.Compat.Util as FS
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Wingman/StaticPlugin.hs:12:1: error:
    Could not find module ‘Development.IDE.GHC.Compat.Util’
    Perhaps you meant
      Development.IDE.GHC.Compat (from ghcide-1.4.2.2)
      Development.IDE.GHC.Util (from ghcide-1.4.2.2)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
12 | import Development.IDE.GHC.Compat.Util
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

* hls-test-utils: Update ghcide dependency

```
src/Test/Hls.hs:52:51: error:
    Module
    ‘Development.IDE.Plugin.Test’
    does not export
    ‘TestRequest(GetBuildKeysBuilt)’
   |
52 | import           Development.IDE.Plugin.Test     (TestRequest (GetBuildKeysBuilt, WaitForIdeRule, WaitForShakeQueue),
   |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Test/Hls.hs:57:51: error:
    Module ‘Ide.PluginUtils’ does not export ‘idePluginsToPluginDesc’
   |
57 | import           Ide.PluginUtils                 (idePluginsToPluginDesc,
   |                                                   ^^^^^^^^^^^^^^^^^^^^^^
```

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-11-22 14:38:51 +01:00
Javier Neira
311107eabb
Prepare 1.5.0 (#2361)
* Use hackage version of czipwith

* Update stack.yaml's

* Remove source czipwith

* Update index and clean cabal-ghc921.project

* extra-1.7.9 has a breaking change so no way

* Increase resources for circleci

As for November 16, circleci has set a timeout of 1 hour for jobs in free plans
Trying to increase resources to make the build faster as suggested by its support center

* Use more threads reduce build times

* Correct runs-on field

* Update stack.yaml's

* Dont fail fast if we are checking

* Use ref_name to check it is a check

* Bump patch version of brittany plugin

* Allow newer base/th for czipwith

* Add enough allow-newers to allow build the project

Having all subpackages included in the `packages` field

* Correct allow-newer's

* Add missing cd's

* Bump up ghcide to 1.5.0

* Exclude pkgs not buildable with 9.0.1

* Bum up plugins with changes versions

* Bum up subpackages with changes versions

* Bum up hls version to 1.5.0

* Bump up haddock plugin version

* Allow ghcide 1.5

* Use ghcide 1.5.0 in the rest of plugins

* Use ghcide 1.5.0 for pragmas

* Allow tactics 1.5.0 for hls

* Remove czipwith in hackage ci script

* Disable 9.0.1 for hackage ci

* Use bounds operator consistently

* Build formatters with newer ghc-lib-parser

* Only stylish-haskell needs newer ghc-lib

* Avoid ghc-9.0.1 in other way

* Script needs a min time version

* First draft of 1.5.0 changelog

* Comment out hackage for 9.0.1

* allow newer ghc-lib-parser

* Remove redundant entry

* Correct condition

* Cancel previous hackage jobs

* Add link to pepe's talk slides

* Use th-extras master

* Use th-extras master and uncomment packages

* add extra-1.7.9

* Add required extra-deps

* Comment unbuildable packages again

* Add ignore-plugins-ghc-bounds

* Add #2354

* Complete ghc deprecation notice

* Add extra-1.7.9

* Add #2346 to Changelog
2021-11-18 06:28:38 +01:00
Pepe Iborra
9639bd09e6
Show build graph statistics in ghcide-bench (#2343)
* 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.
2021-11-11 18:57:25 +00:00
Pepe Iborra
9415e55672
Trace diagnostics (#2333)
* trace rule diagnostics

* disable checkProject in HLS test suite

We already disable this in ghcide tests
It introduces noise (traces are harder to read),
and can potentially break tests too (e.g. eval plugin)

* Undo breaking auto-format

* fix missing import

* Fix splice plugin tests

* Fix test

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-11-10 15:01:30 +00:00
Javier Neira
7011d5e363
[skip circleci] Rename hlint test data files and add regression tests (#2321)
* Rename test data files

* Add regression tests

* Add regression test for #1279

* Use timeout

* Correct waitForProgressDone in ghcide

* Remove unnecessary waitForDiagnostics

* Mark test broken for hlint on ghclib

* Add test over unused extensions

* Add test for #2042

* Add data for #2280

* Use waitForAllProgressDone

* Add test for #2280

* correct module name

* Add reproduction for #2290

* Correct test case

* Comment about knownBrokenForHlint*

* Correction
2021-11-10 08:11:33 +00:00
Pepe Iborra
229faac11a
Generate linkables in the Eval plugin (#2295)
* [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
2021-10-25 01:38:34 +00:00
Javier Neira
fffc04d79a
Move hlint tests to its own package (and other clean ups) (#2284)
* Move hlint tests to its package

* Move hlint config tests to its package

* Update extra-source-files

* Remove unused cabal-helper test data

* Add hlint test suite

* Make diganostic tests work without hlint

* Make progressCap test work without hlint files

* No cabal files in hlint test data

* Fix progress test

* Fix parent folder name

* Correct test data dir

* Correct extra-source dir and update maintainer

* Use sendConfigurationChanged everywhere
2021-10-22 09:24:35 +00:00
Pepe Iborra
edf7be5da8
Enable the ghcide test plugin in HLS test suites (#2243)
* convert to HLS plugin

* remove unnecessary check

* use waitForBUildQueue in the Tactics test suite

* use waitForBuildQueue in the splice test suite

* use waitForBuildQueue in golden test helpers

* really enable Test plugin

* silenceStdErr to honor LSP_TEST_LOG_STDERR

* Disable timeout in tactics testsuite

* no longer silence stderr

Instead, send all ghcide output through the logger and keep stderr open for fatals

* silence the tactics plugin

* fix ModLocation for nameless modules
2021-10-04 01:14:18 +00:00
Pepe Iborra
682386d1c9
Reimplement shake (continued) (#2060)
* 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>
2021-09-25 10:23:52 +00:00
Pepe Iborra
2fef04193c
Build with lsp 1.2.0.1 (#2059)
* Fix lsp dependency in cabal

* Fix lsp dependency in stack

* Fix build with lsp-types 1.3.0.0

* fix tests
2021-08-01 23:33:03 +01:00
Junyoung "Clare" Jang
e7c5e90b6d
Prepare 2021 July Release [HLS 1.3.0] (#2052)
* Prepare July 1.3.0 release

* Update package versions

* Fix typo

* Reflect feedback

Co-authored-by: Sandy Maguire <sandy@sandymaguire.me>

* Reflect feedback

Co-authored-by: Sandy Maguire <sandy@sandymaguire.me>

* Update ChangeLog.md

* Update ChangeLog.md

Co-authored-by: Sandy Maguire <sandy@sandymaguire.me>
2021-07-30 05:45:34 +00:00
Sandy Maguire
920705004b
Disable hole fit suggestions when running Wingman (#1873)
* Disable hole fit suggestions for EXTREME SPEED

* Note the new behavior in the README

* Disable the tests

* Update documentation

* Fix tests properly

* Tests that code actions don't appear when Wingman is enabled

* Unset dynflags rather than change their values

* Fix error message

* Revert "Unset dynflags rather than change their values"

This reverts commit 940c535ab9.

* Maybe try unsetting it too?

* Maybe this will elucidate the error

* Disable tests on GHC9 because tactics doesn't build on GHC9

* Revert "Maybe this will elucidate the error"

This reverts commit 6c5b8356a3.

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-07-23 18:35:51 +00:00
Javier Neira
8edb0f7c2a
Enable tests for ghc 9 and promote ghcVersion check (#2001)
* Test 9.0.1 for windows and macOS

* Refactorize ghc checking in tests

* Replace CPP checks with ghcVersion

* Use GHC cpp and remove 8.4

* Use the ghc version runtime checker

* HLINT ann ignored for ghc-9 too

* Mark test as broken for win and ghc-9

* Use GHC90 in eval tests

* Disable tests for macos and ghc-9.0.1

* Test 9.0.1 for windows and macOS

* Refactorize ghc checking in tests

* Correct imports/exports

* Replace CPP checks with ghcVersion

* Use GHC cpp and remove 8.4

* Use the ghc version runtime checker

* HLINT ann ignored for ghc-9 too

* Mark test as broken for win and ghc-9

* Use GHC90 in eval tests

* Avoid reformatting code

* Remove not supported ghc-8.4

* Disable tests for macos and ghc-9.0.1

* Ignore hlint+cpp tests for win and ghc-9.0.
2021-07-07 18:18:14 +02:00
Potato Hatsue
47db34f248
Eval plugin: support ghc 9.0.1 (#1997)
* Eval plugin: support ghc 9.0.1

* Update CI and stack

* Use pprTypeForUser for printing kinds

* test: remove forall

* test: [Char] -> String

* test: update forall

* Keep tests only for GHC 9

* Update nix and CI

* Mark one hlint test as known broken

* Re-enable tests for other ghc versions

* Update test
2021-07-05 15:57:33 +08:00
Pepe Iborra
a7321ac5bc
follow change in lsp-types (#1985)
* follow change in lsp-types

* fix version constraint

* Fix hlint
2021-06-29 10:38:09 +01:00
Junyoung/Clare Jang
7d7c2ef4ef
Prepare 1.2.0 June release (#1912)
* Fix changelog generator

* Prepare 1.2.0

* Update plugin versions

* Fix hls plugin dependency

* Update changelog

* Fix a wrong link

* Bump other packages versions

* Revert version changes of unreleased packages

* Fix ghcide bound for hls

* Update version dependencies
2021-06-12 15:40:50 -04:00
Junyoung/Clare Jang
cc4dea6962
Extract last 2 plugins and clean up others (#1836)
* Add goldenWithHaskellDoc test util

* Extract module name plugin

* Extract ormolu plugin

* Clean up brittany plugin

* Clean up class plugin

* Clean up eval plugin

* Clean up explicit imports plugin

* Clean up floskell plugin

* Clean up fourmolu plugin

* Clean up haddock comments plugin

* Clean up hlint plugin

* Clean up pragmas plugin

* Clean up refine imports plugin

* Clean up retrie plugin

* Clean up splice plugin

* Clean up stylish haskell plugin

* Fix formatter tests

* Fix tests' hie.yaml

* Clean up Wingman

* Fix eval tests
2021-05-17 13:02:52 -04:00
Javier Neira
a9113df001
Add hspec upper bound (#1837) 2021-05-16 13:39:53 -04:00
Junyoung/Clare Jang
e0a464282d
Apply formats again (#1824)
* Apply formattings

* Update nix exclude range
2021-05-13 05:00:48 +00:00
Junyoung/Clare Jang
4e95b99ad2
Ignore filemode in diff (#1819) 2021-05-11 04:11:35 +00:00
Pepe Iborra
9698c16f58
Prepare ghcide release v1.3.0.0 (#1811)
* Prepare ghcide release v1.3.0.0

* refactor - move defineNoFile variants

* Refactor - move GetFilesOfInterest type and use the appropriate define

* Restore compatibility with aeson < 1.5.2

* add missing reexport
2021-05-09 18:17:24 +01:00
Potato Hatsue
98fa0fc1a2
Add bounds for base in hls-test-utils (#1791) 2021-05-04 17:47:02 +02:00
Potato Hatsue
9308ff4771
Loosen dependency bounds (#1787)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2021-05-03 13:39:32 +00:00
Pepe Iborra
6ecf17bd45
Progress reporting improvements (#1784)
* factor out progress reporting

* extract out progress reporting

* hlint

* clean ups

* Fix splice plugin tests

* fix client settings test

* Avoid empty report messages in the NoProgress style

* avoid div by zero

* wait for progress create response

* simplify the outer loop away

* correctly implement progressStop

* Improve asymptotics

* Increase the parallelism used in hlint tests

* extract recordProgress

* comments

* fix test

* remove unnecessary tilde

* apply review feedbacks
2021-05-03 09:43:27 +00:00
fendor
0da416847b
Unify session loading using implicit-hie (#1783)
* Unify session loading using implicit-hie

Make Wrapper and Session loader use the same logic to avoid
loading logic divergence.

Cleans up existing usages to use infrastructure in place.

* Add major CLI mode for printing the cradle type

Adds test-case for proving that wrapper and hls report the
same cradle type for a project.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-05-02 20:26:53 +00:00
Neil Mitchell
3be343acf7
Add hls-graph abstracting over shake (#1748)
* Add a new project hls-graph, shadowing Shake and reexporting it

* Make hls-graph use explicit exports rather than module-level exports

* Cut down on what hls-graph exports

Delete unnecesssary hiding
2021-04-18 15:55:12 +00:00
Potato Hatsue
f1c0969271
Prepare ghcide 1.2.0.2 and HLS 1.1.0 (#1722)
* Update CHANGELOG

* Bump ghcide to 1.2.0.2

* Downgrade release building runner to ubuntu-18.04
2021-04-13 15:56:15 +08:00
Potato Hatsue
0227133dc5
Prepare ghcide 1.2.0 (#1707) 2021-04-11 20:32:57 +08:00
Potato Hatsue
0241c478fa
Adjust bounds (#1701)
* Bump up lower bounds of hls-plugin-api to 1.1

* Add bounds for hls-test-utils

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-04-10 16:28:36 -04:00
Potato Hatsue
2d1a588d0d
Run plugins' test suites with server in the same process (#1628)
* Run plugins' test suites with server in the same process

* Use async

* Update CI

* Add rts options

* Sleep 0.5s after running a session

* Update CI

* Don't use withAsync

* Add timeout

* Cancel the server action when timeout

* Fix cwd

* Close input stream manually, add a lock

* cleanup

* tactics plugin

* Remove sleep

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-04-06 15:37:50 +08:00
wz1000
6d1f1a55e3
Update to lsp-1.2 (#1631)
* Update to lsp-1.2

* fix stack

* fix splice plugin tests

* fix tactic plugin tests

* fix some tests

* fix some tests

* fix outline tests

* hlint

* fix func-test
2021-04-01 16:44:08 +00:00
Potato Hatsue
df67bee3d4
Migrate tests of plugins (#1612)
* Class plugin

* Splice plugin, extract hlsCommand from hls-test-utils

* Haddock comments plugin

* Update github actions

* Remove invalid import

* Bump up specification version of package description to 2.4

* Fix hls.cabal

* Remove the build of eval plugin's testdata from circle ci

* Limit the parallelism of building test suites in circle ci

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2021-03-25 12:04:17 +08:00
Potato Hatsue
7255b408da
Extract hls-test-utils (#1606)
* Extract hls-test-utils

* Use test utils in brittany plugin and stylish haskell plugin

* stack

* Set locale encoding to utf8 in defaultMain

* Remove with-utf8
2021-03-23 18:45:45 +08:00