Commit Graph

328 Commits

Author SHA1 Message Date
Peter Wicks Stringfield
5b774f6498 Move some utility functions to utility module. 2020-12-07 17:49:50 -06:00
Peter Wicks Stringfield
af2a7ebc26 Fix document symbols unit tests. 2020-12-07 17:48:57 -06:00
Peter Wicks Stringfield
b8a49f11b2 Delete duplicate cabal file entry for applyrefact2. 2020-12-07 17:41:42 -06:00
Peter Wicks Stringfield
a0fc157f43 Remove unnecessary parenthesis. 2020-12-06 16:00:21 -06:00
Javier Neira
f8fdf2a9c1
Merge pull request #643 from peterwicksstringfield/enable_code_action_tests
Fix and enable disabled code action unit tests, fix fallback handler
2020-12-03 17:21:49 +01:00
Peter Wicks Stringfield
4c9de9ee91 In tests, filter out diagnostics from other files.
In a unit test, when we tell the server to open "SomeFile.hs" it might also open
"SomeOtherFile.hs" because they both use the same cradle. Then we get
diagnostics for both.
2020-12-02 16:41:42 -06:00
Peter Wicks Stringfield
e9638a5c63 Add hie.yaml files in testdata to help CI run.
This is a cludge. We should be auto-generating these files. See #517. But for
now we can get the tests running, then fix that part later.
2020-12-02 11:23:51 -06:00
Javier Neira
3bd2338e38
Merge pull request #616 from konn/modulename-main-like
Module Name Plugin: Treat modules starting with lowercase as Main module
2020-12-02 07:38:38 +01:00
Peter Wicks Stringfield
8efc4e8675 Comment in and disable test for prefixing unused names with "_".
Currently we have no support for this code action. But if the test is going to
live in this file it might as well be typechecked.
2020-12-01 16:04:12 -06:00
Peter Wicks Stringfield
3db418e17f Increase robustness of tests by skipping extraneous messages. 2020-12-01 15:47:09 -06:00
Peter Wicks Stringfield
bb1e22b55a Enable and fix disabled unit tests for code actions.
Many of the diagnostics have source "typecheck" or "hlint", not "bios". Don't
wait for "bios" diagnostics or we will be waiting forever and timeout. Instead
we should wait for diagnostics with source "typecheck" or "hlint".

