Commit Graph

147 Commits

Author SHA1 Message Date
Kobayashi
445192e21d
refactor selection range plugin (#3003)
* update Gitpod config

* update nix shellHook & docs

* install pre-commit hook

* add kokobd as code owner to .gitpod.*

* add gen-hie to Gitpod

* add tools for doc

* remove .pre-commit-config.yaml from .gitignore

* set vscode formatter to stylish-haskell in Gitpod

* refactor selection range plugin

* refine selection range

* add CodeKind to CodeRange

* rename hls-selection-range-plugin to hls-code-range-plugin

* update docs about selection range

* cleanup RuleTypes.hs

* add the missing bang pattern

* fix subRange

* add some unit tests to CodeRange.Rules

* add tests for removeInterleaving

* add even more tests

* fix extra sources

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-07-11 04:24:35 +00:00
Kobayashi
344323be54
re-enable haddock (#3015)
* re-enable haddock

* fix it for old GHC

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-07-05 03:49:32 +00:00
Lei Zhu
e64b61e7fd
Support ghc-9.2.3 (#2936)
* Support ghc-9.2.3

* ormolu-0.5

* Update stack.yaml

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2022-06-16 15:29:38 +08:00
George Thomas
0bbc545300 Bump index state
Allows us to use Fourmolu 0.7.
2022-06-12 19:57:45 +01:00
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
Michael Peyton Jones
b1bf549915
nix update (#2892)
* Drop -haddock as ghc 8.10.7 fails to build ghc-lib with:

```
compiler/GHC/CmmToAsm/AArch64/CodeGen.hs:176:15: error:
2081
Error:     parse error on input {- | debugIsOn -}
2082
    |
2083
176 | ann doc instr {- | debugIsOn -} = ANN doc instr
2084
    |               ^^^^^^^^^^^^^^^^^
```

  # Please enter the commit message for your changes. Lines starting

* flake.lock: Update

Flake lock file updates:

• Updated input 'flake-compat':
    'github:edolstra/flake-compat/b7547d3eed6f32d06102ead8991ec52ab0a4f1a7' (2022-01-03)
  → 'github:edolstra/flake-compat/b4a34015c698c7793d592d66adbab377907a2be8' (2022-04-19)
• Updated input 'flake-utils':
    'github:numtide/flake-utils/997f7efcb746a9c140ce1f13c72263189225f482' (2021-08-20)
  → 'github:numtide/flake-utils/a4b154ebbdc88c8498a5c7b01589addc9e9cb678' (2022-04-11)
• Updated input 'gitignore':
    'github:hercules-ci/gitignore.nix/211907489e9f198594c0eb0ca9256a1949c9d412' (2021-01-26)
  → 'github:hercules-ci/gitignore.nix/bff2832ec341cf30acb3a4d3e2e7f1f7b590116a' (2022-03-05)
• Updated input 'hie-bios':
    'https://hackage.haskell.org/package/hie-bios-0.9.0/hie-bios-0.9.0.tar.gz?narHash=sha256-nd+FfUQVZNxJfKZkAWA3dF0JwRgXntL+1gGvyNHDbKc='
  → 'https://hackage.haskell.org/package/hie-bios-0.9.1/hie-bios-0.9.1.tar.gz?narHash=sha256-5RqspT27rb%2ftMBwrKr4VfSSbq0+c0LMNuaKlTun0Kkk='
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/c473cc8714710179df205b153f4e9fa007107ff9' (2021-12-13)
  → 'github:NixOS/nixpkgs/ab83c5d70528f1edc7080dead3a5dee61797b3ff' (2022-04-24)
• Updated input 'pre-commit-hooks':
    'github:cachix/pre-commit-hooks.nix/397f0713d007250a2c7a745e555fa16c5dc8cadb' (2021-06-29)
  → 'github:cachix/pre-commit-hooks.nix/e5e7b3b542e7f4f96967966a943d7e1c07558042' (2022-04-04)
• Updated input 'pre-commit-hooks/flake-utils':
    'github:numtide/flake-utils/74f7e4319258e287b0f9cb95426c9853b282730b' (2021-11-28)
  → 'github:numtide/flake-utils/3cecb5b042f7f209c56ffd8371b2711a290ec797' (2022-02-07)
• Updated input 'pre-commit-hooks/nixpkgs':
    'github:NixOS/nixpkgs/6f05cfdb1e78d36c0337516df674560e4b51c79b' (2022-01-01)
  → 'github:nixos/nixpkgs/77a7a4197740213879b9a1d2e1788c6c8ade4274' (2022-02-23)

* nix flake update & bump ghc921 -> ghc922
ghc921 is no longer available on Nix, see:
  https://github.com/NixOS/nixpkgs/pull/163426

* myst-parser: bump docutils version requirements

* fix devShells and packages default

* use ghc-exactprint 1.5.0 for ghc922

* ghc902: add flag hlint34 to nix

* macosx: add SSE-enabled ptr-poker dependency

* ghc902 requires ghc-lib-parser >= 9.2

* nix: ghcDefault supports HLS tweaks

* fix typo

* add support for pre-commit in mkDevShell

* fix typo

* add ptr-poker to nix shell

* add ghc-884 configuration tweaks

* fix stylish-haskell for ghc-884

* fix default ghc lookup

* ghc884: fixup brittany version to 0.13.1.2

* ghc884: fixup aeson version to 1.5.2.0

* ghc884: fixup ormolu/fourmolu

* add configuration tweak for ghc8107

* rename configuration-ghc-xxx.nix files

* update hackage index

* use current cabal/hackage to fetch ptr-poker in mkDevShell

* reinstate .pre-commit.yaml

* nix: temporary disable "build binaries" from the work flow

* nix: temporary disable builds and partially populate cachix

* nix: temporarily disable ghc 884 and 8107

* nix: temporarily disable nix develop run

* nix: re-enable ghc8107/ghc884 builds, disable "build all binaries"

* nix: noop push commit to test cachix

* nix: touch flake.nix, remove ghc 884

* nix: rm ghc 810, ghc88 + disableLibraryProfiling

* nix: build all binaries again

* Update flake.nix

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>

* Update flake.nix

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>

* Update flake.nix

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>

* revert change made on comment

* rm myst-parser.nix

* fix typo (thanks @guibou)

* explain why we disable library profiling with nix

* ghc922, disable "hls-hlint-plugin"

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: Providence Salumu <Providence.Salumu@smunix.com>
Co-authored-by: Providence Salumu <smunix@users.noreply.github.com>
2022-05-13 10:09:51 +01:00
Pepe Iborra
6524122927
Expose runtime metrics via EKG (#2267)
* 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>
2022-05-06 09:58:18 +00:00
Pepe Iborra
8cbefb71bc
Consolidate all cabal.project files (#2866) 2022-05-05 15:07:51 +01:00
Pepe Iborra
2bd9ab4e3c
simplify hlint plugin Cabal descriptor (#2867) 2022-05-01 20:17:13 +00:00
fendor
9f034f290c
Upgrade to hie-bios 0.9.1 (#2766) 2022-03-08 13:24:00 +00:00
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
fendor
0c018ac826
Upgrade to hie-bios 0.9.0 (#2738)
* Try out new hie-bios

* Update to hie-bios 0.9.0 hackage release

* Use caret operator for hie-bios dependency

Co-authored-by: Julian Ospald <hasufell@posteo.de>

* Update nix dependency

* Update hie-bios dependency in flake.nix

Co-authored-by: Potato Hatsue <berberman@yandex.com>

Co-authored-by: Julian Ospald <hasufell@posteo.de>
Co-authored-by: Potato Hatsue <berberman@yandex.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-27 14:21:20 +00: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
Javier Neira
3f4685141c
Add support for ghc 9.0.2 (#2567)
* Extract out ci build setup

* Add required shell property

* Add support for ghc-9.0.2

* Test ghc 9.0.2

* Add unix boot package

* Use primitive-unlifted < 1.0

* Use primitive-unlifted < 1.0 for stack

* Ude 9.0.1 for hackage

We cant use 9.0.2 until all deps do not need allow-newer

* Use a unified cabal-ghc90.project

And bump up index state to get lastest hie-bios

* Use last snapshot with ghc-9.0.2 support

* Use new cabal-ghc90.project in build

* Add stm-containers

* Add specific tweaks for ghc-9.0.2

* Use the las ghc-boot-9.0

* Fix test adding allow-newer

Co-Authored-By: @michaelpj

* Use unix-compat from hackage

* Use unix-compat from hackage

* Make consistent lastest stack.yamls

* Clean up cabal.project

* more cleanups

* Update tweaks in hackage ci

* Correct comment

* Correct fourmolu condition

* Correct fourmolu condition in tests

* Removing the all target from caching

It builds all project packages even if we they are not buildables
(and are not included in hls due to flags)
Its goal was build all tests and benchmarks but --enable-tests
ans --enable-benchmarks should work
Last one does not: https://github.com/haskell/cabal/issues/6259

* exclude Brittany 0.14.0.1

* Update snapshot to get new lsp

* document flag

* Document and build ghcide benchmark

* Doc and use ghc-9.0.2 in hackage

* Add ghc-9.2.1 to tested-with

* Use 9.0.2 in gitlab

* Use last *molus

* Use same versions as cabal build

* Use cabal freeze versions

* Add dep for ghcide tests

* one by one

* Unnecessary change

* Remove unnecessary flag

* Corrections

* Move blocks

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-01-17 01:18:04 +00:00
George Thomas
4ffdf45a39
Bump Ormolu and Fourmolu to GHC-9.2-compatible versions (#2579)
* Bump Ormolu and Fourmolu to latest versions (resp. 0.4 and 0.5)

* Enable Ormolu and Fourmolu on GHC 9.2

* Bump index-state

* enable tests for ghc-9.2.1

* enable fourmolu and ormolu

* Allow newer ghc-lib-parser for *molu

* Fix ormolu

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Co-authored-by: Junyoung "Clare" Jang <jjc9310@gmail.com>
2022-01-13 11:35:35 +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
Anton Latukha
e6c1fcab76
CI: caching: fix early termination expression check & cabal.project replacement (#2520)
* CI: caching: fix early termination expression check

It is obscure bug.

Details are in
https://matrix.to/#/!oOjZFsoNYPAbTEgSOA:libera.chat/$tB_L6wbaxe1ElQtYzMI9woID4hZyscS6Rhpn-nsCc6Y?via=libera.chat&via=matrix.org&via=monoid.al

Because after the second path somehow it always returned `False` - the caching
runs always resulted in early termination.

* CI: caching: fx `cabal.project` copying

In the
https://github.com/haskell/haskell-language-server/runs/4596861600?check_suite_focus=true
of
https://github.com/haskell/haskell-language-server/pull/2503

Noted that:

I rm cabal.project. The sources of cabal-ghc921.project contain:
index-state: 2021-12-18T00:00:07Z
cp cabal-ghc921.project cabal.project
Then from cabal.project CI retrieves finderprint 2021-11-29T08:11:08Z.
Seems like GitHub uses alias cp=cp -i - preventing UNIX-like default copying over behaviour.
& rm cabal.project does not remove the file.
cabal.project seems to be protected from deletion.

* cabal*.project: index-state +1s

Renewing cache.

* CI: {caching,test}: make rm/cp comment more informative

* CI: {caching,test}: upd commets

This should short-cirquit.

* cabal*.project: index-state +1s

* Correct small typo

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-12-22 12:59:41 +00:00
Anton Latukha
9bd5271629
cabal-*.project: index-state +1s (#2515)
This is vacuous change, Hackage rerolls to the previous snapshot time
nevertheless of this change, but the caches get a new key namespace.
2021-12-21 06:45:24 +01:00
Pepe Iborra
807cb8f1fe
Warn if TH and Mac and static binary (#2470)
* Warn if TH and Mac and static binary

* fix up the instructions

* use hostIsDynamic

* Upgrade hie-bios version

* bump cabal index

* fix more Stack descriptors

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-12-13 12:35:44 +00:00
Nick Suchecki
1a74937ca5
HLS Plugin to provide Alternate Literal Formats. (#2350)
* Initialize and Setup Plugin Source.

* Provide Traversal Module to Haskell AST that collects Literals.

* Change Literals module to return type.

Update our parsing module to return the data type we will use in our
plugin.

The datatype: Literal

Constructors:

Overloaded - Contains an overloaded literal with a SrcSpan

NonOverloaded - Contains non-overloaded literals with a SrcSpan

NoLocation - currently unused.

This data type is bound to change. This module is designed to capture
ALL numeric literals for use in the plugin. When parsing Haskell source
tree, certain cases result in getting a plain `Expr`. This means it is
not annotated with a SrcSpan. As a result, we pass along a SrcSpan
through most functions to keep track of the most recent SrcSpan
encountered. This isn't a fool proof plan and may be removed in the
future.

* Implement Logic for actual CodeActions.

The traversal of Haskell source has been turned into a rule. This rule
generates hidden diagnostics which allow a user to run a code action
over (most) literals.

There is some "dead code" in the sense that some literals (prims to be
exact) are not allowed to be changed, despite existing in code. The
other "dead code" exists in the FormatType type. Certain extensions
exist that alter how numbers are shown or act, we make note of those
extensions but call them "NoFormat", which essentially means it's a
NOOP.

Most of the conversion is done via the Numeric module. There are plenty
of "show" functions that provide the translation of numbers into the
various formats. The only custom format is a slightly "dumb"
NumDecimal-extension-function that generates three separate options,
instead of using a numeric defined function.

* Clarify source code comments. Reformat file structure.

* Set up Test Scaffolding.

* Miscellaneous clean-up.

* Use Regex to Match Source Text.

* Remove unneccessary diagnostics from Rule.

* Update all stack versions to include new Plugin.

* Clean up Conversion.hs and AlternateNumberFormat.

Clean up function names and add supporting haddock documentation for
exported functions.

* Update cabal file bounds and add Github workflow test

* Add plugin package to all cabal.project

* Add plugin to test suite

* Push SYB changes. Test.hs is merely for testing and will be removed prior to Merge.

* Use Generics.SYB for parsing Literals from GHC Source.

Updated Literals.hs to use custom SYB traversal of the AST.

* Update hls-alternate-number-format-plugin.cabal

* WIP: run tests

* Test additions and GHC compatability changes.

* Removed dead code.

PrimLiterals were defined originally, however GHC source doesn't provide
the source text. This is one of the needs of the plugin so we don't
provide duplicate suggestions.

Swapped `Maybe Text` to `Text`. Similar to above we now ignore all
literals that have no source text attached.

Swapped `Maybe SrcSpan` to `RealSrcSpan`. Again, similar to the previous
points we now ignore literals that don't get a sourceSpan attached.
Similarly, we drop any `UselessSpan`'s as those are also not very
helpful.

* Use Set to remove duplicates from CollectLiterals Result.

Certain AST representations are traversed multiple times with the switch
to SYB. Using Set allows to easily remove duplicate Literals from our
result.

Added a test suite to monitor for regressions.

* Delete Test.hs

Inadvertently commit this file.

* Add README and bump version to 1.0.0.0.

* Update HLS cabal file for version change.

* Additional Tests.

* Update Test file to use Path library function.

* Miscellaneous Code Fixes.

- Remove unneeded imports/functions.

- Export only specified functions from each module (and add Haddock
  Comment if necessary)

- Minor text changes for accuracy

* Add README to Extra Source Files.

* Update Extra Source Files to include Test Haskell Source files.

* Update Features.md and Minor Bug Fix :)

* Add new plugins to hackage workflow

* Fix Bug caused by Minor Bug Fix.

Co-authored-by: jneira <atreyu.bbb@gmail.com>
Co-authored-by: Fendor <power.walross@gmail.com>
2021-12-01 14:12:06 +00:00
J. S
d0ccc2f9f3
Qualify imported names plugin (#2355)
* actual initial qualify imported names implementation

* renamed and added tests for QualifyImportedNames plugin

* fix backtick and parenthesized operators not being qualified correctly

* add tests, and remove logging

* add license, readme, and demo

* remove old demo, add slightly better demo

* remove old mp4 demo, add slightly gif demo

* update readme to use demo

* readme typo

* slight rewording of readme

* slight rewording of readme 2

* remove Demo header from readme

* don't need ShakeExtras and remove some more logging stuff

* hopefully fix ghc 9 differences, rename plugin cabal file

* forgot comma on module re-export

* minimize imports

* fix Hashmap import for ghc <= 8.8, remove unused extension pragmas

* fix hls-qualify-imported-names ghcide bound

* add test suite to CI

* add more tests for qualify imported names plugin

* change ghcide bound to match what @hololeap is doing

* add qualify imported names to feature list

* add demo, readme, test files, test hie.yaml to extra source files

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-11-29 17:58:25 +00:00
Javier Neira
6506991fd5
Use dependent-sum from hackage (#2412)
* Use dependent-sum from hackage

* Update index in all project files
2021-11-29 13:29:26 +00: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
Javier Neira
07042d4043
Use hackage version of czipwith (#2346)
* 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

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2021-11-17 15:09:46 +00:00
George Thomas
ee4b496645
Bump Fourmolu to 0.4 (#2254)
* Allow Fourmolu 0.4

* Reformat record construction to Fourmolu style

* Run stylish-haskell on imports

* Enable fourmolu for ghc-9

* Enable fourmolu tests for ghc-9

* Enable fourmolu for ghc-9 and stack

* Correct stack-9.0.1.yaml changes

* Use explicit import to avoid shadowing

* Remove unused import

* Bump plugin version

* Enable -Wall

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-10-05 19:38:37 +00:00
Julian Ospald
597bee9377
Add gitlab CI (#2200)
* Add gitlab CI

* Add comment

* Comment about vendored packages

* Add link to gitlab ci config

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-09-19 00:45:58 +00:00
Javier Neira
3bfb9b3fd9
Drop ghc support for 8.6.4, 8.10.2, 8.10.3, 8.10.4 (#2197)
* Remove outdated setup troubleshooting

* Remove ghc-8.6.4 support

* Remove ghc-8.10.2 support

* Remove ghc-8.10.3 support

* Remove ghc-8.10.4 support

* Complete list of tested ghcs

* Update stack resolvers

* Update hackage index

* Set 8.10.7 as default stack.yaml

* Use extra 1.7.9
2021-09-17 13:00:29 +02:00
Pepe Iborra
a23b66c30a
Remove ghc-api source snapshot (#2156)
* Remove ghc-api source snapshot

We can replace the source snapshot with Cabal conditions.
This will unblock Hackage uploads until
https://github.com/haskell/haskell-language-server/pull/2128 lands

* fix 9.0.1 build

* add allow-newer for ghc-api-compat

* fix version bounds for 9.0.1

* fix hls-eval-plugin

* stack fixes

* added new versions of ghc-api-compat

* remove source snapshot from ghc901 cabal project
2021-09-07 12:10:18 +00:00
Oliver Madine
28222e9005
New rename plugin implementation (#2108)
* initial commit

project structure
initial test cases
directly modify source to rename references

* code style

* enable for ghc < 8.8.0

* remove aeson from build-depends

* update support

support ghc9
revert retrie version bump
disable feature by default

* enable plugin for testing

* fix test.yml

* code style, ghc9 retrie bump

remove unnecessary flag in test.yml
consistent indentation
increase retrie version for ghc 9.0.1 (decreased by mistake)

* avoid using Data.List.nub

* code style

fix typo in indentation test
break lines at 100 chars
rename some vars

* code style / performance

remove Retire dependency by using exactprint directly
group references by file to increase speed of checking `elem` per file
add test cases (typeclass, let expression)
add some documentation
fix bug when looking up reference in HieDb
improve error messages
rename some function / vars

* replace GhcPlugins import with Name import

* use GHC.Types.Name for ghc >= 9.0.1
2021-08-21 20:06:53 +02:00
Javier Neira
57ffd74486
Clean cabal project (#2097)
* Remove superflous things

* Set index-state

* Add ghc-api-compat and remove shake-bench

* Correct comment about ghc-api-compat

* Add specific project file for benchs

* Use specific project file for benchmarks

* Ensure we use lsp-1.3.0.1

* Use lsp-types-1.3.0.1 for stack

* Use lsp-types-1.3.0.1 for default stack

* Remove some more allow-newer

* Use one cabal.project

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-08-18 06:00:20 +00:00
Pepe Iborra
f3620d1ee4
reduce allow-newer entries for shake-bench (#2101)
* reduce allow-newer entries for shake-bench

* fix comma
2021-08-17 15:28:28 +02:00
Felix Yan
027587b93f
Enable tests for ormolu plugin (#2086)
It was never enabled in github workflow.

Also we should test it with GHC 9 now.
2021-08-08 07:59:29 +01: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
Lei Zhu
d815d0474d
Call hierarchy support (#1955)
* Initialize structure

* Add basic tests

* prepareCallHierarchy

* Add prepare call hierarchy tests

* Prepare call hierarchy support

* add outgoing calls

* Rename incoming to outgoing

* Add incoming calls support

* Fix panic error caused by parameters

* Prepare callhierarchy tests

* Duplication items support

* Format and add missing components for review

* Use local lsp

* Add CI test

* Fix typo

* Add flag for 9.0.1

* Change lsp repo

* Fix query error in data declaration

* Add incoming/outgoing call tests

* Add flag for test ghc 9.0.1

* Ignore test on 9.0.1

* Add 9.0.1 test

* Specifying lsp for cabal

* Refresh hiedb before incoming/outgoing calls

* Add moduleUnit on ghc 9.0.1

* Compatible with ghc 9.0.1

* Add missing qualifier

* Remove ghcide capability test
2021-07-27 22:40:04 +01:00
Javier Neira
e190a0ee80
Use implicit-hie-cradle-0.3.0.5 (#2020)
* Use implicit-hie-cradle-0.3.0.5

* Use implicit-hie-0.1.2.6 in stack.yaml's
2021-07-15 00:01:34 +00:00
Sandy Maguire
160c509fc2
Wingman: maintain user-defined fixity for definitions (#1697)
* Pass the discovered node to withSmallest/Largest

* Maintain fixity when doing case split

* New layout tests

* Fix tests

* Fix tests wrt new infrastructure

* Update stack yamls

* Update cabal index state

* Forgot a stack yaml

* New commit to hopefully fix CI

* operational is broken upstream

* I dunno what I'm doing

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-07-14 19:43:17 +00:00
Pepe Iborra
a0def3c423
Initialize ExportsMap using hiedb exports (#1989)
* Initialize ExportsMap using hiedb exports

* bump version number

* Add temporary source package to ghc901 cabal project as well

* fix stack descriptors

* remove source package overrides

* refresh cabal index state

* fix 9.0.1 build
2021-06-30 21:15:46 +01:00
Sandy Maguire
b970e25021
Enable hyphenation embedding (#1979)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-06-25 20:21:58 +00:00
Andreas Källberg
5f6ce4af03
Add ghc-9.0.1 to the build release script (#1940)
* Add ghc-9.0.1 to the build release script

* ghc9: Enable module-name plugin

* Diagrams now supports ghc-9.0.1

* Upgrade cabal in build script

* Cache reset updating hackage index

Co-authored-by: jneira <atreyu.bbb@gmail.com>
2021-06-23 10:59:34 +08:00
Junyoung/Clare Jang
7ba6279aa4
Add GHC 8.10.5 support (#1899)
* Add GHC 8.10.5

* Remove GHC 8.10.2

* Fix cabal build

* Downgrade bench to 8.10.4 as master do not have 8.10.5

* Add missing window builds

* Update ghc-api-compat location

* Mark a test as broken in GHC 8.10.5

* Exclude ghc 8.10.5 for MacOS CI

* Update build.yml

* Revert "Remove GHC 8.10.2"

This reverts commit b85b02903b797e63a57179ba49c02fe204e2aab6.
2021-06-10 16:22:17 -04:00
Andreas Källberg
0b3bb10cd2
Ghc 9.0.1 support for ghcide (#1649)
* hie-compat: Add basic support for ghc-9.0.1

A tiny step towards #297

* hie-compat: Remove dependency on ghc-api-compat

* hie-compat: Add more backwards compatability

* Import a bunch of upstream ghc9 fixes

* cabal.project: allow-newer: *:*

The lazy solution to making things compile

* Add more upstream fixes

* Bump patch of ghc-check

* ghcide: Add basic support for GHC-9.0.1

I tried to limit the use of CPP to the Compat module as much as possible
by re-exporting the new functions under the old names,
but there is still plenty of pragmas all over the code.

I'm using ghc-api-compat so the imports doesn't need to be changed as much.

* ghcide: Fix backwards compatability with ghc-8.8.4

* ghc9-ghcide: Fix some more issues that caused runtime errors

* Restore initDynLinker for older versions of ghc

It was probably important for something

* Fix ghc-8.6.5 compatability

* Fix completion test failures for ghc9

With this example:
f asdfgh = asd

it would suggest to complete `asd` into `asd_arNC`,
which seems to be a name it generated because of
deferred-out-of-scope-variables

* Ghc-check now supports ghc-9.0.1

* Retrie now supports ghc-9.0.1

But it's not on hackage yet.

* Restore retrie orphans

* tests: Ghc9 shows [Char] as String by default

This seems like an improvement, so just update the test-suite

* tests: Ghc9 shows TH-errors after the dollar sign

Instead of including it like older versions did

$(foo)
  ~~~~
  some TH error/warning

* Fix two more test failures

- GHC9 uses a more lenient haddock parser
- TH2.17 has polymorphic Q monad with a type class

* ghc9: Fix "Remove redundant imports" code action

In ghc9, only the specific unused function is highlighted,
instead of the whole line.

* ghcide-tests: Show errors where they are caused

instead of deep inside some generic helper function

* Only use nub on SrcSpan for ghc>=9

* Remove more CPP pragmas

* Remove a bit more CPP

This could almost be handled by ghc-api-compat,
but if it was imported from TyCoPpr, it doesn't work with
ghc < 8.10

* Update stack files to support new versions

* Use the version of retire on hackage

The new version is now released

* Don't use allow-newer: *:*

* ghcide-tests: Enable test no longer broken in ghc9

* Update hiedb version for ghcide

* Adjust for a minor change in test output for ghc9

* Fix benchmark test for ghc9

Cabal-3.2 is not buildable on ghc9, but 3.4 is builable on older ghc.

* Mark minor issues as broken for ghc9

Ghc9 highlights both the constructor and the other fields

Maybe this should just be accepted and not seen as broken?

* haddock-comments-plugin: Ghc9 support

* hls-eval-plugin: Partial ghc9 support

* WIP: hls-eval-plugin: Partial ghc9 support

* hls-explicit-imports-plugin: Add ghc9 support

Now ignores any imports with Unhelpful locations,
since we can't make a map of SrcLoc

* hls-retrie-plugin: Add ghc9 support

* hls-hlint-plugin: Add ghc9 support

* Fix backwards compatability of hlint plugin

* Fix stack builds

(Broken by previous hlint fixes)

* Disable tests when their required plugins are disabled

Not all plugins are supported on ghc9 yet, but we
still want to run the tests for the supported parts

* ghc9: Fix module name plugin

* Add a stack file and run tests for ghc9 in ci

* Add missing packages to ghc-9 stack

* Resolve rebase issues

Maybe it's better to create merge commits instead?

* Allow newer for more packages so cabal stops complaining

These aren't really working, but since they are dependencies
of packages in the `packages:` section
the resolver won't allow us to build anything without this, even if
those plugins are disabled.

* Replace MIN_GHC_API_VERSION with MIN_VERSION_ghc

* Revert incorrect change to hlint code

* Remove remaining traces of GHC_LIB flag

* Add back ghc 9 to github workflow

* Revert "Add back ghc 9 to github workflow"

This reverts commit c465a1e51a.

* hie-compat: Add basic support for ghc-9.0.1

A tiny step towards #297

* hie-compat: Remove dependency on ghc-api-compat

* hie-compat: Add more backwards compatability

* Disable CI for ghc9

* Use newer version of apply-refact

* Don't needlessly duplicate code from ghc

* hie-compat: Reexport the original version of HieBin

* Don't include broken "allow-newer"s

* FIx stack build for ghc9

* Fix warning from imperfect merge commit

* Don't needlessly duplicate code from ghc

* hie-compat: Reexport the original version of HieBin

* Add missing ghc-api-compat

* Fix ghc9 build for ModuleName

* Add more conditionals on flags for tests

* Add a separate cabal.project file for ghc9

As far as I know, this is the only way to disable the packages who's
dependencies doesn't compile in GHC9 yet.

* Fix and re-enable CI for GHC9

* Remove accidental non-breaking space

* Fix CI build for ghc9

Since we are changing the flags for haskell-language-server,
which CI renames to hls,
we need to use the shortened name in those flags as well

* Run tests for ghc9 in CI

* Minor CI changes

* Use proper values when enriching hie

* Don't try to test hls-refine-imports-plugin on ghc9

* Update comment about ghc9 crashing on initDynLinker

* setSessionDynamicFlags to prevent ghc9  from crashing

The only way to set the dynamic linker is with the function `setSessionDynFlags`
so we call it with the result from `getSessionDynFlags` to give it a
(hopefully sensible) argument.

See also this commit:
18757cab04

* Revert "setSessionDynamicFlags to prevent ghc9  from crashing"

This reverts commit 4065ac8394.
That change made the "ghcide.cradle.muli" tests fail.

* Simplify logic in hls-hlint-plugin.cabal

* Add comment on OldRealSrcSpan

* Remove source overrides for non-ghc9 builds in cabal.project

* Remove commented out code

Co-authored-by: Pepe Iborra <pepeiborra@me.com>

* Remove resolved question from comment

"This code is only concerned with extracting argument names, so I don't see how multiplicity would be relevant here"
https://github.com/haskell/haskell-language-server/pull/1649#discussion_r642606967

* ghc9: Update to latest version of LSP per

* cabal-ghc901.project: Remove commented out code

* Update the lsp commit hash for stack as well

* Use a version of lsp without haskell/lsp#326

That patch was causing test failures, but the issues
should be fixed for real at some point, so that patch can be incluede

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
2021-06-06 18:16:29 +01:00
Javier Neira
da72a27e6f
Use last apply-refact and several stack.yaml updates (#1858)
* Update hackage index

* Update stack.yaml's

* Use ghc-8.10.4 for default stack.yaml

* Update brittany

* Bump up min apply-refact version

* Set max-backjumps to 12000
2021-05-24 12:51:56 +02: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
Junyoung/Clare Jang
7d7cfa24c0
Extract pragmas plugin (#1833) 2021-05-14 20:04:50 -04:00
Gustavo Avena
0772f2d42d
Extract fourmolu plugin into a standalone package (#1823) 2021-05-14 13:57:03 +01:00
Junyoung/Clare Jang
15381405d7
Extract floskell plugin as a standalone plugin (#1829)
* Extract floskell plugin as an independent plugin

* Increase max-backjumps for cabal configure
2021-05-14 04:47:41 -04:00
Ray Shih
54737e9e2d
Implement refine imports (#1686)
* Implement refine imports

* Implement code action for refine imports

* fix stack.yaml

* fix stack-*.yaml

* fix missing records fields after merge master

* fix nix

* reduce duplicated functions

* [Plugin][RefineImports] add tests and fix overriding issue

* add hls-refine-imports-plugin to CI workflow

Co-authored-by: Junyoung/Clare Jang <jjc9310@gmail.com>
2021-04-29 22:32:19 -04: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
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