Commit Graph

328 Commits

Author SHA1 Message Date
Andy
86e3fd6c65
Cleanup GHC macros (because min version is 8.8.4) (#3281)
* Drop min_version_ghc (8.8.4 is min supported)

* Drop conditional glasgow_haskell cpp

* Inline some imports (review feedback)

* Drop hie-compat 8.6 (review feedback)

* Dropping more ghc 8.6 related code and docs

* Eval: Include tests that were broken for 8.6
2022-10-11 22:35:18 +00:00
Colten Webb
cdbef3e5cb
Feat: basic record dot completions (#3080)
* baseline for record completions

* address feedback

* gate ghc version

* add test

* refactor

* fix rope import

* fix plugins from rebase

* gate test by ghc version

* comments, fixes

* fix ghc90 test
2022-09-26 16:30:29 +01:00
Pepe Iborra
dca5cc36c7
Log plugin name and attribute errors to plugins (#3194)
* Log plugin name

* redundant import

* Attribute response error logs to plugins

* remove redundant plugin names from error messages

* improve pretty printing

* Avoid show

* simplify test messages

* Fix
2022-09-21 17:36:19 +00:00
Andy
b378de2d42
Solve formatting issues (stylish-haskell, pre-commit CI) (#3171)
* Solve formatting issues

* stylish-haskell parse errors solved (partially)

* Env: Changing order (import)
* Plugins: Dangling `$`

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2022-09-18 08:41:14 +00:00
Zubin Duggal
816cd6301e Prepare 1.8.0.0
Use hiedb from hackage

gitlab-ci: remove workaround for windows 9.2.2
gitlab-ci: remove workaround for windows 9.2.2

hie-bios

update hie bios

update hie bios

bounds

hie-bios fixes

hie-bios fixes

lsp 1.6

cabal.project fixes

hie-bios fixes

lsp and hie-bios from hackage

Mark hie-bios error as expectFail

hie-bios fixes

hie-bios fixes

Stack

Stack

stack fixes
2022-09-14 02:27:17 +05:30
Zubin Duggal
661b336883 Disable plugin tests for 9.4 2022-09-01 14:47:55 +05:30
Zubin Duggal
87133b0394 Fix func test 2022-09-01 14:47:55 +05:30
Pepe Iborra
d0e3e0fe3f
HLS benchmarks (#3117)
* extract ghcide:experiments-types

* extract haskell-language-server:plugins and let go of examples

The main goal here is to move the Plugins module into an internal
library so that it can be reused from the benchmark suite.

In order to
make that easier, and since they hardly serve a purpose in a repository
with 25 plugins, I delete the Example and Example2 plugin descriptors
and their dependencies.

* HLS benchmark suite

Port the ghcide benchmark suite to HLS and benchmark plugin
"configurations" independently.

This includes the following changes to the ghcide benchmark suite and
HLS:
- Support for "configurations" which are defined as sets of plugin ids.
  The benchmark will be run with only these plugins enabled and all
  others disabled
- Support for configurable concurrency. This relies on RTS -ol and -po
  flags to place the RTS traces in the target location rather than in
  the cwd

This change requires two commits, the next one places
ghcide/bench/hist/Main.hs into its final location to help 'git'
recognize the change as a file move

* ghcide/bench/hist/Main.hs -> bench/Main.hs

* CI - fix artifact names for uniqueness

* disable shorten HLS step

* Do not store eventlogs to avoid out of disk space

* render durations up to milliseconds

* shorten titles

Goal is to display the formatted CSV (via column) one row per line

* exclude formatting plugin configurations

* Extract ghcide-bench to a standalone package

* ghcide-bench: fix stderr capturing

* Fix mem stats

We parse maxResidency and allocatedBytes from the RTS -S output, but runSessionWithHandles kills the server without waiting for it to exit and these stats don't get logged.

The solution is to use runSessionWithHandles', but unfortunately it is internal and not exposed. I have raised a PR to expose it and in the meantime we need a source repo package.

* feedbacks

* delete Example plugins
2022-08-25 15:08:57 +01:00
Pepe Iborra
753042c0f4 fix another test that relies on plugin ordering 2022-08-19 15:49:39 +05:30
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
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
Potato Hatsue
5724343ee2
Extract stylish-haskell plugin into a standalone package (#1604) 2021-03-22 21:49:27 +08:00
Potato Hatsue
0e9dca41de
Add custom code action kinds for import related code actions (#1570)
* Add custom code action kinds for import related code actions

* Rename: identifier -> thing

* Rename: thing -> list

* Remove an assertion of code action kinds in func-test

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: Sandy Maguire <sandy@sandymaguire.me>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-15 02:37:13 +00:00
Pepe Iborra
6fbc602274
Extract an hls-brittany-plugin package (#1422)
* Extract a Brittany plugin

* Add the brittany plugin to all the stack descriptors

* Extract tests into a standalone testsuite

* Drop AGPL flag

* Change the default logger to print to stderr

* add hls-brittany-plugin test suite to CI

* Add strict version bounds

These are completely unnecessary, but it's the approach that we seem to be taking

* includes breaking API change: bump ghcide version number

Co-authored-by: Junyoung/Clare Jang <jjc9310@gmail.com>
2021-03-08 05:07:38 +00:00
Junyoung/Clare Jang
679f1d0f62
Reformat all files (#1439)
* Update nix-shell excludes regexs

* Format all files
2021-02-24 21:34:35 -05:00
ishmum123
152e57ffdb
[test] test added for pragma addition after shebang (#1340)
Co-authored-by: Ishmum Jawad Khan <ishmumkhan@gmail.com>
Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-02-24 16:14:49 +00:00
Sandy Maguire
cf9cbeb144
Move tactics tests to be standalone (#1425)
* Move tactic tests to be standalone

* Cleanup AutoTupleSpec

* Move from tasty to hspec

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-23 23:40:21 +00:00
Sandy Maguire
7817a10eb1
Successfully split non-varpats (#1427) 2021-02-23 06:15:40 +00:00
Potato Hatsue
1c4562978c
Refactor pragmas plugin (#1417)
* Refactor pragmas plugin

* Revert some format changes

* Run pre-commit hook

* Fix and format class test

* Fix and format func-test (code action)

* Update test

* Don't look contents in endOfModuleHeader
2021-02-22 21:42:12 +01:00
Pepe Iborra
3614ecc2a8
Add a test for #1376 (#1414)
* Add a test for #1376

* add missing files

* fix identifiers
2021-02-20 16:16:56 +00:00
Sandy Maguire
ff9a18208c
Implement Tactic Featuresets (#1398)
* Implement featuresets

* Make Tactics tests run with a full feature set

* Respond to feedback from @wz1000

* Cleanup imports in Types

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-19 19:02:57 +00:00
Peter Wicks Stringfield
2bc6310829
Hlint hints. (#1227)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-19 06:33:21 +00:00
Sandy Maguire
430ba2dfd7
Agda-style case splitting for tactics (#1379)
* Agda splitting machinery

* Expand decls!

* Only very top-level lambda to args

* Preserve top-level args (but it doesnt work very well)

* Preserve existing patterns and matches when agdasplitting

* Add traceFX debug function

* Force a few iterations of splitAgda

* Cleanup imports

* Put wildcard patterns in for unused variables

* Update tests

* Agda-unfold on instance deps

* wildify at the very end of simplifying

* Haddock for top-level functions

* Move case splitting stuff into its own module

* Exactprint comments

* Haddock for casesplit

* Use PatCompat

* Remove HsDumpAst

* Use Pat, not LPat

* More massaging Pats

* Only unXPat on 8.0.8

* Haddock and cleanup -Wall

* Cleanup sus errors

* Fix parse errors in GHC > 8.8

* Update comment around unXPat

* Cleanup ExactPrint to split FunBind matches

* Minor haddock tweak

* Bad suggest, hlint

* I hate hlint with so much passion

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2021-02-17 08:49:54 +00:00
wz1000
ad0a1547e5
Upgrade to lsp-1.0 (#1284)
* WIP integrate haskell-lsp-1.0.0.0

some progress

Mostly everything except LanguageServer.hs

make it compile

make it work

fix benchmarks

update

tweaks

fix configuration and tests

simplify handlers

Update to renamed lsp/lsp-types modules

redo plugin api and get library to compile

fill in some missing details

fix main

fix rebase

* handle executeCommand and codeaction compat

* switch back to text

* make ghcide tests compile

* non-formatting plugins

* simplify plugin api

* port default plugins

* fix hls tests

* review comments

* more fixes

* more fixes

* Fix more tests

* cleanup

* fix cabal.project

* restore telemetry

* don't wait for progress response

* warnings and hlint

* rebase fixes

* rebase fixes

* more warnings

* hlint

* warnings

* more warnings

* fix benchmarks

* lsp from hackage

* more stack

* more stack

* more stack

* more stack

* more stack

* more stack

* more stack
2021-02-14 19:04:07 +00:00
Sandy Maguire
9a2f3725a6
Don't insert parentheses for top-level tactics holes (#1352)
* More tests of overlapping methods

* Do a simplification pass of the extract

* Do less work when simplifiying

* Remove unnecessary parens simplification

* Implement simplify as a fold over endos

* Fix tests

* Haddock for the new module

* Minor note on implementation

* Note a TODO

* Use PatCompat to unpack patterns

* Pull out codegen utilities to break a cyclic dependency

* Re-export utils

* No top-level parens for tactics

* Try a different strategy for generalizing PatCompat

* Could this be the answer we've all been waiting for?

* Try, try again to compat

* Reorganize imports

* Fix test

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-02-14 00:23:59 +00:00
Sandy Maguire
32e1fad536
Construct record datacons (#1356)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-13 05:57:48 +00:00
Sandy Maguire
dcd8299c01
Simplify extracts after running tactics (#1351)
* More tests of overlapping methods

* Do a simplification pass of the extract

* Do less work when simplifiying

* Remove unnecessary parens simplification

* Implement simplify as a fold over endos

* Fix tests

* Haddock for the new module

* Minor note on implementation

* Note a TODO

* Use PatCompat to unpack patterns

* Pull out codegen utilities to break a cyclic dependency

* Re-export utils

* Try a different strategy for generalizing PatCompat

* Try, try again to compat

* Could this be the answer we've all been waiting for?
2021-02-12 21:58:28 +00:00
Sandy Maguire
11d0d5124d
Refactor the hypothesis type in hls-tactics-plugin (#1347)
* Add name to HyInfo

* Use a newtype for Hypotheses

* Use a set for tracking names in scope

* Remove the internal Map OccName representation of Hypothesis

* Remove most spurious uses of hyByName

* Stop looking up things by name in hyByName; use hi directly

* Cleanup imports

* Add test for invoking methods at different types

* Improve generated names for tyvar applications

* Minor formatting and haddocks

* Minor styling

* Fix test
2021-02-11 06:21:45 +00:00
jneira
2526b892d1 Replace 8.10.1 with 8.10.4 in wrapper test 2021-02-09 22:10:02 +01:00
jneira
772596ec01 Add 8.10.4 and remove 8.10.1 from .cabal files 2021-02-09 22:10:00 +01:00
Potato Hatsue
691d821c8a
Fix duplication of code actions for adding NamedFieldPuns (#1334)
* Fix duplication of code actions for adding NamedFieldPuns

* Avoid pattern matching in do notation

* Add range
2021-02-09 19:03:19 +00:00
Aufar Gilbran
0fd73f8494
Use default config on missing configuration section (#459)
On serving initialize request, deserializing HIE configuration embedded
in InitializeParam passed by client will result in an error if during
process the server cannot find HIE specific configuration key under
initializationOptions.

This commit changes the initializationOptions deserialization to return
the default configuration if configuration key cannot be found under
initializationOptions. Here, setting the key with a value of null will
also be considered as part of not found condition to accommodate clients
that fills missing user options as null.
2021-02-04 17:58:02 +00:00
Pepe Iborra
9c40dcff1b
Reenable auto extend imports and drop snippets for infix completions (#1266)
* extendImport - catch duplicates

* Use a command to extend imports

* Reenable auto extend imports

* Refactor: rid off ProduceCompletions

* Remove snippets for infix forms

* Fix indexing error in isUsedAsInfix

* Strip qualifiers properly

* Ignore hiding and qualified import decls

* Compat with 8.6

* Follow changes in rewriteToEdit

* Handle qualified imports

* Fix merge issue
2021-01-31 22:08:22 +00:00
Hiromi Ishii
6b6c405d14
Doctest comment parsing using module annotations in Eval Plugin (#1232)
* WIP: Comment parsing using module annotations

* Line Comment parsers (wip)

* Line comment implemented (block comment not implemented)

* Completely switches to Megaparsec

* T27 must be fixed

* We can always assume that comment starts with "--" with no space prepended

* must be horizontal space, not ANY whitespace

* Block parser (WIP)

* We don't need whole range; position suffices

* Brutal parsing for block haddock comments

* Brutal line parsing

* unset Opt_Haddock

* Wrong debug messages

* Redundant debug output

* Hacks for indentation levels and LHS

* Updates block comment logic in Literate Haskell

* Updates doctests

* Allows doctest without newline at the end

* Precise handling of line ending

* Corrects last-line block eval handling

* Makes normal line parsing LHS sensitive

* Removes outdated note on block comments in a single line

* Wait a moment before executing each code lenses

* Sorting tests in order

* Sorts lenses in order

* Reverted to use executCmd

* Changes sorting logic

* Fixes test case: trailing space

* Dummy commit to re-invoke CI

* expect fail CPP Eval on Windows

* Corrects typo

* Test for #1258

* Corrects test header

* Ad-hoc treatment for ending brace in nested comment block

* `goldenTest` function from Eval plugin doesn't support multiple tests in the same block but in separate group

* Dummy commit to rerun CI

* Stop using CPP and use `knownBrokenForGhcVersions` and `knownBrokenOnWindows`

* Nested `expectedFailure` didn't work as expected

* Abolishes `Parser` type synonym

* Removes unneccesary comment evals

* Skip failed curentRange resolution

Co-authored-by: Junyoung/Clare Jang <jjc9310@gmail.com>
2021-01-31 07:51:53 +00:00
wz1000
755fc378f5
References via hiedb (#704)
* Integrate hiedb

1. Add 'indexHieFile' and rule 'GetModIfaceFromDiskAndIndex' to maintain
   database integrity
   - 'writeHieFile' -> 'writeAndIndexHieFile'
2. References fromm database
3. Use db for go to definition
   - Return multiple definitions for things defined in boot files
   - More robust definitions for multi-component
4. Add persistent stale rules to answer queries immedidately on startup
   - Setup `unsafeGlobalDynFlags` on startup
5. Add hiedb command line to ghcide and hls

Co-authored-by: Pepe Iborra <pepeiborra@me.com>
Co-authored-by: Peter Wicks Stringfield <peterwicksstringfield@gmail.com>

* Update ghcide/bench/lib/Experiments.hs

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

* Clear deleted files from hiedb

* make garbage collection async

* bump hiedb

Co-authored-by: Pepe Iborra <pepeiborra@me.com>
Co-authored-by: Peter Wicks Stringfield <peterwicksstringfield@gmail.com>
2021-01-30 11:27:32 +00:00
Pepe Iborra
e06469f2b4
Enforce max completions over all plugins (#1256)
* Enforce max completions across HLS plugins

* Fix pragma completions to prefilter

* Fix a completion test

* Add a test

* Fix another inaccurate test

* rename n to limit

* Evaluate completion providers in parallel

* Evaluate all HLS providers concurrently
2021-01-24 23:08:32 +00:00
Javier Neira
be754d9190
Test apply-refact with TypeApplications (#1244)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-22 14:10:02 +00:00
George Thomas
f03a7fa55d
Add code actions for disabling a warning in the current file (#1235)
* Slacken some flaky tests

The properties tested were previously unnecessarily strong and would break witht the addition of irrelevant code actions. We now don't care about position and total quantity of code actions, only that the ones we care about exist.

* Add code action for disabling a warning

* Fix test

* Remove redundant import

* Fix imports

* Fix more tests

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-21 23:11:13 +00:00
Thomas Winant
50854ca922
Complete the No- variants of language extensions (#1238)
Fixes #1187.

Separate the list of pragmas used for completion from the list of pragmas used
to suggest enabling a language extension to fix an error. The former now include
the `No-` variants of the language extensions, e.g., `NoDuplicateRecordFields`.
2021-01-20 17:34:49 +00:00
Potato Hatsue
2ad9eb068c
Fix the bug that generating comments would duplicate existing comments (#1233)
* Fix duplicating existed comments

* Factorize and do the same to genForRecord

* Remove unused pragmas

* Remove unused identifiers

* Fix code action positions in tests

* Use new rule: GetAnnotatedParsedSource

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-20 12:09:02 +00:00
Peter Wicks Stringfield
11b5c2ecbd Eliminate unused LANGUAGE pragmas. 2021-01-18 09:48:39 -06:00
Peter Wicks Stringfield
0067b7d64b Eliminate redundant brackets. 2021-01-18 08:54:02 -06:00
Pepe Iborra
b1d912af41
Limit completions to top 40 (#1218)
* Limit completions to top 20

We are overwhelming the LSP client by sending 100s of completions after the
first character. Instead, let's send 20 at a time and refresh for more when the
user types another word

* Simplify (thanks Neil!)

* Magic constant explained and increased to 40

* Add test

* Turn maxCompletions into config

* Fix some inaccuracies in tests

* document haskell.maxCompletions

* Fix another test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-18 07:56:13 +00:00
Javier Neira
8434386801
Merge branch 'master' into apply-refact-exts 2021-01-14 13:06:28 +01:00
jneira
decf082cc2 Test comment inside refactoring 2021-01-13 20:54:47 +01:00
Yuya Kono
5685afbdca
Use completionSnippetsOn flag (#1195)
* Use completionSnippetsOn flag

* Enable testCase "respects lsp configuration"

* Update README: haskell.completionSnippetsOn is worked now

Co-authored-by: Junyoung/Clare Jang <jjc9310@gmail.com>
2021-01-11 18:04:37 +00:00
jneira
8a7f68cfad Restore utility function 2021-01-11 14:24:19 +01:00
jneira
1dace14575 Test apply-refact preserve comments 2021-01-11 14:24:16 +01:00
jneira
6db91f38e5 Remove knownBroken for ghc < 8.10 2021-01-11 14:24:13 +01:00
jneira
899230d943 Restore hlint test changing doc content 2021-01-11 14:24:12 +01:00