diff --git a/.circleci/config.yml b/.circleci/config.yml index 53038c4933..c1c658bede 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,11 +65,11 @@ defaults: &defaults - run: name: Setup stack eval hie.html - command: cp test/testdata/eval/hie-stack.yaml test/testdata/eval/hie.yaml + command: cp plugins/hls-eval-plugin/test/testdata/hie-stack.yaml plugins/hls-eval-plugin/test/testdata/hie.yaml - run: name: Setup stack eval stack.html - command: grep '^resolver:\|^compiler:' stack-build.txt > test/testdata/eval/stack.yaml + command: grep '^resolver:\|^compiler:' stack-build.txt > plugins/hls-eval-plugin/test/testdata/stack.yaml - run: name: Test haskell-language-server func-test suite diff --git a/cabal.project b/cabal.project index 197b2f3c4a..2a53ab0e8d 100644 --- a/cabal.project +++ b/cabal.project @@ -6,6 +6,7 @@ packages: ./hls-plugin-api ./plugins/tactics ./plugins/hls-class-plugin + ./plugins/hls-eval-plugin ./plugins/hls-explicit-imports-plugin ./plugins/hls-hlint-plugin ./plugins/hls-retrie-plugin diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index 3b5b9153d6..ceb89126bd 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -166,18 +166,7 @@ common class common eval if flag(eval) || flag(all-plugins) - hs-source-dirs: plugins/default/src - other-modules: Ide.Plugin.Eval - Ide.Plugin.Eval.Code - Ide.Plugin.Eval.CodeLens - Ide.Plugin.Eval.GHC - Ide.Plugin.Eval.Parse.Option - Ide.Plugin.Eval.Parse.Parser - Ide.Plugin.Eval.Parse.Section - Ide.Plugin.Eval.Parse.Token - Ide.Plugin.Eval.Types - Ide.Plugin.Eval.Util - build-depends: + build-depends: hls-eval-plugin cpp-options: -Deval common importLens @@ -306,14 +295,8 @@ executable haskell-language-server , safe-exceptions , shake >=0.17.5 , temporary - , time , transformers , unordered-containers - , parser-combinators - , pretty-simple - , Diff - , QuickCheck - , ghc-paths , with-utf8 include-dirs: include @@ -402,7 +385,7 @@ test-suite func-test , tasty-golden , tasty-rerun - hs-source-dirs: test/functional plugins/tactics/src + hs-source-dirs: test/functional plugins/tactics/src plugins/hls-eval-plugin/test main-is: Main.hs other-modules: diff --git a/hie-cabal.yaml b/hie-cabal.yaml index f106c0df7c..336cbe26b4 100644 --- a/hie-cabal.yaml +++ b/hie-cabal.yaml @@ -106,6 +106,9 @@ cradle: - path: "./plugins/hls-class-plugin/src" component: "lib:hls-class-plugin" + - path: "./plugins/hls-eval-plugin/src" + component: "lib:hls-eval-plugin" + - path: "./plugins/hls-explicit-imports-plugin/src" component: "lib:hls-explicit-imports-plugin" diff --git a/hie-stack.yaml b/hie-stack.yaml index 1c03904013..2891e08e8f 100644 --- a/hie-stack.yaml +++ b/hie-stack.yaml @@ -40,7 +40,7 @@ cradle: - path: "./hls-plugin-api/src" component: "hls-plugin-api:lib" -# Plugins: + # Plugins: - path: "./plugins/hls-class-plugin/src" component: "hls-class-plugin:lib" @@ -48,6 +48,9 @@ cradle: - path: "./plugins/hls-explicit-imports-plugin/src" component: "hls-explicit-imports-plugin:lib" + - path: "./plugins/hls-eval-plugin/src" + component: "hls-eval-plugin:lib" + - path: "./plugins/hls-hlint-plugin/src" component: "hls-hlint-plugin:lib" diff --git a/nix/default.nix b/nix/default.nix index 507370a8da..17e424f118 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -21,6 +21,7 @@ let hie-compat = gitignoreSource ../hie-compat; hls-plugin-api = gitignoreSource ../hls-plugin-api; hls-class-plugin = gitignoreSource ../plugins/hls-class-plugin; + hls-eval-plugin = gitignoreSource ../plugins/hls-eval-plugin; hls-explicit-imports-plugin = gitignoreSource ../plugins/hls-explicit-imports-plugin; hls-hlint-plugin = gitignoreSource ../plugins/hls-hlint-plugin; hls-retrie-plugin = gitignoreSource ../plugins/hls-retrie-plugin; diff --git a/plugins/hls-eval-plugin/LICENSE b/plugins/hls-eval-plugin/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/plugins/hls-eval-plugin/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/plugins/hls-eval-plugin/hls-eval-plugin.cabal b/plugins/hls-eval-plugin/hls-eval-plugin.cabal new file mode 100644 index 0000000000..90fe98ddc1 --- /dev/null +++ b/plugins/hls-eval-plugin/hls-eval-plugin.cabal @@ -0,0 +1,54 @@ +cabal-version: 2.2 +name: hls-eval-plugin +version: 0.1.0.0 +synopsis: Eval plugin for Haskell Language Server +license: Apache-2.0 +license-file: LICENSE +author: pepeiborra@gmail.com,tittoassini@gmail.com +maintainer: pepeiborra@gmail.com,tittoassini@gmail.com +build-type: Simple +extra-source-files: LICENSE + +library + exposed-modules: Ide.Plugin.Eval + hs-source-dirs: src + other-modules: + Ide.Plugin.Eval.Code + Ide.Plugin.Eval.CodeLens + Ide.Plugin.Eval.GHC + Ide.Plugin.Eval.Parse.Option + Ide.Plugin.Eval.Parse.Parser + Ide.Plugin.Eval.Parse.Section + Ide.Plugin.Eval.Parse.Token + Ide.Plugin.Eval.Types + Ide.Plugin.Eval.Util + + build-depends: + , aeson + , base + , containers + , deepseq + , Diff + , directory + , extra + , filepath + , ghc + , ghc-boot-th + , ghc-paths + , ghcide + , hashable + , haskell-lsp + , haskell-lsp-types + , hls-plugin-api + , parser-combinators + , pretty-simple + , QuickCheck + , safe-exceptions + , shake + , temporary + , text + , time + , transformers + , unordered-containers + + default-language: Haskell2010 diff --git a/plugins/default/src/Ide/Plugin/Eval.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval.hs similarity index 100% rename from plugins/default/src/Ide/Plugin/Eval.hs rename to plugins/hls-eval-plugin/src/Ide/Plugin/Eval.hs diff --git a/plugins/default/src/Ide/Plugin/Eval/Code.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Code.hs similarity index 100% rename from plugins/default/src/Ide/Plugin/Eval/Code.hs rename to plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Code.hs diff --git a/plugins/default/src/Ide/Plugin/Eval/CodeLens.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs similarity index 100% rename from plugins/default/src/Ide/Plugin/Eval/CodeLens.hs rename to plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs diff --git a/plugins/default/src/Ide/Plugin/Eval/GHC.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/GHC.hs similarity index 100% rename from plugins/default/src/Ide/Plugin/Eval/GHC.hs rename to plugins/hls-eval-plugin/src/Ide/Plugin/Eval/GHC.hs diff --git a/plugins/default/src/Ide/Plugin/Eval/Parse/Option.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Parse/Option.hs similarity index 100% rename from plugins/default/src/Ide/Plugin/Eval/Parse/Option.hs rename to plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Parse/Option.hs diff --git a/plugins/default/src/Ide/Plugin/Eval/Parse/Parser.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Parse/Parser.hs similarity index 100% rename from plugins/default/src/Ide/Plugin/Eval/Parse/Parser.hs rename to plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Parse/Parser.hs diff --git a/plugins/default/src/Ide/Plugin/Eval/Parse/Section.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Parse/Section.hs similarity index 100% rename from plugins/default/src/Ide/Plugin/Eval/Parse/Section.hs rename to plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Parse/Section.hs diff --git a/plugins/default/src/Ide/Plugin/Eval/Parse/Token.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Parse/Token.hs similarity index 100% rename from plugins/default/src/Ide/Plugin/Eval/Parse/Token.hs rename to plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Parse/Token.hs diff --git a/plugins/default/src/Ide/Plugin/Eval/Tutorial.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Tutorial.hs similarity index 100% rename from plugins/default/src/Ide/Plugin/Eval/Tutorial.hs rename to plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Tutorial.hs diff --git a/plugins/default/src/Ide/Plugin/Eval/Types.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Types.hs similarity index 100% rename from plugins/default/src/Ide/Plugin/Eval/Types.hs rename to plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Types.hs diff --git a/plugins/default/src/Ide/Plugin/Eval/Util.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Util.hs similarity index 100% rename from plugins/default/src/Ide/Plugin/Eval/Util.hs rename to plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Util.hs diff --git a/test/functional/Eval.hs b/plugins/hls-eval-plugin/test/Eval.hs similarity index 99% rename from test/functional/Eval.hs rename to plugins/hls-eval-plugin/test/Eval.hs index 8e0b6aa679..adee21c48f 100644 --- a/test/functional/Eval.hs +++ b/plugins/hls-eval-plugin/test/Eval.hs @@ -208,4 +208,4 @@ replaceUnicodeQuotes :: T.Text -> T.Text replaceUnicodeQuotes = T.replace "‘" "'" . T.replace "’" "'" evalPath :: FilePath -evalPath = "test/testdata/eval" +evalPath = "plugins/hls-eval-plugin/test/testdata" diff --git a/test/testdata/eval/T1.hs b/plugins/hls-eval-plugin/test/testdata/T1.hs similarity index 100% rename from test/testdata/eval/T1.hs rename to plugins/hls-eval-plugin/test/testdata/T1.hs diff --git a/test/testdata/eval/T1.hs.expected b/plugins/hls-eval-plugin/test/testdata/T1.hs.expected similarity index 100% rename from test/testdata/eval/T1.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T1.hs.expected diff --git a/test/testdata/eval/T10.hs b/plugins/hls-eval-plugin/test/testdata/T10.hs similarity index 100% rename from test/testdata/eval/T10.hs rename to plugins/hls-eval-plugin/test/testdata/T10.hs diff --git a/test/testdata/eval/T10.hs.expected b/plugins/hls-eval-plugin/test/testdata/T10.hs.expected similarity index 100% rename from test/testdata/eval/T10.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T10.hs.expected diff --git a/test/testdata/eval/T11.hs b/plugins/hls-eval-plugin/test/testdata/T11.hs similarity index 100% rename from test/testdata/eval/T11.hs rename to plugins/hls-eval-plugin/test/testdata/T11.hs diff --git a/test/testdata/eval/T11.hs.expected b/plugins/hls-eval-plugin/test/testdata/T11.hs.expected similarity index 100% rename from test/testdata/eval/T11.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T11.hs.expected diff --git a/test/testdata/eval/T12.hs b/plugins/hls-eval-plugin/test/testdata/T12.hs similarity index 100% rename from test/testdata/eval/T12.hs rename to plugins/hls-eval-plugin/test/testdata/T12.hs diff --git a/test/testdata/eval/T12.hs.expected b/plugins/hls-eval-plugin/test/testdata/T12.hs.expected similarity index 100% rename from test/testdata/eval/T12.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T12.hs.expected diff --git a/test/testdata/eval/T13.hs b/plugins/hls-eval-plugin/test/testdata/T13.hs similarity index 100% rename from test/testdata/eval/T13.hs rename to plugins/hls-eval-plugin/test/testdata/T13.hs diff --git a/test/testdata/eval/T13.hs.expected b/plugins/hls-eval-plugin/test/testdata/T13.hs.expected similarity index 100% rename from test/testdata/eval/T13.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T13.hs.expected diff --git a/test/testdata/eval/T14.hs b/plugins/hls-eval-plugin/test/testdata/T14.hs similarity index 100% rename from test/testdata/eval/T14.hs rename to plugins/hls-eval-plugin/test/testdata/T14.hs diff --git a/test/testdata/eval/T14.hs.expected b/plugins/hls-eval-plugin/test/testdata/T14.hs.expected similarity index 100% rename from test/testdata/eval/T14.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T14.hs.expected diff --git a/test/testdata/eval/T15.hs b/plugins/hls-eval-plugin/test/testdata/T15.hs similarity index 100% rename from test/testdata/eval/T15.hs rename to plugins/hls-eval-plugin/test/testdata/T15.hs diff --git a/test/testdata/eval/T15.hs.expected b/plugins/hls-eval-plugin/test/testdata/T15.hs.expected similarity index 100% rename from test/testdata/eval/T15.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T15.hs.expected diff --git a/test/testdata/eval/T16.hs b/plugins/hls-eval-plugin/test/testdata/T16.hs similarity index 100% rename from test/testdata/eval/T16.hs rename to plugins/hls-eval-plugin/test/testdata/T16.hs diff --git a/test/testdata/eval/T16.hs.expected b/plugins/hls-eval-plugin/test/testdata/T16.hs.expected similarity index 100% rename from test/testdata/eval/T16.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T16.hs.expected diff --git a/test/testdata/eval/T17.hs b/plugins/hls-eval-plugin/test/testdata/T17.hs similarity index 100% rename from test/testdata/eval/T17.hs rename to plugins/hls-eval-plugin/test/testdata/T17.hs diff --git a/test/testdata/eval/T17.hs.expected b/plugins/hls-eval-plugin/test/testdata/T17.hs.expected similarity index 100% rename from test/testdata/eval/T17.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T17.hs.expected diff --git a/test/testdata/eval/T18.hs b/plugins/hls-eval-plugin/test/testdata/T18.hs similarity index 100% rename from test/testdata/eval/T18.hs rename to plugins/hls-eval-plugin/test/testdata/T18.hs diff --git a/test/testdata/eval/T18.hs.expected b/plugins/hls-eval-plugin/test/testdata/T18.hs.expected similarity index 100% rename from test/testdata/eval/T18.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T18.hs.expected diff --git a/test/testdata/eval/T19.hs b/plugins/hls-eval-plugin/test/testdata/T19.hs similarity index 100% rename from test/testdata/eval/T19.hs rename to plugins/hls-eval-plugin/test/testdata/T19.hs diff --git a/test/testdata/eval/T19.hs.expected b/plugins/hls-eval-plugin/test/testdata/T19.hs.expected similarity index 100% rename from test/testdata/eval/T19.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T19.hs.expected diff --git a/test/testdata/eval/T2.hs b/plugins/hls-eval-plugin/test/testdata/T2.hs similarity index 100% rename from test/testdata/eval/T2.hs rename to plugins/hls-eval-plugin/test/testdata/T2.hs diff --git a/test/testdata/eval/T2.hs.expected b/plugins/hls-eval-plugin/test/testdata/T2.hs.expected similarity index 100% rename from test/testdata/eval/T2.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T2.hs.expected diff --git a/test/testdata/eval/T20.hs b/plugins/hls-eval-plugin/test/testdata/T20.hs similarity index 100% rename from test/testdata/eval/T20.hs rename to plugins/hls-eval-plugin/test/testdata/T20.hs diff --git a/test/testdata/eval/T20.hs.expected b/plugins/hls-eval-plugin/test/testdata/T20.hs.expected similarity index 100% rename from test/testdata/eval/T20.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T20.hs.expected diff --git a/test/testdata/eval/T21.hs b/plugins/hls-eval-plugin/test/testdata/T21.hs similarity index 100% rename from test/testdata/eval/T21.hs rename to plugins/hls-eval-plugin/test/testdata/T21.hs diff --git a/test/testdata/eval/T21.hs.expected b/plugins/hls-eval-plugin/test/testdata/T21.hs.expected similarity index 100% rename from test/testdata/eval/T21.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T21.hs.expected diff --git a/test/testdata/eval/T22.hs b/plugins/hls-eval-plugin/test/testdata/T22.hs similarity index 100% rename from test/testdata/eval/T22.hs rename to plugins/hls-eval-plugin/test/testdata/T22.hs diff --git a/test/testdata/eval/T22.hs.expected b/plugins/hls-eval-plugin/test/testdata/T22.hs.expected similarity index 100% rename from test/testdata/eval/T22.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T22.hs.expected diff --git a/test/testdata/eval/T23.hs b/plugins/hls-eval-plugin/test/testdata/T23.hs similarity index 100% rename from test/testdata/eval/T23.hs rename to plugins/hls-eval-plugin/test/testdata/T23.hs diff --git a/test/testdata/eval/T23.hs.expected b/plugins/hls-eval-plugin/test/testdata/T23.hs.expected similarity index 100% rename from test/testdata/eval/T23.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T23.hs.expected diff --git a/test/testdata/eval/T24.hs b/plugins/hls-eval-plugin/test/testdata/T24.hs similarity index 100% rename from test/testdata/eval/T24.hs rename to plugins/hls-eval-plugin/test/testdata/T24.hs diff --git a/test/testdata/eval/T24.hs.expected b/plugins/hls-eval-plugin/test/testdata/T24.hs.expected similarity index 100% rename from test/testdata/eval/T24.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T24.hs.expected diff --git a/test/testdata/eval/T25.hs b/plugins/hls-eval-plugin/test/testdata/T25.hs similarity index 100% rename from test/testdata/eval/T25.hs rename to plugins/hls-eval-plugin/test/testdata/T25.hs diff --git a/test/testdata/eval/T25.hs.expected b/plugins/hls-eval-plugin/test/testdata/T25.hs.expected similarity index 100% rename from test/testdata/eval/T25.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T25.hs.expected diff --git a/test/testdata/eval/T26.hs b/plugins/hls-eval-plugin/test/testdata/T26.hs similarity index 100% rename from test/testdata/eval/T26.hs rename to plugins/hls-eval-plugin/test/testdata/T26.hs diff --git a/test/testdata/eval/T26.hs.expected b/plugins/hls-eval-plugin/test/testdata/T26.hs.expected similarity index 100% rename from test/testdata/eval/T26.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T26.hs.expected diff --git a/test/testdata/eval/T27.hs b/plugins/hls-eval-plugin/test/testdata/T27.hs similarity index 100% rename from test/testdata/eval/T27.hs rename to plugins/hls-eval-plugin/test/testdata/T27.hs diff --git a/test/testdata/eval/T27.hs.expected b/plugins/hls-eval-plugin/test/testdata/T27.hs.expected similarity index 100% rename from test/testdata/eval/T27.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T27.hs.expected diff --git a/test/testdata/eval/T3.hs b/plugins/hls-eval-plugin/test/testdata/T3.hs similarity index 100% rename from test/testdata/eval/T3.hs rename to plugins/hls-eval-plugin/test/testdata/T3.hs diff --git a/test/testdata/eval/T3.hs.expected b/plugins/hls-eval-plugin/test/testdata/T3.hs.expected similarity index 100% rename from test/testdata/eval/T3.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T3.hs.expected diff --git a/test/testdata/eval/T4.hs b/plugins/hls-eval-plugin/test/testdata/T4.hs similarity index 100% rename from test/testdata/eval/T4.hs rename to plugins/hls-eval-plugin/test/testdata/T4.hs diff --git a/test/testdata/eval/T4.hs.expected b/plugins/hls-eval-plugin/test/testdata/T4.hs.expected similarity index 100% rename from test/testdata/eval/T4.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T4.hs.expected diff --git a/test/testdata/eval/T5.hs b/plugins/hls-eval-plugin/test/testdata/T5.hs similarity index 100% rename from test/testdata/eval/T5.hs rename to plugins/hls-eval-plugin/test/testdata/T5.hs diff --git a/test/testdata/eval/T5.hs.expected b/plugins/hls-eval-plugin/test/testdata/T5.hs.expected similarity index 100% rename from test/testdata/eval/T5.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T5.hs.expected diff --git a/test/testdata/eval/T6.hs b/plugins/hls-eval-plugin/test/testdata/T6.hs similarity index 100% rename from test/testdata/eval/T6.hs rename to plugins/hls-eval-plugin/test/testdata/T6.hs diff --git a/test/testdata/eval/T6.hs.expected b/plugins/hls-eval-plugin/test/testdata/T6.hs.expected similarity index 100% rename from test/testdata/eval/T6.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T6.hs.expected diff --git a/test/testdata/eval/T7.hs b/plugins/hls-eval-plugin/test/testdata/T7.hs similarity index 100% rename from test/testdata/eval/T7.hs rename to plugins/hls-eval-plugin/test/testdata/T7.hs diff --git a/test/testdata/eval/T7.hs.expected b/plugins/hls-eval-plugin/test/testdata/T7.hs.expected similarity index 100% rename from test/testdata/eval/T7.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T7.hs.expected diff --git a/test/testdata/eval/T8.hs b/plugins/hls-eval-plugin/test/testdata/T8.hs similarity index 100% rename from test/testdata/eval/T8.hs rename to plugins/hls-eval-plugin/test/testdata/T8.hs diff --git a/test/testdata/eval/T8.hs.expected b/plugins/hls-eval-plugin/test/testdata/T8.hs.expected similarity index 100% rename from test/testdata/eval/T8.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T8.hs.expected diff --git a/test/testdata/eval/T9.hs b/plugins/hls-eval-plugin/test/testdata/T9.hs similarity index 100% rename from test/testdata/eval/T9.hs rename to plugins/hls-eval-plugin/test/testdata/T9.hs diff --git a/test/testdata/eval/T9.hs.expected b/plugins/hls-eval-plugin/test/testdata/T9.hs.expected similarity index 100% rename from test/testdata/eval/T9.hs.expected rename to plugins/hls-eval-plugin/test/testdata/T9.hs.expected diff --git a/test/testdata/eval/TCPP.hs b/plugins/hls-eval-plugin/test/testdata/TCPP.hs similarity index 100% rename from test/testdata/eval/TCPP.hs rename to plugins/hls-eval-plugin/test/testdata/TCPP.hs diff --git a/test/testdata/eval/TCPP.hs.expected b/plugins/hls-eval-plugin/test/testdata/TCPP.hs.expected similarity index 100% rename from test/testdata/eval/TCPP.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TCPP.hs.expected diff --git a/test/testdata/eval/TCompare.hs b/plugins/hls-eval-plugin/test/testdata/TCompare.hs similarity index 100% rename from test/testdata/eval/TCompare.hs rename to plugins/hls-eval-plugin/test/testdata/TCompare.hs diff --git a/test/testdata/eval/TCompare.hs.expected b/plugins/hls-eval-plugin/test/testdata/TCompare.hs.expected similarity index 100% rename from test/testdata/eval/TCompare.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TCompare.hs.expected diff --git a/test/testdata/eval/THaddock.hs b/plugins/hls-eval-plugin/test/testdata/THaddock.hs similarity index 100% rename from test/testdata/eval/THaddock.hs rename to plugins/hls-eval-plugin/test/testdata/THaddock.hs diff --git a/test/testdata/eval/THaddock.hs.expected b/plugins/hls-eval-plugin/test/testdata/THaddock.hs.expected similarity index 100% rename from test/testdata/eval/THaddock.hs.expected rename to plugins/hls-eval-plugin/test/testdata/THaddock.hs.expected diff --git a/test/testdata/eval/TIO.hs b/plugins/hls-eval-plugin/test/testdata/TIO.hs similarity index 100% rename from test/testdata/eval/TIO.hs rename to plugins/hls-eval-plugin/test/testdata/TIO.hs diff --git a/test/testdata/eval/TIO.hs.expected b/plugins/hls-eval-plugin/test/testdata/TIO.hs.expected similarity index 100% rename from test/testdata/eval/TIO.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TIO.hs.expected diff --git a/test/testdata/eval/TLHS.lhs b/plugins/hls-eval-plugin/test/testdata/TLHS.lhs similarity index 100% rename from test/testdata/eval/TLHS.lhs rename to plugins/hls-eval-plugin/test/testdata/TLHS.lhs diff --git a/test/testdata/eval/TLHS.lhs.expected b/plugins/hls-eval-plugin/test/testdata/TLHS.lhs.expected similarity index 100% rename from test/testdata/eval/TLHS.lhs.expected rename to plugins/hls-eval-plugin/test/testdata/TLHS.lhs.expected diff --git a/test/testdata/eval/TLHSLaTeX.lhs b/plugins/hls-eval-plugin/test/testdata/TLHSLaTeX.lhs similarity index 100% rename from test/testdata/eval/TLHSLaTeX.lhs rename to plugins/hls-eval-plugin/test/testdata/TLHSLaTeX.lhs diff --git a/test/testdata/eval/TLHSLateX.lhs.expected b/plugins/hls-eval-plugin/test/testdata/TLHSLateX.lhs.expected similarity index 100% rename from test/testdata/eval/TLHSLateX.lhs.expected rename to plugins/hls-eval-plugin/test/testdata/TLHSLateX.lhs.expected diff --git a/test/testdata/eval/TLanguageOptions.hs b/plugins/hls-eval-plugin/test/testdata/TLanguageOptions.hs similarity index 100% rename from test/testdata/eval/TLanguageOptions.hs rename to plugins/hls-eval-plugin/test/testdata/TLanguageOptions.hs diff --git a/test/testdata/eval/TLanguageOptions.hs.expected b/plugins/hls-eval-plugin/test/testdata/TLanguageOptions.hs.expected similarity index 100% rename from test/testdata/eval/TLanguageOptions.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TLanguageOptions.hs.expected diff --git a/test/testdata/eval/TLanguageOptionsTupleSections.hs b/plugins/hls-eval-plugin/test/testdata/TLanguageOptionsTupleSections.hs similarity index 100% rename from test/testdata/eval/TLanguageOptionsTupleSections.hs rename to plugins/hls-eval-plugin/test/testdata/TLanguageOptionsTupleSections.hs diff --git a/test/testdata/eval/TLanguageOptionsTupleSections.hs.expected b/plugins/hls-eval-plugin/test/testdata/TLanguageOptionsTupleSections.hs.expected similarity index 100% rename from test/testdata/eval/TLanguageOptionsTupleSections.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TLanguageOptionsTupleSections.hs.expected diff --git a/test/testdata/eval/TLocalImport.hs b/plugins/hls-eval-plugin/test/testdata/TLocalImport.hs similarity index 100% rename from test/testdata/eval/TLocalImport.hs rename to plugins/hls-eval-plugin/test/testdata/TLocalImport.hs diff --git a/test/testdata/eval/TLocalImport.hs.expected b/plugins/hls-eval-plugin/test/testdata/TLocalImport.hs.expected similarity index 100% rename from test/testdata/eval/TLocalImport.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TLocalImport.hs.expected diff --git a/test/testdata/eval/TLocalImportInTest.hs b/plugins/hls-eval-plugin/test/testdata/TLocalImportInTest.hs similarity index 100% rename from test/testdata/eval/TLocalImportInTest.hs rename to plugins/hls-eval-plugin/test/testdata/TLocalImportInTest.hs diff --git a/test/testdata/eval/TLocalImportInTest.hs.expected b/plugins/hls-eval-plugin/test/testdata/TLocalImportInTest.hs.expected similarity index 100% rename from test/testdata/eval/TLocalImportInTest.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TLocalImportInTest.hs.expected diff --git a/test/testdata/eval/TMulti.hs b/plugins/hls-eval-plugin/test/testdata/TMulti.hs similarity index 100% rename from test/testdata/eval/TMulti.hs rename to plugins/hls-eval-plugin/test/testdata/TMulti.hs diff --git a/test/testdata/eval/TMulti.hs.expected b/plugins/hls-eval-plugin/test/testdata/TMulti.hs.expected similarity index 100% rename from test/testdata/eval/TMulti.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TMulti.hs.expected diff --git a/test/testdata/eval/TPlainComment.hs b/plugins/hls-eval-plugin/test/testdata/TPlainComment.hs similarity index 100% rename from test/testdata/eval/TPlainComment.hs rename to plugins/hls-eval-plugin/test/testdata/TPlainComment.hs diff --git a/test/testdata/eval/TPlainComment.hs.expected b/plugins/hls-eval-plugin/test/testdata/TPlainComment.hs.expected similarity index 100% rename from test/testdata/eval/TPlainComment.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TPlainComment.hs.expected diff --git a/test/testdata/eval/TPrelude.hs b/plugins/hls-eval-plugin/test/testdata/TPrelude.hs similarity index 100% rename from test/testdata/eval/TPrelude.hs rename to plugins/hls-eval-plugin/test/testdata/TPrelude.hs diff --git a/test/testdata/eval/TPrelude.hs.expected b/plugins/hls-eval-plugin/test/testdata/TPrelude.hs.expected similarity index 100% rename from test/testdata/eval/TPrelude.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TPrelude.hs.expected diff --git a/test/testdata/eval/TProperty.hs b/plugins/hls-eval-plugin/test/testdata/TProperty.hs similarity index 100% rename from test/testdata/eval/TProperty.hs rename to plugins/hls-eval-plugin/test/testdata/TProperty.hs diff --git a/test/testdata/eval/TProperty.hs.expected b/plugins/hls-eval-plugin/test/testdata/TProperty.hs.expected similarity index 100% rename from test/testdata/eval/TProperty.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TProperty.hs.expected diff --git a/test/testdata/eval/TSectionEval.hs b/plugins/hls-eval-plugin/test/testdata/TSectionEval.hs similarity index 100% rename from test/testdata/eval/TSectionEval.hs rename to plugins/hls-eval-plugin/test/testdata/TSectionEval.hs diff --git a/test/testdata/eval/TSectionEval.hs.expected b/plugins/hls-eval-plugin/test/testdata/TSectionEval.hs.expected similarity index 100% rename from test/testdata/eval/TSectionEval.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TSectionEval.hs.expected diff --git a/test/testdata/eval/TSetup.hs b/plugins/hls-eval-plugin/test/testdata/TSetup.hs similarity index 100% rename from test/testdata/eval/TSetup.hs rename to plugins/hls-eval-plugin/test/testdata/TSetup.hs diff --git a/test/testdata/eval/TSetup.hs.expected b/plugins/hls-eval-plugin/test/testdata/TSetup.hs.expected similarity index 100% rename from test/testdata/eval/TSetup.hs.expected rename to plugins/hls-eval-plugin/test/testdata/TSetup.hs.expected diff --git a/test/testdata/eval/Util.hs b/plugins/hls-eval-plugin/test/testdata/Util.hs similarity index 100% rename from test/testdata/eval/Util.hs rename to plugins/hls-eval-plugin/test/testdata/Util.hs diff --git a/test/testdata/eval/cabal.project b/plugins/hls-eval-plugin/test/testdata/cabal.project similarity index 100% rename from test/testdata/eval/cabal.project rename to plugins/hls-eval-plugin/test/testdata/cabal.project diff --git a/test/testdata/eval/hie-cabal.yaml b/plugins/hls-eval-plugin/test/testdata/hie-cabal.yaml similarity index 100% rename from test/testdata/eval/hie-cabal.yaml rename to plugins/hls-eval-plugin/test/testdata/hie-cabal.yaml diff --git a/test/testdata/eval/hie-stack.yaml b/plugins/hls-eval-plugin/test/testdata/hie-stack.yaml similarity index 100% rename from test/testdata/eval/hie-stack.yaml rename to plugins/hls-eval-plugin/test/testdata/hie-stack.yaml diff --git a/test/testdata/eval/hie.yaml b/plugins/hls-eval-plugin/test/testdata/hie.yaml similarity index 100% rename from test/testdata/eval/hie.yaml rename to plugins/hls-eval-plugin/test/testdata/hie.yaml diff --git a/test/testdata/eval/stack.yaml b/plugins/hls-eval-plugin/test/testdata/stack.yaml similarity index 100% rename from test/testdata/eval/stack.yaml rename to plugins/hls-eval-plugin/test/testdata/stack.yaml diff --git a/test/testdata/eval/test.cabal b/plugins/hls-eval-plugin/test/testdata/test.cabal similarity index 100% rename from test/testdata/eval/test.cabal rename to plugins/hls-eval-plugin/test/testdata/test.cabal diff --git a/shell.nix b/shell.nix index 68851af9b0..152ae6b700 100644 --- a/shell.nix +++ b/shell.nix @@ -30,6 +30,7 @@ let defaultCompiler = "ghc" + lib.replaceStrings ["."] [""] haskellPackages.ghc. p.hie-compat p.hls-plugin-api p.hls-class-plugin + p.hls-eval-plugin p.hls-explicit-imports-plugin p.hls-hlint-plugin p.hls-retrie-plugin diff --git a/stack-8.10.1.yaml b/stack-8.10.1.yaml index 978dfd883a..dce21d958c 100644 --- a/stack-8.10.1.yaml +++ b/stack-8.10.1.yaml @@ -7,6 +7,7 @@ packages: # - ./shake-bench - ./hls-plugin-api - ./plugins/hls-class-plugin +- ./plugins/hls-eval-plugin - ./plugins/hls-explicit-imports-plugin - ./plugins/hls-hlint-plugin - ./plugins/hls-retrie-plugin @@ -16,30 +17,30 @@ ghc-options: "$everything": -haddock extra-deps: -- brittany-0.13.1.0 -- Cabal-3.0.2.0 -- clock-0.7.2 -- data-tree-print-0.1.0.2@rev:2 -- floskell-0.10.4 -- fourmolu-0.3.0.0 -- ghc-lib-8.10.2.20200916 -- ghc-lib-parser-8.10.2.20200916 -- heapsize-0.3.0 -- hie-bios-0.7.1 -- hlint-3.2.3 -- HsYAML-aeson-0.2.0.0@rev:2 -- implicit-hie-cradle-0.3.0.2 -- implicit-hie-0.1.2.5 -- lsp-test-0.11.0.6 -- monad-dijkstra-0.1.1.2 -- opentelemetry-0.6.1 -- opentelemetry-extra-0.6.1 -- ormolu-0.1.4.1 -- refinery-0.3.0.0 -- retrie-0.1.1.1 -- stylish-haskell-0.12.2.0 -- semigroups-0.18.5 -- temporary-1.2.1.1 + - brittany-0.13.1.0 + - Cabal-3.0.2.0 + - clock-0.7.2 + - data-tree-print-0.1.0.2@rev:2 + - floskell-0.10.4 + - fourmolu-0.3.0.0 + - ghc-lib-8.10.2.20200916 + - ghc-lib-parser-8.10.2.20200916 + - heapsize-0.3.0 + - hie-bios-0.7.1 + - hlint-3.2.3 + - HsYAML-aeson-0.2.0.0@rev:2 + - implicit-hie-cradle-0.3.0.2 + - implicit-hie-0.1.2.5 + - lsp-test-0.11.0.6 + - monad-dijkstra-0.1.1.2 + - opentelemetry-0.6.1 + - opentelemetry-extra-0.6.1 + - ormolu-0.1.4.1 + - refinery-0.3.0.0 + - retrie-0.1.1.1 + - stylish-haskell-0.12.2.0 + - semigroups-0.18.5 + - temporary-1.2.1.1 configure-options: ghcide: @@ -56,6 +57,6 @@ flags: BuildExecutable: false nix: - packages: [ icu libcxx zlib ] + packages: [icu libcxx zlib] concurrent-tests: false diff --git a/stack-8.10.2.yaml b/stack-8.10.2.yaml index 7e0b778694..9bd09b6cd9 100644 --- a/stack-8.10.2.yaml +++ b/stack-8.10.2.yaml @@ -1,45 +1,46 @@ resolver: nightly-2020-12-09 packages: -- . -- ./hie-compat -- ./ghcide/ -- ./hls-plugin-api -# - ./shake-bench -- ./plugins/hls-class-plugin -- ./plugins/hls-explicit-imports-plugin -- ./plugins/hls-hlint-plugin -- ./plugins/hls-retrie-plugin -- ./plugins/tactics + - . + - ./hie-compat + - ./ghcide/ + - ./hls-plugin-api + # - ./shake-bench + - ./plugins/hls-class-plugin + - ./plugins/hls-eval-plugin + - ./plugins/hls-explicit-imports-plugin + - ./plugins/hls-hlint-plugin + - ./plugins/hls-retrie-plugin + - ./plugins/tactics ghc-options: "$everything": -haddock extra-deps: -- brittany-0.13.1.0 -- Cabal-3.0.2.0 -- clock-0.7.2 -- data-tree-print-0.1.0.2@rev:2 -- floskell-0.10.4 -- fourmolu-0.3.0.0 -- heapsize-0.3.0 -- implicit-hie-cradle-0.3.0.2 -- implicit-hie-0.1.2.5 -- lsp-test-0.11.0.6 -- monad-dijkstra-0.1.1.2 -- refinery-0.3.0.0 -- retrie-0.1.1.1 -- stylish-haskell-0.12.2.0 -- semigroups-0.18.5 -- temporary-1.2.1.1 + - brittany-0.13.1.0 + - Cabal-3.0.2.0 + - clock-0.7.2 + - data-tree-print-0.1.0.2@rev:2 + - floskell-0.10.4 + - fourmolu-0.3.0.0 + - heapsize-0.3.0 + - implicit-hie-cradle-0.3.0.2 + - implicit-hie-0.1.2.5 + - lsp-test-0.11.0.6 + - monad-dijkstra-0.1.1.2 + - refinery-0.3.0.0 + - retrie-0.1.1.1 + - stylish-haskell-0.12.2.0 + - semigroups-0.18.5 + - temporary-1.2.1.1 configure-options: ghcide: - - --disable-library-for-ghci + - --disable-library-for-ghci haskell-language-server: - - --disable-library-for-ghci + - --disable-library-for-ghci heapsize: - - --disable-library-for-ghci + - --disable-library-for-ghci flags: haskell-language-server: @@ -48,6 +49,6 @@ flags: BuildExecutable: false nix: - packages: [ icu libcxx zlib ] + packages: [icu libcxx zlib] concurrent-tests: false diff --git a/stack-8.6.4.yaml b/stack-8.6.4.yaml index f70faab22a..0bea9434e9 100644 --- a/stack-8.6.4.yaml +++ b/stack-8.6.4.yaml @@ -8,6 +8,7 @@ packages: # - ./shake-bench - ./hls-plugin-api - ./plugins/hls-class-plugin + - ./plugins/hls-eval-plugin - ./plugins/hls-explicit-imports-plugin - ./plugins/hls-hlint-plugin - ./plugins/hls-retrie-plugin @@ -80,7 +81,6 @@ extra-deps: - with-utf8-1.0.2.1@sha256:95c02fffa643ddbeb092359802a512007c3e644cd509809f4716ad54592c437b,3057 - th-env-0.1.0.2@sha256:d8f1f37f42a8f1a22404d7d0579528af18f5dac7232cca6bdbd5117c115a0ad5,1370 - flags: haskell-language-server: pedantic: true diff --git a/stack-8.6.5.yaml b/stack-8.6.5.yaml index c16d891e46..5d6b9c4cef 100644 --- a/stack-8.6.5.yaml +++ b/stack-8.6.5.yaml @@ -5,8 +5,9 @@ packages: - ./hie-compat - ./ghcide/ - ./hls-plugin-api -# - ./shake-bench + # - ./shake-bench - ./plugins/hls-class-plugin + - ./plugins/hls-eval-plugin - ./plugins/hls-explicit-imports-plugin - ./plugins/hls-hlint-plugin - ./plugins/hls-retrie-plugin @@ -81,11 +82,11 @@ extra-deps: configure-options: ghcide: - - --disable-library-for-ghci + - --disable-library-for-ghci haskell-language-server: - - --disable-library-for-ghci + - --disable-library-for-ghci heapsize: - - --disable-library-for-ghci + - --disable-library-for-ghci flags: haskell-language-server: diff --git a/stack-8.8.2.yaml b/stack-8.8.2.yaml index feb54527d6..31febdf7ee 100644 --- a/stack-8.8.2.yaml +++ b/stack-8.8.2.yaml @@ -7,6 +7,7 @@ packages: - ./hls-plugin-api - ./shake-bench - ./plugins/hls-class-plugin + - ./plugins/hls-eval-plugin - ./plugins/hls-explicit-imports-plugin - ./plugins/hls-hlint-plugin - ./plugins/hls-retrie-plugin diff --git a/stack-8.8.3.yaml b/stack-8.8.3.yaml index b187c4296d..e15283d988 100644 --- a/stack-8.8.3.yaml +++ b/stack-8.8.3.yaml @@ -1,66 +1,67 @@ resolver: lts-16.11 # Last 8.8.3 packages: -- . -- ./hie-compat -- ./ghcide/ -- ./shake-bench -- ./hls-plugin-api -- ./plugins/hls-class-plugin -- ./plugins/hls-explicit-imports-plugin -- ./plugins/hls-hlint-plugin -- ./plugins/hls-retrie-plugin -- ./plugins/tactics + - . + - ./hie-compat + - ./ghcide/ + - ./shake-bench + - ./hls-plugin-api + - ./plugins/hls-class-plugin + - ./plugins/hls-eval-plugin + - ./plugins/hls-explicit-imports-plugin + - ./plugins/hls-hlint-plugin + - ./plugins/hls-retrie-plugin + - ./plugins/tactics ghc-options: "$everything": -haddock extra-deps: -- aeson-1.5.2.0 -- apply-refact-0.8.2.1 -- brittany-0.13.1.0 -- bytestring-trie-0.2.5.0 -- cabal-plan-0.6.2.0 -- clock-0.7.2 -- constrained-dynamic-0.1.0.0 -- extra-1.7.3 -- floskell-0.10.4 -- fourmolu-0.3.0.0 -# - ghcide-0.6.0 -- ghc-exactprint-0.6.3.2 -- ghc-lib-8.10.2.20200916 -- ghc-lib-parser-8.10.2.20200916 -- ghc-trace-events-0.1.2.1 -- haskell-src-exts-1.21.1 -- heapsize-0.3.0 -- hie-bios-0.7.1 -- hlint-3.2.3 -- HsYAML-aeson-0.2.0.0@rev:2 -- hoogle-5.0.17.11 -- hsimport-0.11.0 -- ilist-0.3.1.0 -- implicit-hie-cradle-0.3.0.2 -- implicit-hie-0.1.2.5 -- lsp-test-0.11.0.6 -- monad-dijkstra-0.1.1.2 -- opentelemetry-0.6.1 -- opentelemetry-extra-0.6.1 -- ormolu-0.1.4.1 -- refinery-0.3.0.0 -- retrie-0.1.1.1 -- semigroups-0.18.5 -# - github: wz1000/shake -# commit: fb3859dca2e54d1bbb2c873e68ed225fa179fbef -- stylish-haskell-0.12.2.0 -- temporary-1.2.1.1 + - aeson-1.5.2.0 + - apply-refact-0.8.2.1 + - brittany-0.13.1.0 + - bytestring-trie-0.2.5.0 + - cabal-plan-0.6.2.0 + - clock-0.7.2 + - constrained-dynamic-0.1.0.0 + - extra-1.7.3 + - floskell-0.10.4 + - fourmolu-0.3.0.0 + # - ghcide-0.6.0 + - ghc-exactprint-0.6.3.2 + - ghc-lib-8.10.2.20200916 + - ghc-lib-parser-8.10.2.20200916 + - ghc-trace-events-0.1.2.1 + - haskell-src-exts-1.21.1 + - heapsize-0.3.0 + - hie-bios-0.7.1 + - hlint-3.2.3 + - HsYAML-aeson-0.2.0.0@rev:2 + - hoogle-5.0.17.11 + - hsimport-0.11.0 + - ilist-0.3.1.0 + - implicit-hie-cradle-0.3.0.2 + - implicit-hie-0.1.2.5 + - lsp-test-0.11.0.6 + - monad-dijkstra-0.1.1.2 + - opentelemetry-0.6.1 + - opentelemetry-extra-0.6.1 + - ormolu-0.1.4.1 + - refinery-0.3.0.0 + - retrie-0.1.1.1 + - semigroups-0.18.5 + # - github: wz1000/shake + # commit: fb3859dca2e54d1bbb2c873e68ed225fa179fbef + - stylish-haskell-0.12.2.0 + - temporary-1.2.1.1 configure-options: ghcide: - - --disable-library-for-ghci + - --disable-library-for-ghci haskell-language-server: - - --disable-library-for-ghci + - --disable-library-for-ghci heapsize: - - --disable-library-for-ghci + - --disable-library-for-ghci flags: haskell-language-server: @@ -71,6 +72,6 @@ flags: # allow-newer: true nix: - packages: [ icu libcxx zlib ] + packages: [icu libcxx zlib] concurrent-tests: false diff --git a/stack-8.8.4.yaml b/stack-8.8.4.yaml index ea9f3ce40a..9674f767cb 100644 --- a/stack-8.8.4.yaml +++ b/stack-8.8.4.yaml @@ -1,62 +1,63 @@ resolver: lts-16.25 packages: -- . -- ./hie-compat -- ./ghcide/ -- ./shake-bench -- ./hls-plugin-api -- ./plugins/hls-class-plugin -- ./plugins/hls-explicit-imports-plugin -- ./plugins/hls-hlint-plugin -- ./plugins/hls-retrie-plugin -- ./plugins/tactics + - . + - ./hie-compat + - ./ghcide/ + - ./shake-bench + - ./hls-plugin-api + - ./plugins/hls-class-plugin + - ./plugins/hls-eval-plugin + - ./plugins/hls-explicit-imports-plugin + - ./plugins/hls-hlint-plugin + - ./plugins/hls-retrie-plugin + - ./plugins/tactics ghc-options: "$everything": -haddock extra-deps: -- aeson-1.5.2.0 -- apply-refact-0.8.2.1 -- brittany-0.13.1.0 -- bytestring-trie-0.2.5.0 -- cabal-plan-0.6.2.0 -- clock-0.7.2 -- constrained-dynamic-0.1.0.0 -- floskell-0.10.4 -- fourmolu-0.3.0.0 -# - ghcide-0.6.0 -- ghc-exactprint-0.6.3.2 -- ghc-trace-events-0.1.2.1 -- haskell-src-exts-1.21.1 -- heapsize-0.3.0 -- hie-bios-0.7.1 -- hlint-3.2.3 -- HsYAML-aeson-0.2.0.0@rev:2 -- hoogle-5.0.17.11 -- hsimport-0.11.0 -- ilist-0.3.1.0 -- implicit-hie-cradle-0.3.0.2 -- implicit-hie-0.1.2.5 -- lsp-test-0.11.0.6 -- monad-dijkstra-0.1.1.2 -- opentelemetry-0.6.1 -- opentelemetry-extra-0.6.1 -- refinery-0.3.0.0 -- retrie-0.1.1.1 -- semigroups-0.18.5 -# - github: wz1000/shake -# commit: fb3859dca2e54d1bbb2c873e68ed225fa179fbef -- stylish-haskell-0.12.2.0 -- temporary-1.2.1.1 + - aeson-1.5.2.0 + - apply-refact-0.8.2.1 + - brittany-0.13.1.0 + - bytestring-trie-0.2.5.0 + - cabal-plan-0.6.2.0 + - clock-0.7.2 + - constrained-dynamic-0.1.0.0 + - floskell-0.10.4 + - fourmolu-0.3.0.0 + # - ghcide-0.6.0 + - ghc-exactprint-0.6.3.2 + - ghc-trace-events-0.1.2.1 + - haskell-src-exts-1.21.1 + - heapsize-0.3.0 + - hie-bios-0.7.1 + - hlint-3.2.3 + - HsYAML-aeson-0.2.0.0@rev:2 + - hoogle-5.0.17.11 + - hsimport-0.11.0 + - ilist-0.3.1.0 + - implicit-hie-cradle-0.3.0.2 + - implicit-hie-0.1.2.5 + - lsp-test-0.11.0.6 + - monad-dijkstra-0.1.1.2 + - opentelemetry-0.6.1 + - opentelemetry-extra-0.6.1 + - refinery-0.3.0.0 + - retrie-0.1.1.1 + - semigroups-0.18.5 + # - github: wz1000/shake + # commit: fb3859dca2e54d1bbb2c873e68ed225fa179fbef + - stylish-haskell-0.12.2.0 + - temporary-1.2.1.1 configure-options: ghcide: - - --disable-library-for-ghci + - --disable-library-for-ghci haskell-language-server: - - --disable-library-for-ghci + - --disable-library-for-ghci heapsize: - - --disable-library-for-ghci + - --disable-library-for-ghci flags: haskell-language-server: @@ -67,6 +68,6 @@ flags: # allow-newer: true nix: - packages: [ icu libcxx zlib ] + packages: [icu libcxx zlib] concurrent-tests: false diff --git a/stack.yaml b/stack.yaml index 11822b61f8..96394c505e 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,81 +1,84 @@ resolver: lts-14.27 # Last 8.6.5 packages: -- . -- ./hie-compat -- ./ghcide -- ./shake-bench -- ./hls-plugin-api -- ./plugins/hls-class-plugin -- ./plugins/hls-explicit-imports-plugin -- ./plugins/hls-hlint-plugin -- ./plugins/hls-retrie-plugin -- ./plugins/tactics + - . + - ./hie-compat + - ./ghcide + - ./shake-bench + - ./hls-plugin-api + - ./plugins/hls-class-plugin + - ./plugins/hls-eval-plugin + - ./plugins/hls-explicit-imports-plugin + - ./plugins/hls-hlint-plugin + - ./plugins/hls-retrie-plugin + - ./plugins/tactics ghc-options: "$everything": -haddock extra-deps: -- aeson-1.5.2.0 -- apply-refact-0.8.2.1 -- ansi-terminal-0.10.3 -- base-compat-0.10.5 -- brittany-0.13.1.0 -- butcher-1.3.3.1 -- Cabal-3.0.2.0 -- cabal-plan-0.6.2.0 -- clock-0.7.2 -- Diff-0.4.0 -- extra-1.7.3 -- floskell-0.10.4 -- fourmolu-0.3.0.0 -- fuzzy-0.1.0.0 -# - ghcide-0.6.0 -- ghc-check-0.5.0.1 -- ghc-exactprint-0.6.3.2 -- ghc-events-0.13.0 -- ghc-lib-8.10.2.20200916 -- ghc-lib-parser-8.10.2.20200916 -- ghc-lib-parser-ex-8.10.0.16 -- ghc-source-gen-0.4.0.0 -- ghc-trace-events-0.1.2.1 -- haddock-api-2.22.0@rev:1 -- haddock-library-1.8.0 -- hashable-1.3.0.0 -- haskell-lsp-0.22.0.0 -- haskell-lsp-types-0.22.0.0 -- heapsize-0.3.0 -- hie-bios-0.7.1 -- hlint-3.2 -- HsYAML-0.2.1.0@rev:1 -- HsYAML-aeson-0.2.0.0@rev:2 -- implicit-hie-cradle-0.3.0.2 -- implicit-hie-0.1.2.5 -- indexed-profunctors-0.1 -- lens-4.18 -- lsp-test-0.11.0.6 -- monad-dijkstra-0.1.1.2 -- opentelemetry-0.6.1 -- opentelemetry-extra-0.6.1 -- optics-core-0.2 -- optparse-applicative-0.15.1.0 -- ormolu-0.1.4.1 -- parser-combinators-1.2.1 -- primitive-0.7.1.0 -- refinery-0.3.0.0 -- regex-base-0.94.0.0 -- regex-pcre-builtin-0.95.1.1.8.43 -- regex-tdfa-1.3.1.0 -- retrie-0.1.1.1 -- semialign-1.1 -# - github: wz1000/shake -# commit: fb3859dca2e54d1bbb2c873e68ed225fa179fbef -- stylish-haskell-0.12.2.0 -- tasty-rerun-1.1.17 -- temporary-1.2.1.1 -- these-1.1.1.1 -- type-equality-1 -- topograph-1 + - aeson-1.5.2.0 + - apply-refact-0.8.2.1 + - ansi-terminal-0.10.3 + - base-compat-0.10.5 + - brittany-0.13.1.0 + - butcher-1.3.3.1 + - Cabal-3.0.2.0 + - cabal-plan-0.6.2.0 + - clock-0.7.2 + - Diff-0.4.0 + - extra-1.7.3 + - floskell-0.10.4 + - fourmolu-0.3.0.0 + - fuzzy-0.1.0.0 + # - ghcide-0.1.0 + - ghc-check-0.5.0.1 + - ghc-events-0.13.0 + - ghc-exactprint-0.6.3.2 + - ghc-lib-8.10.2.20200916 + - ghc-lib-parser-8.10.2.20200916 + - ghc-lib-parser-ex-8.10.0.16 + - ghc-source-gen-0.4.0.0 + - ghc-trace-events-0.1.2.1 + - haddock-api-2.22.0@rev:1 + - haddock-library-1.8.0 + - hashable-1.3.0.0 + - haskell-lsp-0.22.0.0 + - haskell-lsp-types-0.22.0.0 + - heapsize-0.3.0 + - hie-bios-0.7.1 + - hlint-3.2.3 + - HsYAML-0.2.1.0@rev:1 + - HsYAML-aeson-0.2.0.0@rev:2 + - implicit-hie-cradle-0.3.0.2 + - implicit-hie-0.1.2.5 + - indexed-profunctors-0.1 + - lens-4.18 + - lsp-test-0.11.0.6 + - monad-dijkstra-0.1.1.2 + - opentelemetry-0.6.1 + - opentelemetry-extra-0.6.1 + - optics-core-0.2 + - optparse-applicative-0.15.1.0 + - ormolu-0.1.4.1 + - parser-combinators-1.2.1 + - primitive-0.7.1.0 + - refinery-0.3.0.0 + - regex-base-0.94.0.0 + - regex-pcre-builtin-0.95.1.1.8.43 + - regex-tdfa-1.3.1.0 + - retrie-0.1.1.1 + - semialign-1.1 + # - github: wz1000/shake + # commit: fb3859dca2e54d1bbb2c873e68ed225fa179fbef + - stylish-haskell-0.12.2.0 + - tasty-rerun-1.1.17 + - temporary-1.2.1.1 + - these-1.1.1.1 + - type-equality-1 + - topograph-1 + - with-utf8-1.0.2.1@sha256:95c02fffa643ddbeb092359802a512007c3e644cd509809f4716ad54592c437b,3057 + - th-env-0.1.0.2@sha256:d8f1f37f42a8f1a22404d7d0579528af18f5dac7232cca6bdbd5117c115a0ad5,1370 flags: haskell-language-server: @@ -85,11 +88,11 @@ flags: configure-options: ghcide: - - --disable-library-for-ghci + - --disable-library-for-ghci haskell-language-server: - - --disable-library-for-ghci + - --disable-library-for-ghci heapsize: - - --disable-library-for-ghci + - --disable-library-for-ghci # allow-newer: true diff --git a/test/functional/Progress.hs b/test/functional/Progress.hs index 32abd30c91..021e7d2a99 100644 --- a/test/functional/Progress.hs +++ b/test/functional/Progress.hs @@ -1,21 +1,22 @@ -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} + module Progress (tests) where import Control.Applicative.Combinators import Control.Lens hiding ((.=)) import Control.Monad.IO.Class -import Data.Aeson (encode, decode, object, toJSON, Value, (.=)) +import Data.Aeson (Value, decode, encode, object, toJSON, (.=)) import Data.Default -import Data.Maybe (fromJust) import Data.List (delete) +import Data.Maybe (fromJust) import Data.Text (Text, pack) import Ide.Plugin.Config import Language.Haskell.LSP.Test import Language.Haskell.LSP.Types -import qualified Language.Haskell.LSP.Types.Lens as L import Language.Haskell.LSP.Types.Capabilities +import qualified Language.Haskell.LSP.Types.Lens as L import System.FilePath (()) import Test.Hls.Util import Test.Tasty @@ -23,83 +24,88 @@ import Test.Tasty.ExpectedFailure (ignoreTestBecause) import Test.Tasty.HUnit tests :: TestTree -tests = testGroup "window/workDoneProgress" [ - testCase "sends indefinite progress notifications" $ - runSession hlsCommand progressCaps "test/testdata" $ do - let path = "hlint" "ApplyRefact2.hs" - _ <- openDoc path "haskell" - expectProgressReports [pack ("Setting up hlint (for " ++ path ++ ")"), "Processing"] - , testCase "eval plugin sends progress reports" $ - runSession hlsCommand progressCaps "test/testdata/eval" $ do - doc <- openDoc "T1.hs" "haskell" - expectProgressReports ["Setting up eval (for T1.hs)", "Processing"] - [evalLens] <- getCodeLenses doc - let cmd = evalLens ^?! L.command . _Just - _ <- sendRequest WorkspaceExecuteCommand $ ExecuteCommandParams (cmd ^. L.command) (decode $ encode $ fromJust $ cmd ^. L.arguments) Nothing - expectProgressReports ["Evaluating"] - , testCase "ormolu plugin sends progress notifications" $ do - runSession hlsCommand progressCaps "test/testdata" $ do - sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu")) - doc <- openDoc "Format.hs" "haskell" - expectProgressReports ["Setting up testdata (for Format.hs)", "Processing"] - _ <- sendRequest TextDocumentFormatting $ DocumentFormattingParams doc (FormattingOptions 2 True) Nothing - expectProgressReports ["Formatting Format.hs"] - , testCase "fourmolu plugin sends progress notifications" $ do - runSession hlsCommand progressCaps "test/testdata" $ do - sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "fourmolu")) - doc <- openDoc "Format.hs" "haskell" - expectProgressReports ["Setting up testdata (for Format.hs)", "Processing"] - _ <- sendRequest TextDocumentFormatting $ DocumentFormattingParams doc (FormattingOptions 2 True) Nothing - expectProgressReports ["Formatting Format.hs"] - , ignoreTestBecause "no liquid Haskell support" $ - testCase "liquid haskell plugin sends progress notifications" $ do - runSession hlsCommand progressCaps "test/testdata" $ do - doc <- openDoc "liquid/Evens.hs" "haskell" - let config = def { liquidOn = True, hlintOn = False } - sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (toJSON config)) - sendNotification TextDocumentDidSave (DidSaveTextDocumentParams doc) - expectProgressReports ["Running Liquid Haskell on Evens.hs"] - ] +tests = + testGroup + "window/workDoneProgress" + [ testCase "sends indefinite progress notifications" $ + runSession hlsCommand progressCaps "test/testdata" $ do + let path = "hlint" "ApplyRefact2.hs" + _ <- openDoc path "haskell" + expectProgressReports [pack ("Setting up hlint (for " ++ path ++ ")"), "Processing"] + , testCase "eval plugin sends progress reports" $ + runSession hlsCommand progressCaps "plugins/hls-eval-plugin/test/testdata" $ do + doc <- openDoc "T1.hs" "haskell" + expectProgressReports ["Setting up testdata (for T1.hs)", "Processing"] + [evalLens] <- getCodeLenses doc + let cmd = evalLens ^?! L.command . _Just + _ <- sendRequest WorkspaceExecuteCommand $ ExecuteCommandParams (cmd ^. L.command) (decode $ encode $ fromJust $ cmd ^. L.arguments) Nothing + expectProgressReports ["Evaluating"] + , testCase "ormolu plugin sends progress notifications" $ do + runSession hlsCommand progressCaps "test/testdata" $ do + sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu")) + doc <- openDoc "Format.hs" "haskell" + expectProgressReports ["Setting up testdata (for Format.hs)", "Processing"] + _ <- sendRequest TextDocumentFormatting $ DocumentFormattingParams doc (FormattingOptions 2 True) Nothing + expectProgressReports ["Formatting Format.hs"] + , testCase "fourmolu plugin sends progress notifications" $ do + runSession hlsCommand progressCaps "test/testdata" $ do + sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "fourmolu")) + doc <- openDoc "Format.hs" "haskell" + expectProgressReports ["Setting up testdata (for Format.hs)", "Processing"] + _ <- sendRequest TextDocumentFormatting $ DocumentFormattingParams doc (FormattingOptions 2 True) Nothing + expectProgressReports ["Formatting Format.hs"] + , ignoreTestBecause "no liquid Haskell support" $ + testCase "liquid haskell plugin sends progress notifications" $ do + runSession hlsCommand progressCaps "test/testdata" $ do + doc <- openDoc "liquid/Evens.hs" "haskell" + let config = def{liquidOn = True, hlintOn = False} + sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (toJSON config)) + sendNotification TextDocumentDidSave (DidSaveTextDocumentParams doc) + expectProgressReports ["Running Liquid Haskell on Evens.hs"] + ] formatLspConfig :: Value -> Value -formatLspConfig provider = object [ "haskell" .= object ["formattingProvider" .= (provider :: Value)] ] +formatLspConfig provider = object ["haskell" .= object ["formattingProvider" .= (provider :: Value)]] progressCaps :: ClientCapabilities -progressCaps = fullCaps { _window = Just (WindowClientCapabilities (Just True)) } +progressCaps = fullCaps{_window = Just (WindowClientCapabilities (Just True))} -data CollectedProgressNotification = - CreateM WorkDoneProgressCreateRequest +data CollectedProgressNotification + = CreateM WorkDoneProgressCreateRequest | BeginM WorkDoneProgressBeginNotification | ProgressM WorkDoneProgressReportNotification | EndM WorkDoneProgressEndNotification --- | Test that the server is correctly producing a sequence of progress related --- messages. Each create must be pair with a corresponding begin and end, --- optionally with some progress in between. Tokens must match. The begin --- messages have titles describing the work that is in-progress, we check that --- the titles we see are those we expect. +{- | Test that the server is correctly producing a sequence of progress related + messages. Each create must be pair with a corresponding begin and end, + optionally with some progress in between. Tokens must match. The begin + messages have titles describing the work that is in-progress, we check that + the titles we see are those we expect. +-} expectProgressReports :: [Text] -> Session () expectProgressReports = expectProgressReports' [] - where expectProgressReports' [] [] = return () - expectProgressReports' tokens expectedTitles = do - skipManyTill anyMessage (create <|> begin <|> progress <|> end) - >>= \case - CreateM msg -> - expectProgressReports' (token msg : tokens) expectedTitles - BeginM msg -> do - liftIO $ title msg `expectElem` expectedTitles - liftIO $ token msg `expectElem` tokens - expectProgressReports' tokens (delete (title msg) expectedTitles) - ProgressM msg -> do - liftIO $ token msg `expectElem` tokens - expectProgressReports' tokens expectedTitles - EndM msg -> do - liftIO $ token msg `expectElem` tokens - expectProgressReports' (delete (token msg) tokens) expectedTitles - title msg = msg ^. L.params ^. L.value ^. L.title - token msg = msg ^. L.params ^. L.token - create = CreateM <$> message - begin = BeginM <$> message - progress = ProgressM <$> message - end = EndM <$> message - expectElem a as = a `elem` as @? "Unexpected " ++ show a + where + expectProgressReports' [] [] = return () + expectProgressReports' tokens expectedTitles = + do + skipManyTill anyMessage (create <|> begin <|> progress <|> end) + >>= \case + CreateM msg -> + expectProgressReports' (token msg : tokens) expectedTitles + BeginM msg -> do + liftIO $ title msg `expectElem` expectedTitles + liftIO $ token msg `expectElem` tokens + expectProgressReports' tokens (delete (title msg) expectedTitles) + ProgressM msg -> do + liftIO $ token msg `expectElem` tokens + expectProgressReports' tokens expectedTitles + EndM msg -> do + liftIO $ token msg `expectElem` tokens + expectProgressReports' (delete (token msg) tokens) expectedTitles + title msg = msg ^. L.params ^. L.value ^. L.title + token msg = msg ^. L.params ^. L.token + create = CreateM <$> message + begin = BeginM <$> message + progress = ProgressM <$> message + end = EndM <$> message + expectElem a as = a `elem` as @? "Unexpected " ++ show a