Commit Graph

186 Commits

Author SHA1 Message Date
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
Thomas Winant
2e78baaae5
Suggest adding pragmas for parse errors too (#1165)
* Suggest adding pragmas for parse errors too

Only errors produced by the type checker were checked for mentions of a pragma
that could be enabled. Many parse errors suggest enabling a pragma:

* `@` -> `TypeApplications`
* `forall` -> `RankNTypes`. Although `ScopedTypeVariables` would be a better
  suggestion, IMO.
* ...

Generate suggestions for these too.

* Find pragma suggestions for all diagnostics, not just for GHC

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-09 17:17:42 +00:00
Junyoung Clare Jang
d4e666a8fc
Add class plugin test for _ 2021-01-07 18:20:48 -05:00
Potato Hatsue
57f28ff357
Haddock comments plugin (#673)
* Add haddock comments plugin
:

Update project config files

Add CPP

Add missing include-dirs

Refactor

Support records

Only suggest when no error

Don't suggest if nothing to change

Update code action title and comment template

Remove toCurrentRange

Add haddock comments plugin

Update project config files

Add CPP

Remove temp files

Remove temp files

Remove spaces

* Minor refactor, remove CPP

* Fix stack-8.10.3.yaml

* Add test cases (unverified)

* Rename test data files, use golden test

* Fix paths of hs files in testing

* Add missing ConstFunction

* Fix paths

Fix paths

* Update annDeltaPos

* Steal goldenGitDiff from class plugin

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Co-authored-by: Junyoung Clare Jang <jjc9310@gmail.com>
2021-01-07 06:58:36 -05:00
Peter Wicks Stringfield
5737f5185f
Delete unused utilities for controlling logging. (#764)
* Delete unused utilities for controlling logging.

Delete withFileLogging, logConfig, and noLogConfig.

Logging is turned on by hlsCommand. Should we ever want to disable it for a
certain test, we would create a new version of hlsCommand, say, hlsCommandNoLog.

* Delete unused import.

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Co-authored-by: Junyoung Clare Jang <jjc9310@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-06 09:11:28 +00:00
Hiromi Ishii
8d5cbe1ea2
Splice Plugin: expands TH splices and QuasiQuotes (#759)
* Implements splice location detection

* Corrects detection logic

* Changed to use (bogus) message for code action

* Splice location

* Extract `Ide.TreeTransform` as an independent package

* It once worked, but stops...

* Now it works for inplace expansion for expressions

* generalises tree transformation to general AST element

* Done for Types and Patterns!

* Disabled "commented" style of expansion

* kills redundant imports

* Updates cabal.project

* Nix fix

* Nix fix, fix

* Throws away loading hacks entirely

* Type adjusted for inverse dependency

* Resolves merge conflicts

* WIP: Support hover and goto definition for top-level splices

I can't work out how to properly integrate this information into the
.hie file machinery. Perhaps it would be better to upstream this.

* Modifies splice information to store both spliced expression and expanded ones as well

* Avoid name collision

* formatting erros

* Safer error handling

* Rewrote using updated ghcide  `TypeCheck` results

* Use `liftRnf rwhnf` to force spine of lists

* Stop using `defaultRunMeta` directly to avoid override of preexisting hooks

* Error report

* Add splice information into HIE generation.

* Resolves interace conflict

* Add test

* Changes to use ParsedModule to detect Splice CodeLens

* formatted

* Implements golden test

* mzero for HsDecl

* Decl Splice

* Workaround for Decl expansion and support type-errored macro expansion.

* Only setting up dflags correcly would suffice

* Removes lines accidentally added

* Regression tests for Declaration splice and kind-error ones

* Workaround for GHC 8.8

* Revert "Workaround for GHC 8.8"

This reverts commit 056f76971f.

* Unsupport pattern splices GHC 8.8

* Corrects line position in GoToHover

* Increases wait time

* Includes only related changes only

* Optimises `something'`

* Adds hie.yaml

* circie ci: Modifies stack-8.10.3.yaml

* Forgot to update dflags in auto-expansion with default strategy

* Forgot to add golden file

* A dummy commit to run CI

* Workaround for GHC 8.8 pattern splices

Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-05 15:34:06 +00:00
Peter Wicks Stringfield
840dd3d3cb
Delete unused testdata (#763)
* Delete test/testdata/wrapper/*.

This is all dead code. It was brought over from haskell ide engine, but we don't
use it.

Note:
We are deleting test/testdata/wrapper
We are NOT deleting test/wrapper/testdata

wrapper/testdata contains live testdata, which is being used to test that
haskell-language-server-wrapper can load the appropriate version of
haskell-language-server based on the environment that it is running in.

* Delete HaRe test files.

These are dead code, they are very simple so they aren't likely to be useful
when writing new tests, and they have "HaRe" in the name even though HaRe is
gone, which adds mental burden.

* Delete unused test datafiles.

These all came over from Haskell IDE Engine, and we aren't using them. So lets
clean up by deleting them.

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-05 07:14:37 +00:00
Peter Wicks Stringfield
0b0a6a75e5
Enable more tests (#1143)
* Make rename tests compile.

(They can't pass since we don't have a renamer yet.)

* Enable some more tests.

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-05 04:24:58 +00:00
Peter Wicks Stringfield
4086845f82
Cleanup format testfiles (#765)
* Move testdata for auto-formatting tests into its own sub-folder.

It's a lot of files, packing them up into their own little folder makes the
testdata directory much cleaner.

* Delete unused test datafiles.

These look like one the files used in the formatting tests, but they aren't.
These files do nothing.

* Fix typo. "Haksell" |-> "Haskell".

Haksell is what we do to our users.

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2021-01-02 07:28:43 +00:00
Pasqualino Titto Assini
edb150ac52 moved eval plugin to hls-eval-plugin (rebased and fixed) 2020-12-29 18:38:27 +01:00
Pepe Iborra
9b5c397c98 Launch ghcide/HLS for tests with -j2 to limit amount of memory used
Reminder that ghcide requires at least 2 capabilities
2020-12-29 13:22:04 +00:00
Pepe Iborra
a40682d36a Fix redundant import tests
These tests were underspecified and broke with the recent improvements to ghcide
diagnostics in https://github.com/haskell/ghcide/pull/959 and included in this
merge.

Fixed by waiting specifically for the typecheck diagnostics and by being less
prescriptive in the number and order of code actions
2020-12-29 13:22:04 +00:00
Javier Neira
9ac127e04c
Merge pull request #698 from peterwicksstringfield/enable_progress_tests
Fix and enable progress message tests.
2020-12-27 16:07:35 +01:00
Junyoung Clare Jang
ec3fe275d8
Add tests for class plugin 2020-12-26 02:24:43 -05:00
Peter Wicks Stringfield
ba7ee5dccf Fix path on Windows. 2020-12-25 17:01:21 -06:00
Peter Wicks Stringfield
bd460e7874 Restore delete liquid Haskell related test. 2020-12-25 15:36:34 -06:00
Peter Wicks Stringfield
03239ee51b "Eval" |-> "Evaluating". 2020-12-25 15:25:11 -06:00
Peter Wicks Stringfield
a058943aab Fix and enable progress message tests.
Liquid Haskell is gone, delete the related code. Test the progress messages from
some of our other plugins. Help HLS load the testfiles for the warnings are
warnings test.
2020-12-25 14:05:10 -06:00
Pasqualino Titto Assini
887cde9e11 Eval tests as proper subpackage (to add QuickCheck dependency) 2020-12-25 10:12:17 +01:00
Pasqualino Titto Assini
a48a8f775d Extended Eval Plugin (rebased to 0.7.1) 2020-12-25 10:11:58 +01:00
Sandy Maguire
0f07efcbab
Add a known tactic for writing arbitrary instances (#695)
Christmas comes early for QuickCheck users! This PR adds support for generating arbitrary --- including the tricky business of ensuring termination. It can be run by calling Attempt to fill hole on anything of the form arbitrary :: Gen A for some type A.
2020-12-24 02:12:42 -08:00
Alan Zimmerman
cc23521ac6
Merge pull request #691 from alanz/switch-for-import-lens
Introduce generic config for plugins
2020-12-23 13:47:23 +00:00
Alan Zimmerman
501b8f9cad Fix compiler warning that only shows up in CI
More argument for #693, in my opinion
2020-12-23 11:48:20 +00:00
Alan Zimmerman
37da7ab2ae Remove duplicated test 2020-12-23 11:21:20 +00:00
Alan Zimmerman
2e829f5bc9 Add tests for Plugin global enable via config
And a CONTRIBUTING.md, for help on running tests
2020-12-22 13:13:38 +00:00
Peter Wicks Stringfield
32b5cbc89d Disable test on GHC 8.8.x. 2020-12-20 20:18:16 -06:00
Peter Wicks Stringfield
a475307331 Fix cradle and enable last getTypeDefinition test.
For HLS to find definitions in Lib when queried about symbols in Lib2, HLS needs
access to a proper cradle.
2020-12-20 17:21:30 -06:00
Peter Wicks Stringfield
d0670098c3 Refactor getTypeDefinition tests. 2020-12-20 17:21:20 -06:00
Peter Wicks Stringfield
5fc4966c21 Enable getTypeDefinitions tests. 2020-12-20 17:21:20 -06:00
Peter Wicks Stringfield
cf3f6fa63d Add final newline. 2020-12-20 17:21:20 -06:00
jneira
4fa01295cf Emit error assertion when session timeout 2020-12-16 13:32:47 +01:00
jneira
146c104a75 hlint tests for cpp, extensions and ignore hints
* for issues #554, #590 and #838
2020-12-15 23:33:49 +01:00
jneira
407511ec43 Add test utilities
* expectNoMoreDiagnostics, adapted from ghcide
* add knownBroken and ignore by ghc version
2020-12-15 23:14:21 +01:00
jneira
cd17a0a76b Adapt brittany+floskell golden test 2020-12-14 19:59:04 +01:00
jneira
94f8095bf5 Adapt floskell golden test 2020-12-14 19:59:03 +01:00
jneira
be6db04653 Adapt brittany golden test 2020-12-14 19:59:03 +01:00
jneira
7135541894 Replacing waitForDiagnostics with sleep 2020-12-14 19:59:02 +01:00
Peter Wicks Stringfield
3e6378a5f6 Ensure that the testfiles produce at least one diagnostic. 2020-12-14 19:59:00 +01:00
Peter Wicks Stringfield
56629b1d70 Fix test for code completion of qualified name.
Stop messing around the editing the file and reloading it. We are trying to test
code completion, not editing files, and the extra complexity is making it harder
to maintain the test.
2020-12-14 19:59:00 +01:00
Peter Wicks Stringfield
20cef9e8d5 Disable test for completionSnippetsOn option, ghcide does not support it. 2020-12-14 19:59:00 +01:00
Peter Wicks Stringfield
7fad57c44a Enable disabled tests for the code completion snippets.
Snippets are back in ghcide 0.6.0.
2020-12-14 19:58:59 +01:00
Peter Wicks Stringfield
c807d442fe Update completion tests to reflect the renewed support for snippets in ghcide 6.0. 2020-12-14 19:58:59 +01:00
Peter Wicks Stringfield
1a6bb07967 Ensure that loading testfiles produces at least one diagnostic.
completion/Context.hs used to generate a diagnostic for the unused "x", but no
longer does so without -Wunused-binds.

completion/Completion.hs used to generate a diagnostic for the unused import of
Data.Maybe, but no longer does so without -Wunused-imports.

We could add these flags like:
    {-# OPTIONS_GHC -Wunused-binds #-}

But that would force us to update all the hardcoded line numbers in the unit tests.

Instead we just add a redundant id, carefully positioned to avoid disturbing any
hardcoded positions.
2020-12-14 19:58:59 +01:00