With code action literal support, we should not expect to receive applyEdit
requests after we send off a code action to be performed. If we use
getDocumentEdit we will be waiting forever for such a request, and timeout.
Instead, we should use documentContents to get the changed document.
2020-12-01 15:07:01 -06:00
Peter Wicks Stringfield
030bf4880e Fixup documentation of hlsCommand.
It used to be hieCommand, the documentation wasn't updated with the code.
2020-12-01 14:32:22 -06:00
Joe Hermaszewski
d0fb85eb2c
Preserve the last empty comment line after eval plugin (#631)
```haskell
-- >>> foo
--
-- >>> bar
```

After running the plugin on both prompts we end up with this:

```haskell
-- >>> foo
-- foo_output
--
-- >>> bar
-- bar_output
```

instead of

```haskell
-- >>> foo
-- foo_output
-- >>> bar
-- bar_output
```
2020-11-27 20:33:50 +00:00
Hiromi ISHII
0d707a9be4
module name plugin: Workaround for modules starting with lowercase 2020-11-23 15:47:49 +09:00
Hiromi ISHII
8050b14406
Merge branch 'master' into tactic-exclude-coercions 2020-11-23 12:24:35 +09:00
Javier Neira
5673556231
Merge pull request #166 from jneira/hlint-plugin-ghc-lib
Hlint plugin using ghc-lib
2020-10-29 13:07:57 +01:00
jneira
94b7a3ea6f Rerun test suite to avoid flaky tests 2020-10-28 22:26:43 +01:00
Sandy Maguire
b3f7ec8642
Discover skolems in the hypothesis, not just goal (#542)
The tactics plugin was only discovering skolem types present in the hole, rather than anywhere in the hypothesis. #541 gives the following repro:

```haskell
foo :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)
foo f g a = _
```

here, the hole has type `_ :: m c`, which means tactics doesn't realize `a` and `b` are skolems, and instead treats them as unifiable variables. Thus the insane solution of `f a`.

Fixes #541
2020-10-28 11:21:08 -07:00
jneira
01f8fd8b22 Provide evidence edits changes hlint diags 2020-10-28 07:37:22 +01:00
jneira
b549506a46 Remove ghc specific diag title 2020-10-28 07:36:51 +01:00
jneira
5d4d2e2b63 Set hlint code by ghc version 2020-10-28 07:36:49 +01:00
jneira
0e72151bf9 Add GHC810 explicit version 2020-10-28 07:36:48 +01:00
jneira
c35cdda57c Update tests to match new diags and ca's 2020-10-28 07:36:47 +01:00
jneira
f8dc9e01f0 Wait for hlint diagnostics explicitly 2020-10-28 07:36:34 +01:00
jneira
3adb99528d Test only if the command has been applied 2020-10-28 07:36:33 +01:00
jneira
cd0b6157b3 Make test resilient to default diags 2020-10-28 07:36:32 +01:00
jneira
7759c08cb4 Make test not sensitive to commands order 2020-10-28 07:36:32 +01:00
jneira
bf5108b689 Add forcily needed hie.yaml 2020-10-28 07:36:31 +01:00
jneira
2f31ffb9c9 Remove unused test data file 2020-10-28 07:36:30 +01:00
jneira
55dfc3b2e8 Fix hlint tests 2020-10-28 07:36:28 +01:00
jneira
0e71e87626 Fix hlint tests 2020-10-28 07:36:21 +01:00
jneira
ff778b64fc Move test data to fix the cradle loading 2020-10-28 07:36:20 +01:00
jneira
7674fe7eab Enable hlint tests 2020-10-28 07:36:20 +01:00
Sandy Maguire
e8871ab7e6
Better scoring metric for deriving safeHead (#545)
This PR tweaks the scoring metric to heavily penalize not using top-level function arguments when defining functions. Presumably if they were added to the type sig, someone had intention behind it. Note that this doesn't prevent us from deriving const, since we have no better alternatives in that case.

Furthermore, this fixes a bug where recursive calls were added to the jLocalHypothesis rather than jAmbientHypothesis. The former is for locally introduced variables, for which usage is rewarded. The result was that we were accidentally rewarding recursive calls! Instead we'd like to penalize them, so this PR adds a field which counts recursive calls and penalizes them.

Fixes #539
2020-10-27 18:00:50 -07:00
Sandy Maguire
9223599465
Ignore flakey tactics test (#546)
Due to an oversight in how we handle polymorphic class methods (fixed in #537), having an applicative context introduces (*>) into scope, which causes an exponential explosion in the search space. On fast machines it seems like we can get through this test before the timeout, but on CI it's flakey.
2020-10-27 15:13:19 -07:00
Sandy Maguire
91d2711f38
Tactics support for using given constraints (#534)
This PR allows tactics to use methods from given constraints, meaning it can solve holes like this:

```haskell
showMe :: Show a => a -> String
showMe = _
```

It will not, however, discover instances. So this one *won't* solve:


```haskell
showMe :: Int -> String
showMe = _
```

There's quite a lot of finicky details going on in order to support this. The primary challenge is that our types are running after the typechecker has finished, meaning it's already solved the constraints and inlined their evidence. Our solution is to look up the written polymorphic type and unify it with the final, typechecked type. We can use the polymorphic type to find the theta context, and instantiate every class method in the theta.

In addition, this PR fixes a subtle bug in our unification code, which could cause skolems to unify in some circumstances.

Furthermore, it adds a tie-breaker to the scoring metric to prefer shorter programs.
2020-10-25 15:49:24 -07:00
Sandy Maguire
e20702337b Wait for diagnostics in tactics tests 2020-10-21 01:13:11 -07:00
Sandy Maguire
9a55a8d0ae
Fix a bug in tactics preventing split of split (#520)
The `auto` tactic attempts to prune unhelpful branches in order to avoid an exponential blowup of search space. On one these optimizations is to not build a data constructor if it doesn't result in new types to solve. For example, we're trying to avoid the following pathological example:

```haskell
data Tree a = Leaf a | Branch (Tree a) (Tree a)

-- given the following hole:
pureTree :: a -> Tree a
pureTree a = _

-- we DO NOT want to fill it with
pureTree a = Branch _ _
```

The reasoning here is that both goals in `Branch _ _` have type `Tree a`, which is already the type we're trying to solve, so introducing `Branch` doesn't make any progress.

This check is performed in the `splitAuto` tactic, but I got it backwards and it wasn't explicitly tested for. The only code which hit it was `pure @[]` --- but because `[]` doesn't have any subgoals, this hit a vacuous case and flipped the result of the bad logic. Two wrongs made a hard to find bug.

This PR:

1. Fixes the reversed logic in `splitAuto`
2. Has a special case for nullary data constructors, fixing the bug cause by vacuousness.
3. Adds property tests ensuring we can `auto` our way through any permutation of a tuple (which is where we originally noticed the bug)
4. Prevents `unsafeRender` from crashing when `unsafeGlobalDynFlags` is unset, such as during testing.
5. Moves tactic solution tracing into the plugin, so it won't run during tests.
2020-10-20 23:40:58 -07:00
Sandy Maguire
de4e387436
Use infix notation for destructing and splitting infix data cons in tactics (#519)
The tactics plugin is a bit stupid when working with infix-defined datacons, both in expressions and patterns. For example it will produce (,) a b and (:) a as rather than the more natural (a, b) and a : as. This PR makes it do the right thing.

The solution is to inspect the data con when building an expression or pattern. Unfortunately tuples are extra special in GHC, so this introduces a special case for tuples, and another for everyday infix things (like list).

There's a bit of annoying fiddling in order to build the infix pattern. The logic is in infixifyPatIfNecessary, which is the only thing I'm not super comfortable with in the diff.

Fixes #468
2020-10-19 22:31:04 -07:00
Sandy Maguire
2533574a7f
Allow hole filling to deal with recursion (#472)
This PR enhances the "attempt to fill hole" code action, allowing it to implement self-recursive functions. The generated code ensures recursion occurs only on structurally-smaller values, and preserves the positional ordering of homomorphically destructed arguments.

It's clever enough to implement foldr and nontrivial functor instances.

Co-authored-by: TOTBWF <reed.mullanix@calabrio.com>
2020-10-19 09:51:23 -07:00
Luke Lau
cdf50a6312
Add GitHub Actions CI for testing (#504)
* Add GitHub workflow for testing

* Add HLS_TEST_EXE env var to control which exe to test

* Pass -j1 flag to tasty when running tests on GitHub

* Enable stack in GitHub CI

* Update cabal

* Add HLS_WRAPPER_TEST_EXE

* Fix cache restore keys

* Try force language server to use utf8 locale

* Use patched hie-bios

* Remove debug print

* Lets find out what the windows locale encoding is

* Give up trying to fix the locale

* Add comment for -j1
2020-10-19 14:16:17 +01:00
Hiromi ISHII
c706fa59d6
Adds a test case from #32 2020-10-17 13:54:00 +09:00
Javier Neira
75c4ebca61
Merge pull request #480 from tittoassini/moduleNamePlugin
Module Name Plugin
2020-10-12 23:11:48 +02:00
Pasqualino Titto Assini
7f748a9977 added cradle configuration file for moduleName tests 2020-10-11 17:23:05 +02:00
Pasqualino Titto Assini
c628078996 Added tests, canonicalized paths 2020-10-11 17:08:10 +02:00
Pepe Iborra
5a51fbd1ca
Minimal fix for eval regression (#488)
* Add a test reproducing the regression

* Fix regression in Eval plugin

* Fix redundant import
2020-10-11 14:48:18 +01:00
Hiromi ISHII
58631276d9
Adds test-case for GADT introduction 2020-10-07 20:40:02 +09:00
Hiromi ISHII
d8d7f4c74c
Use dataConInstOrigArgTys instaed of dataConInstArgTys 2020-10-07 11:28:01 +09:00
Luke Lau
e4bb856741
Merge branch 'master' into fourmolu-3 2020-10-03 14:41:02 +01:00
Reed Mullanix
2be03cc9ab
Implement 'Attempt to fill hole' code action (#431)
* [WIP] Start work on 'auto'

* Get current binding

* Fix currentBindingName for class methods

* Proper impl of getDefiningBindings

* Forgot to checkin bindsites

* [WIP] Update version of refinery

* Bind all tyvars if possible

* WIP: Instantiate polymorphic functions

* Split out fresh type variables when instantiating

* Make everything compile

* Separate out tactics

* oneWayUnifyRule

* [WIP] Add 'TacticState'

* [WIP] Tweak 'unify' and 'unifyOneWayRule'

* [WIP] Start work on skolem tracking

* [WIP] Fix 'checkSkolemUnification'

* Update judgement type

* Add a Context to TacticM

* Don't destruct already destructed

* Remove the internal lib

* Cleanup warnings

* Move debug machinery into *.Debug

* Rip types out of machinery

* Cleanup warnings

* Continue splitting Machinery

* Rip out GHC and Naming

* Get it all compiling

* Stop re-exporting from Machinery

* Split out codegen/rules

* Remove gross/unused tactics

* Make newSubgoal derive from an existing judgement

* remove newJudgement

* Disallow current function from auto

* Cleanup auto

* Stop using the Judgement ctor

* Track pattern value

* Better showAstData

* Get module-scoped funcs

* Split all data constructors

* assumption -> assume

* Don't destruct if there are zero datacons

* Lambda case destruct tactics

* Fix the tests

* Rip out debug stuff since it fails CI

* Tests for lambda case actions

* Golden testing machinery

* Attempt to fill hole

* [WIP] Use 'refinery-0.2.0.0'

* [WIP] Update refinery in all stack.yaml files

* Bump version in cabal file

* Bump cabal index state

* Sort goals by heuristic

* Naming for unit types

* Heuristic for auto

* Penalize holes more

* Naming for unit types

* Give the name "unit" to units

* Fallback names for symbols and punctuation

* Get "good" name for symbolic names

* Update plugins/tactics/src/Ide/Plugin/Tactic/CodeGen.hs

Co-authored-by: wz1000 <zubin@cmi.ac.in>

* Make the TacticState strict

* Make the judgement strict

* Simplify when we use position mapping

* Move bindsites to ghcide

Co-authored-by: Sandy Maguire <sandy@sandymaguire.me>
Co-authored-by: wz1000 <zubin@cmi.ac.in>
2020-10-03 07:53:59 +01:00
George Thomas
5205819de5 Fix Fourmolu test 2020-10-03 01:40:54 +01:00
jneira
66bb8e68ae Remove "destruct globals" broken tactic test 2020-09-28 21:16:05 +02:00
Hiromi Ishii
8a71972168
Eval plugin: proper multilined results handling and command-name abbreviations (#413)
* Fixes Eval plugin to treat multilined results properly and supports abbreviation for GHCi commands

* Re-orders Pragmas

* Cosmetic changes

* More correction for LANGUAGE pragma style

* Integrates commenting-out works into `evalGhciLikeCmd`
2020-09-23 21:03:59 +01:00
Sandy Maguire
b43a8cd78d
Case splitting and lambda introduction (#391)
Case split and tactics via refinery

Bump ghcide submodule to get completion for local variables.

Co-authored-by: Zubin Duggal <zubin@cmi.ac.in>
2020-09-17 00:57:57 +05:30
Hiromi Ishii
ee0768dff7
Implements :type [+v/+d] in Eval Plugin (#361)
* More systematic handling of GHCi-like commands

* Human-readable Show for GhciLikeCmdException

* Use `T.strip` instead of `T.stripEnd`

* Implements `:type` command and their tests

* Adds test case for unknown `TcRnExprMode` argument

* Adds test case for unknown command

* Simplifies test case T16

* Corrects mode option

* Adds test-case with defaulting clause inside >>> prompt

* Fixes for redundant imports

* Reorganises import list

* Elaborates on the Exception argument roles

* Adds a test-case for module defaulting, marked as expected failure

* Uses `expectFailBecause` instead
2020-08-29 13:54:06 +01:00
Hiromi Ishii
60b28b0a32
Adds :kind and :kind! commands to Eval Plugin (#345)
* Implements `:kind!` GHCi command to Eval plugin

* Adds golden tests for `:kind!`

* Removes redundant lines

* Adds `:kind` command that returns kind only without normalisation

* Test cases for `:kind`

* Fixes `Applies file LANGUAGE extensions` to avoid sufferring from ImportLens

* Removes redundant leading space
2020-08-26 19:34:24 +01:00
Pepe Iborra
c35a323839 Apply the module pragmas for evaluation 2020-08-15 18:35:52 +01:00
Luke Lau
0cca5dba00 Add Brittany to ghc-8.10.1 2020-08-06 21:04:51 +01:00
George Thomas
d5e256a746 Add fourmolu plugin 2020-08-06 12:42:35 +01:00
Luke Lau
0adf4bd2e3
Merge pull request #260 from bubba/remove-hspec-expectations
Remove hspec-expectations
2020-07-31 23:20:56 +01:00
Luke Lau
6b51c7c54b Remove hspec-expectations
Use @? and @?= instead, since they give much easier to read error
messages. The `shouldX` functions all just end up dumping the Show
instance of a HSpecFailure or what have you which is really hard to
read. It also doesn't look like hspec-expectations is that actively
maintained anymore
2020-07-31 14:48:56 +01:00
shaurya gupta
7a8f51d7aa Remove *.ormolu.unchanged formatting tests 2020-07-30 20:25:25 +05:30
shaurya gupta
96d42f3723 Add more tests for ormolu 2020-07-30 19:35:47 +05:30
shaurya gupta
3a6874d726 Add more tests for checking formatting 2020-07-30 17:09:07 +05:30
fendor
8d32b21da7
Merge pull request #244 from tittoassini/master
Fix for Eval plugin: Error from tests not reported
2020-07-28 09:57:41 +02:00
Luke Lau
95560b1daa Fix Brittany tests
Need to read in those test results as a file, since the CPP preprocessor
trips on those multiline strings
Also use @?= instead of `shouldBe`, since the exception thrown by it
gets caught by tasty and is pretty printed
2020-07-27 23:37:33 +01:00
Pasqualino Titto Assini
04c2dfde52 Test for fix of "Error from tests not reported" 2020-07-27 18:48:45 +02:00
Luke Lau
9d3d0e6f13 Accept the legacy "languageServerHaskell" config name
This also requires a bump to lsp-test to fix a test, and drops the
trick that the wrapper tests used to find the wrapper executable since
it was just confusing
2020-07-27 15:11:10 +01:00
Javier Neira
12c0e44232
Merge pull request #214 from jneira/ghc-haddock
Use -haddock in cabal and stack for all dependencies. 
This way hls gets comments on hover for its dependencies.
2020-07-23 23:04:51 +02:00
Luke Lau
c19f4e7322 Rename the configuration section from languageServerHaskell => haskell
This matches up with how other language servers name their configuration
section (see
https://marketplace.visualstudio.com/items?itemName=rust-lang.rust), and
the new VS Code extension has already done this rename.
2020-07-23 15:43:35 +01:00
jneira
caf684581f Change commented out code to block format
To avoid parse error with -haddock ghc option enabled
2020-07-23 14:19:06 +02:00
jneira
077ae416f0 Remove non useful comment 2020-07-23 14:17:34 +02:00
Luke Lau
0c99ce0411
Distributable binaries (#165)
Update ghcide to obtain the GHC lib dir at runtime, rather than at compile time with ghc-paths. This means that the binaries can be moved about since the lib dir is obtained on the fly
Share the exe/main.hs logic between ghcide and hls: the session setup logic which previously took up most of exe/main.hs now resides inside the ghcide library, and is used by both ghcide and hls's executables
Add a --project-ghc-version option to the wrapper which spits out the project's ghc version to stdout. This is useful for the vscode extension which can then use it to download the corresponding version of binary that the wrapper would have otherwise attempted to launch
Make the wrapper check to see if the correct tool is installed beforehand. For example, if it detects a stack project but stack isn't on the path, it will report an error then and there, rather than having hls/ghcide confusingly fail later on. The vscode extension uses this new error message as well to provide a pop up message linking the user to a website to install the missing tool
Remove cabal-helper from the wrapper, so that the implicit cradle logic is the same between ghcide/hls/hls-wrapper
And of course, add a GitHub action workflow that runs whenever a release is created on GitHub that builds static binaries on Linux, and distributable enough binaries on macOS and windows. This is documented a bit more in docs/releases.md

* WIP

* WIP 2

* WIP 3

* WIP 4

* WIP 5

* WIP 6

* WIP 7

* WIP 8

* WIP 9 Use patched hie-bios to get libdir dynamically

* Try building the wrapper

* Try to fix build_wrapper env variable not being picked up

* Try again

* Give up on the env var idea

* Try out static optimised builds?

* Try squashing the working dir

* Woops

* Try squashing the builddir

* Try going into the parent directory

* Radical approach - don't use such a long name for the wrapper

* Use dist-binary flag

* Debug why floskell fails to build on windows

* haskell-language-server => hls on CI

I hate that I have to do this

* Employ extreme path saving measures

* sed time :(

* Try making sed command portable

* Compress artefacts

* Tidy up wrapper logging

* Use version checking logic in hie-bios

* Add documentation on the releases process

* Remove unused code

* Append .exe to windows binaries

* Try out building remaining supported ghc configurations

* Add wrapper tests and update hie-bios

* Use index timestamp that exists on hackage

Fixes warning

* Update hie-bios

* Update hie-bios

* Try building windows jobs on -j1

* Skip windows 8.8.2

* Update ghc-check to use hie-bios runtime ghc libdir

* Upload binaries as an artifact too

* Try flicking on enable-executable-static

I don't expect this to work, puffnfresh has already tried this and had
to fork ghcup

* Fix artifact upload

* Update to latest ghcide and reuse loadSession

* Check if the tool is installed in --project-ghc-version in the wrapper

* Fix wrapper tests by copying to temporary directory

* Try caching

* Tidy up and switch back to cabal helper implicit cradle

* use split sections

* Remove cabal-helper and replace it with hie-bios implicit logic

The cabal-helper cradle was only used by the wrapper for detecting the
project GHC version in the absence of an explicit hie.yaml file, whilst
ghcide itself used the hie-bios implicit cradle logic. This brings the
two in sync so the wrapper should behave more predictably now.

* Undo agpl common stanza change

* Add release number

Co-authored-by: amesgen <amesgen@amesgen.de>
2020-07-20 20:28:52 +01:00
Pepe Iborra
184d0bd63e Bug fixes 2020-07-16 20:46:36 +01:00
Pepe Iborra
05a19999b6 Add a test for reevaluation 2020-07-16 20:46:36 +01:00
Pepe Iborra
890431936e Add ignored hie.yaml file 2020-07-16 20:46:36 +01:00
Pepe Iborra
67744c479f Tests 2020-07-16 20:46:36 +01:00
Junyoung Clare Jang
34eb232f1e
Restore most of the format tests under golden testing 2020-06-09 14:57:50 -04:00
Junyoung Clare Jang
e4f8df88df
Introduce golden testing for stylish-haskell formatter 2020-06-09 14:30:23 -04:00
Junyoung Clare Jang
c61f27acc4
Add test cases for stylish-haskell 2020-06-05 15:01:38 -04:00
Jeff Windsor
0c1708f80f add xml output to runner 2020-05-16 19:36:53 -07:00
Jeff Windsor
092db6ef96 ignore broken tests 2020-05-16 19:19:49 -07:00
Jeff Windsor
2f555230c0 fix tests do not compile after update 2020-05-16 18:01:13 -07:00
Jeff Windsor
b16623e9e6 fix ResponseMessage change 2020-05-16 17:25:10 -07:00
Jeff Windsor
ade13db938 rename Test.HIE.Util to Test.Hls.Util 2020-05-16 16:54:54 -07:00
Jeff Windsor
fc140e5f7a add tasty-rerun 2020-05-10 18:45:50 -07:00
Jeff Windsor
7c3d784497 use hspec-expectations for shoulds 2020-05-10 18:12:42 -07:00
Jeff Windsor
218ac493e5 add warmup, missing runner 2020-05-10 12:49:28 -07:00
Jeff Windsor
d0c0e6150d move and restore full test util module 2020-05-10 12:25:05 -07:00
Jeff Windsor
8cccd93f48 turn on all tests 2020-05-10 11:59:33 -07:00
Jeff Windsor
f9173b06e4 add other tests 2020-05-10 11:57:34 -07:00
Jeff Windsor
f08db9bbc5 add FunctionalLiquid HieBois Highlist tests 2020-05-10 10:32:08 -07:00
Jeff Windsor
ece0d31a71 add FunctionalCodeAction tests 2020-05-09 20:19:30 -07:00
Jeff Windsor
7b6c550bb8 add format tests 2020-05-09 19:12:59 -07:00
Jeff Windsor
29497543a3 add diagnostic tests 2020-05-09 18:51:05 -07:00
Jeff Windsor
c0d7dd1f46 add definition tests 2020-05-09 18:03:10 -07:00
Jeff Windsor
f3c5b87824 Refactor Test Util and remove spec files 2020-05-09 17:52:49 -07:00
Jeff Windsor
7ba6cc9b9c add Deferred Tests (2 out 4 failing) 2020-05-09 16:50:19 -07:00
Jeff Windsor
86017da8f5 add Completion Tests (all are timing out as of now) 2020-05-09 16:09:23 -07:00
Jeff Windsor
7c4f670569 full test data 2020-05-09 14:27:46 -07:00
Jeff Windsor
d1ab2d8657 Commands (de-prefix failing) 2020-05-09 13:57:55 -07:00
Jeff Windsor
4ec1817652 Move to functional folder with first real test 2020-05-09 13:37:37 -07:00
Jeff Windsor
56363ddca6 Incorporate hls-test-utils 2020-05-09 11:53:12 -07:00
Jeff Windsor
a2a2306751 Initial Structure 2020-05-03 19:02:01 -07:00
fendor
3edfaeb87a Fix func-test for ormolu 2020-04-25 17:40:48 +02:00
unknown
910696ab92 Fix testspec for brittany, also fix warnings 2020-04-19 15:46:47 +02:00
unknown
df144ea04f Enable tests for brittany 2020-04-19 00:24:50 +02:00
unknown
11554bb095 Use direct cradles for test-setup 2020-04-19 00:24:50 +02:00
Alan Zimmerman
abcbdaa4d6 Fix failing hls functional test 2020-04-07 20:27:52 +01:00
Alan Zimmerman
cebd00fab0 Get tests to pass 2020-03-16 22:36:02 +00:00
Alan Zimmerman
2ebf7ae370 Add a "mark" function to write to stdout and the test log
For correlating with circleci logs
2020-03-16 20:49:54 +00:00
Alan Zimmerman
fd28518c48 Put test id in the logs 2020-03-16 20:23:05 +00:00
Alan Zimmerman
20746cf61f Print some progress on the tests 2020-03-16 18:37:50 +00:00
Alan Zimmerman
7552c58c93 Mark documentContents failing tests pending
It seems lsp-test is not applying edits properly, doing the same sequence in
vscode results in the correct result.
2020-03-15 11:47:33 +00:00
Alan Zimmerman
fa46f7fc2f Add symbols provider to plugin support 2020-03-15 11:42:17 +00:00
Alan Zimmerman
43d6381723 Investigating the failing formatter tests.
Conclusion is that getDocumentContents is returning junk, doing the idempotent
test manually on vscode works as expected, but ends up with junk at the end of
the file in the test.

2020-03-12 21:11:05.79062259 [ThreadId 38] - Formatter.doFormatting: contents=
"{-# LANGUAGE NoImplicitPrelude #-}
module    Format where
foo   :: Int ->  Int
foo  3 = 2
foo    x  = x
bar   :: String ->   IO String
bar s =  do
      x <- return \"hello\"
      return \"asdf\"
"

2020-03-12 21:11:07.896114974 [ThreadId 7] - <--2--{"result":[{"range":{"start":{"line":0,"character":0},"end":{"line":9,"character":0}},"newText":
"{-# LANGUAGE NoImplicitPrelude #-}

module Format where

foo :: Int -> Int
foo 3 = 2
foo x = x

bar :: String -> IO String
bar s = do
  x <- return \"hello\"
  return \"asdf\"
"}],"jsonrpc":"2.0","id":1}

2020-03-12 21:11:07.897123428 [ThreadId 5] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"version":0,"uri":"file:///home/alanz/mysrc/github/alanz/haskell-language-server/test/testdata/Format.hs"},"contentChanges":[{"text":
"{-# LANGUAGE NoImplicitPrelude #-}

module Format where

foo :: Int -> Int
foo 3 = 2
foo x = x

bar :: String -> IO String
bar s = do
  x <- return \"hello\"
  return \"asdf\"
","range":{"start":{"line":0,"character":0},"end":{"line":9,"character":0}}}]}}

-------------------------------------------------------

2020-03-12 21:11:07.899375044 [ThreadId 213] - Formatter.doFormatting: contents="{-# LANGUAGE NoImplicitPrelude #-}
module    Format where
foo   :: Int ->  Int
foo  3 = 2
foo    x  = x
bar   :: String ->   IO String
bar s =  do
      x <- return \"hello\"
      return \"asdf\"
"

2020-03-12 21:11:07.902320214 [ThreadId 7] - <--2--{"result":[{"range":{"start":{"line":0,"character":0},"end":{"line":9,"character":0}},"newText":"{-# LANGUAGE NoImplicitPrelude #-}

module Format where

foo :: Int -> Int
foo 3 = 2
foo x = x

bar :: String -> IO String
bar s = do
  x <- return \"hello\"
  return \"asdf\"
"}],"jsonrpc":"2.0","id":2}

2020-03-12 21:11:07.902812215 [ThreadId 5] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"version":0,"uri":"file:///home/alanz/mysrc/github/alanz/haskell-language-server/test/testdata/Format.hs"},"contentChanges":[{"text":
"{-# LANGUAGE NoImplicitPrelude #-}

module Format where

foo :: Int -> Int
foo 3 = 2
foo x = x

bar :: String -> IO String
bar s = do
  x <- return \"hello\"
  return \"asdf\"
","range":{"start":{"line":0,"character":0},"end":{"line":9,"character":0}}}]}}

--------------------------------

hieCommand: haskell-language-server --lsp -d -l test-logs/hie-stack-8.6.5.yaml.log
HIE cache is warmed up

Format
  formatting provider
    formatting is idempotent FAILED [1]

Failures:

  test/functional/FormatSpec.hs:64:42:
  1) Format, formatting provider, formatting is idempotent
       expected: "{-# LANGUAGE NoImplicitPrelude #-}\n\nmodule Format where\n\nfoo :: Int -> Int\nfoo 3 = 2\nfoo x = x\n\nbar :: String -> IO String\nbar s = do\n  x <- return \"hello\"\n  return \"asdf\"\n"
        but got: "{-# LANGUAGE NoImplicitPrelude #-}\n\nmodule Format where\n\nfoo :: Int -> Int\nfoo 3 = 2\nfoo x = x\n\nbar :: String -> IO String\nbar s = do\n  x <- return \"hello\"\n  return \"asdf\"\nbar s = do\n  x <- return \"hello\"\n  return \"asdf\"\n"

  To rerun use: --match "/Format/formatting provider/formatting is idempotent/"

Randomized with seed 1814425400
2020-03-15 11:42:17 +00:00
Alan Zimmerman
b02bf3323e Working on tests.
Currently suspect the range we get to format the whole file is wrong, second
time around.
2020-03-15 11:41:51 +00:00
Alan Zimmerman
a33c2b481d More plugin refactoring, add codelens support
Starting to look pretty solid.
2020-03-15 11:41:16 +00:00
Alan Zimmerman
bcc4b96692 Add logging
It piggy-backs existing args from ghcide, probably a bad idea
2020-03-15 11:41:05 +00:00
Alan Zimmerman
5c4758e5f2 Break out Code Action providers into their own handler 2020-03-15 11:39:45 +00:00
Alan Zimmerman
3088e6da0a Starting to sketch out IDE-level plugin modularity
Address #25

Currently WIP
2020-03-15 11:39:45 +00:00
Alan Zimmerman
e726dfe894 Tweak tests for a pass
The floskell formatting is not correct, but this is initially about getting the
plugin machinery into place.
2020-02-17 19:35:33 +00:00
Alan Zimmerman
a30949bd57 Bringing in ability to select provider.
Needs https://github.com/digital-asset/ghcide/pull/412 to land first, as a basis
for the needed changes
2020-02-12 22:41:43 +00:00
Alan Zimmerman
5e9684b7db Clean up a bit based on @fendor review 2020-02-07 18:18:33 +00:00
Alan Zimmerman
769797c49b Format tests pass for Ormolu 2020-02-06 21:49:11 +00:00
Alan Zimmerman
2521a7f965 WIP on formatting spec, via hspec
We only have an Ormolu formatter at present, want to make sure the circle stuff
actually works too.

Need to plumb the config values through to the actual formatter.
2020-02-06 21:17:50 +00:00
Alan Zimmerman
22ec25670a WIP on introducing tasty test suite 2020-02-06 18:12:12 +00:00
Alan Zimmerman
04cb7ea583 Initial basic infrastucture 2020-01-25 14:33:53 +00:00