Commit Graph

269 Commits

Author SHA1 Message Date
Nick Suchecki
73652d7515
Log response errors returned from Plugins (#2988)
* Log ResponseErrors when returned from Plugins

* Log  from Plugins

* Create 'logAndReturnError' that will log any failures in plugins

* Missed opportunity to use logAndReturnError

* Revert throwPluginError to throwE

This reverts a change made previously to try to make pluginErrors have a
common error format. This will be updated in the near future.

* Warning -> Error

* Fix Functional Test for Plugin Response Error

* Add orphan instances for

* Revert back to Warning

* Update log format in test suite
2022-07-01 22:52:51 +00:00
Attila Gáspár
c3c73cf30b
Add associated type families to local completions (#2987)
Co-authored-by: Lei Zhu <julytreee@gmail.com>
2022-06-28 13:44:42 +00:00
Michael Peyton Jones
efcb8e2589
Set up partial functions ratchet (#2974)
* HLint partial functions

* Delete commented out stuff

* Delete flag-based warnings, unclear they add much

* Delete DA-specific hints

* Delete extra cpp args

* Delete extension options relating to dead build system

* Don't bother trying to restrict CPP for now, it's everywhere

* Make the hlint job fail if there are any errors

* Fix for rebase, add unsafePerformIO and fold1 variants

* Add some more indexing functions

* Try turning off hlint on this test file

* Add .hlint.yaml file for hls-hlint-plugin

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-06-24 10:46:35 +00:00
Lei Zhu
df6cc3cccd
Expand input to pragma if available (#2871) 2022-04-30 15:36:23 +01:00
Lei Zhu
3c527431bc
Should no related code lens if the module name is correct (#2826)
* Should no code lens if the module name is correct

* Rerun tests

* Rerun tests

* Try remove hls-eval-plugin known-broken in ghc-9.2

* Rerun tests

* Apply more accurate test name

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

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2022-04-13 11:16:28 +00:00
Lei Zhu
caab83365f
Don't show the redundant space (#2788)
* Don't show the redundant space

* Fix tests
2022-03-18 13:50:59 -04:00
Michael Peyton Jones
82a3cd5640
Refactor LSP logger and log via window/logMessage also (#2758)
* Refactor LSP logger and log via `window/logMessage`

* Skip logging notifications in tests

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2022-03-08 17:56:32 +00:00
Guillaume Bouchard
07623e0bf3
Restore eval plugin build for GHC 9.2 (#2669)
* tests: Test for eval plugin now show correct line in output

Using `HasCallStack`, `testCase` can no pinpoint the call location
instead of pointing inside the utility function.

* Restore eval plugin build for GHC 9.2

It restores the eval plugin. Now annotations with comments are found by
walking the AST and locating specific annotations.

In order to fix unit test, I implemented a new golden test function
which accepts a different naming scheme depending on the GHC version.

* fix: remove unused log mecanism

* Refactor: move pragma to compat module

* refactor: Remove now useless dependency

* fix: remove an unused import

* Disable a test for eval plugin for GHC 9.2

Eval plugin does not report progress, I don't understand why.

* fix: type +v actually also works with GHC 9.0

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2022-02-12 13:37:48 +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
255803531a
Make work stack-9.2.1.yaml and enable pedantic (-WError) for cabal (#2606)
* 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
2022-01-20 12:38:21 +00:00
Sandy Maguire
d640d13984
GHC-9.0 support for hls-tactics-plugin (#2581)
* Initial partially broken ghc9 support for tactics

It compiles and most tests succeed, but some fail.
In particular, the ones where it should suggest `show` fails to find
that as a possible solution and fails to find evidence for `Show a`.

* Enable tactics plugin for nix as well

* Wingman does support ghc9 now

* Fix stack support for tactics ghc-9.0.1

* Enable tests for tactics on ghc-9 on ci

* Actually enable tactics for ghc-9 on nix

* Wingman: Improve test failure messages

Previously when wingman fails to find a solution, the test failure
would say "Timed out when waiting for a message".
Now it instead prints the error message from wingman.

* Get theta

* Make wrapper theta discovery more reliable

* Fix AutoThetaRankN

* Fix FmapJoin and FmapJoinInLet

* Fix MetaBegin

* Cleanup

* Fix merge

More fixing the merge

No, seriously fix the merge

Fix a broken merge

* Need a comma

* Try a better ConPatIn

* Oops

* its a nightmare

* i hate ci

* ok that fixes the conpat

* Maybe this is the end of it

* ci

* refinery

* undo some changes

* no more tctypes?

* maybe it builds now

* omg

* om F g

* expect fail on 9.2

* fix

* fix again

Co-authored-by: Andreas Källberg <anka.213@gmail.com>
Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2022-01-19 12:11:20 +00:00
J. S
acff2bdccc
Fix progress eval test randomly failing (#2590) 2022-01-15 23:15:48 +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
Javier Neira
2625689ad4
Add support for brittany (needs aeson-2) and floskell with ghc-9.0.1 (#2551)
* Enable tests for brittany and 9.0.2

* Enable tests for floskell plugin

* cabal-ghc901.project: naively enable brittany

* haskell-language-server.cabal: bump brittany flag <(9.0.1->9.2.1)

* Trying to add support for brittany

* Use last hackage floskell version

* Activate floskell in func-test suite

* Restrict brittany in hackage for ghc<9.0.1

* Adapt to Aeson.Key

* Update lsp source repo package

* Refer pr for butcher

* Add missing prefix

* Adapt to aeson-2 (incomplete)

* Use compat module

* Support for aeson-2 and extra-1.7.10

* Remove lsp

* Allow newer aeson for stylish-haskell

* Add needed import for non windows

* Remove insertJson and toJsonKey

* Update cabal-ghc901.project

* Missing import

* Avoid CPP by using lens-aeson

* Update hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs

* Use ghcide compat module

* Use type alias in cpp

* Fix stack build for ghc-8.6.5

* Use lens-aeson key

* Use lens-aeson in func-test

* Fixup shake-bench

* Update docs

* Switch to lens ix

* Try this

Co-authored-by: Anton-Latukha <anton.latukha@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-01-12 16:24:53 +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
Michael Peyton Jones
47f29daac7
Delete some dead or deprecated settings (#2481)
* Delete diagnosticsOnChange

* Delete liquidOn

* Remove deprecated reference to completionSnippetsOn

* Delete hlintOn

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-12-14 14:57:58 +01:00
Javier Neira
1b69975000
Remove support for ghc 8.8.3/8.10.5 (#2444)
* Remove support for ghc 8.8.3/8.10.5

* Remove ghc-8.10.5 from circleci

* Correct releases links

* Rename stack test dir

* Parametrize stack wrapper test
2021-12-10 14:58:30 +00:00
Pepe Iborra
84ece63ef4
Lockless diagnostics (#2434)
* lock-less publishedDiagnostics

* lock-less diagnostics

* move deleteValue and recordDirtyKeys to STM

* Move getDiagnostics to STM

* fix plugins

* Do not send stderr output to a file in func-tests

Stderr output is very useful to diagnose test failures when interleaved with the LSP log. Sending it to a file disrupts this interleaving and makes it harder to retrieve from CI
2021-12-05 22:04:56 +00:00
Hiromi Ishii
6c9d44fd16
Makes local record field completion respects the fields sharing one single type signature (#2439)
* Correct the logic of retrieving field info from ParsedModule.

* No concatMap required

* Adds test case
2021-12-04 15:03:20 +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
Pepe Iborra
26668f7415
Include sortText in completions and improve suggestions (#2332)
* sort completions

* add an example

* Include fuzzy scores in completions sort text

* hlints

* Extend completion documentation to inform whether an identifier is alreaady imported

* Ditch alphabetical ordering - it's incompatible with qualified completions

* Fix bugs in completion help text

This fixes the ugly "Imported from 'Just B'" and other inconsistencies

* added tests for qualified completions

* Fix redundant import

* Inline Fuzzy.match to apply [1] and to be case-sensitive on first match

[1] - https://github.com/joom/fuzzy/pull/4

* fixup! Fix bugs in completion help text

* Sort qualified completions first

* Filter out global suggestions that overlap with local

For example, don't suggest GHC.Exts.fromList when Data.Map.fromList is in scope alraedy

* Sort completions alphabetically

* Show provenance in detail text

* Sort local/in-scope completions first

* Fix build with GHC 9

* Ignore func symbol tests

Co-authored-by: Alex Naspo <alex.naspo@protonmail.com>
Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-11-10 10:42:27 +00:00
Javier Neira
44fa1d7e73
Cancel prev runs for bench and nix (#2335)
* Cancel prev runs for bench and nix

* Dont use skip-duplicate-actions for cancel others

* Ignore format func-tests
2021-11-09 16:59:43 +01:00
Javier Neira
6e297c5f15
Add support for install hls from hackage using ghc 9.0.1 (#2322)
* First temporal changes

* Clean up tests plugin inclusion

Deprecate them as they will be removed when all tests are
moved to their own plugin packages

* Use force-plugins in project files

* Add ghc-9.0.1 to hackage release workflow

Diabling actual upload if the branch contains 'check'

* Improve force-plugins explanation

* Correct deprecated pragma location

* Dont use deprecated pragma

* Correct yaml config error

* Change flag name

* Use new flag name in project files
2021-11-03 08:09:46 +00:00
Javier Neira
7565798675
[skip circleci] Enable func-test suite for windows (#2296)
* Ignore tests stucking ci

* Enable func-test for win and 9.0.1
2021-11-02 19:06:41 +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
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
Michael Peyton Jones
d9d27e520a
Filter code actions based on prefix, not equality (#2146)
It's quite unclear in the spec, but in
microsoft/language-server-protocol#970
it's suggested that the intention is that the kinds given in `only`
should be used as *prefix* filters of the generated code action kinds.

That is to say, if the client asks for `only = [ CodeActionRefactor ]`,
we should give them all kinds of refactoring code actions, including
those whose kind is `CodeActionRefactorInline` (because as "hierarchical
strings" they are represented as `"refactor"` and `"refactor.inline"`).

This is quite important for the client: e.g. I hit this because I wanted
to ask for all the import quickfixes so I could present them to the user
to pick one. But they use various subkinds of `"quickfix.import"`, so
currently you cannot ask for them all (asking for `"quickfix.import"`
currentl returns nothing!).

The ipmlemention is a little ugly: this needs some helper funcitons in
`lsp`, which I'll make a PR for separately, but I didn't want to block
this.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-09-10 12:20:21 +00:00
Alex Naspo
1daecd4637
Auto complete definitions within imports (#2152)
* auto complete functions from imports

* address PR comments

* clean up

* remove duplicate HashMap import

* use lookupDefault

* fuzzy match filter

* add field to exportsMap

* generate map from modIFace

* Update ghcide/src/Development/IDE/Types/Exports.hs

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

* module name text alias

* use hashset; enable local modules

* local module imports now working

* derive map from exportMap

* generate maps from list

* clean up

* addressing PR comments

* clean up

* clean up

* useWithStaleFast

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Co-authored-by: alexnaspoleap <88672779+alexnaspoleap@users.noreply.github.com>
Co-authored-by: Alex Naspo <alex.naspo@leapyear.io>
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-09-09 15:27:05 +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
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
4d730b3e00
Disable hls tests for win and ghc-9.0.1 (#2018)
* Disable hls tests for win and ghc-9.0.1

* Unignore hlint tests for win and ghc-9.0.1
2021-07-14 13:15:06 +02: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
Felix Yan
ce15ff6eb1
Remove >= from cabal-version (#1998)
Fixes warnings like:

```
Warning: test/testdata/testdata.cabal:3:27: Packages with
'cabal-version:
1.12' or later should specify a specific version of the Cabal spec of
  the form
  'cabal-version: x.y'. Use 'cabal-version: 2.0'.
```

Co-authored-by: Potato Hatsue <1793913507@qq.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-07-05 10:41:46 +00: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
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
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
Junyoung/Clare Jang
e0a464282d
Apply formats again (#1824)
* Apply formattings

* Update nix exclude range
2021-05-13 05:00:48 +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
Aufar Gilbran
4e10c8de73
Limit CodeActions within passed range (#1442)
Return only actions within range specified by client.
2021-04-26 05:30:29 +00:00
Oliver Madine
6949b15fb6
Insert pragmas after shebang or to existing pragma list (#1731)
* added option to always insert pragmas at top of file

* Revert "added option to always insert pragmas at top of file"

This reverts commit 8cebdd5743.

* Pragmas inserted before comments (#1726)

* Code style

* Code style

* Insert pragamas to existing pragma list

* added cpp macro to pragma test for ghc < 810

* Refactor: using file contents to find pragma insertion position

* Update getParsedModule action description

* Code style

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Co-authored-by: Potato Hatsue <1793913507@qq.com>
2021-04-22 15:03:31 +00:00
Ryan Mehri
369fdfe7ad
HLint: Pass options through user config (#1724)
* Get flags for hlint through user config

* Add test case for hlint flags

* Add documentation for hlint configuration

* Fix build after merging master

* Remove unnecessary functions from hlint plugin

* Add test case that adds hints based on flags

* Fix build after merging master

* Add configHasDiagnostics back in

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-04-21 19:58:29 +00:00
Oliver Madine
f933011def
Bracketing for snippet completions (#1709)
* Enhancement: #1700

* changed bracketed typed hole completions to regular bracketed completions

* removed redudant comment

* removed whitespace

* Updated test cases to expect bracketed completions, Type constructors with no arguments no longer bracketed

* Updated hls tests for bracketed completions

* added missing ghcide/example/HLS file

* moved ghcide/examoke.HLS to ghcide/bench/example/HLS

* Restored ghcide/bench/example/HLS

* restored ghcide/bench/example/HLS

* removed unnecessary 'T.pack' (OverloadedStrings)

Co-authored-by: Oliver Madine <olliemadine@gmail.com>
Co-authored-by: Junyoung/Clare Jang <jjc9310@gmail.com>
Co-authored-by: Potato Hatsue <1793913507@qq.com>
2021-04-13 04:07:25 +00:00
Pepe Iborra
14b46e100c
Civilized indexing progress reporting (#1633)
* Civilized indexing progress reporting

* optProgressStyle

* Consistency: Indexing references ==> Indexing

* Fix progress tests
2021-04-02 13:28:18 +00:00
Pepe Iborra
3e3d782cb8
Avoid reordering plugins (#1629)
* Avoid reordering plugins

Order of execution matters for notification plugins, so lets avoid unnecessary
reorderings

* remove duplicate plugins

* fix tests
2021-04-02 07:32:30 +00: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
75e365a1e0
Use custom config for completions plugin (#1619) 2021-03-27 16:49:01 +08:00