Commit Graph

53 Commits

Author SHA1 Message Date
Pepe Iborra
959db7b10b
Extract the benchmarking Shake rules to a standalone Cabal package (#941)
* [bench-hist] break down in rule functions

* Extract the benchmarking Shake rules to a shake-bench package

There's some room for reusing the rules used in the historic benchmarking suite
in other projects. This change makes that a bit easier and improves the
documentation and code structure.

The new structure is:
- lib:shake-bench - a Cabal library with functions to generate Shake rules
- ghcide:bench:benchHist - the ghcide instantiation of the above Shake rules

That's not to say that shake-bench is completely decoupled from ghcide -
there are still plenty of assumptions on how the benchmarks are organized, their
outputs, etc. But with a little bit of effort, it should be easy to make
these rules more reusable

* Fix nix build

* Fix license

* hlints and redundant imports

* more hlints

* Exclude shake-bench from the stack build
2020-12-07 15:03:15 +00:00
Pepe Iborra
e24a744a06
Opentelemetry traces and heapsize memory analysis (#922)
* Move tracing functions to own module

* Bump opentelemetry to 0.6.0

* Write Values map size to OpenTelemetry metric

* Trace all requests and notifications

Instead of doing it in `HoverDefinition`, do it in
with{Response,Notification,...}. These wrap all handlers, so this should
cover everything. It also means that the span covers the entire
processing time for the request, where before we missed the setup
happening in the with* functions.

* Add flag for OpenTelemetry profiling

Run GC regularly with --ot-profiling

* Add flag to enable OT profiling in benchmark

* Use heapsize instead of ghc-datasize

I renamed the fork to distringuish from the original.
It is still being pulled from git using stack. This will be addressed
once I can push the fork to hackage.

* Bump opentelemetry to 0.6.1 - fixes 8.6 build

* Use heapsize from hackage

* Address HLint messages

* Record size of each key independently

* Refactor `startTelemetry` function

* Remove delay between measuring memory loops

* Each key in values map gets own OT instrument

* Measure values map length more rarely

* Rename --ot-profiling to --ot-memory-profiling

* Add docs for how to use the opentelemetry output

* Add instructions to build release version of tracy

* Clarify dependencies in opentelemetry instructions

* Fix LSP traces

* otTraced: delete unused

* Extract types out of D.IDE.Core.Shake

to avoid circular module dependencies

* Extract startTelemetry out of D.IDE.Shake and upgrade to 0.2

No more segfaults

* [nix] install opentelemetry

* [nix] install tracy

* Fix merge wibble

* Measure recursive sizes with sharing

* Sort keys for cost attribution

* Remove debug traces

* Allocate less, group keys, clean up hlints

* Add -A4G to the flags used for --ot-memory-profiling

* Modularize D.IDE.Core.Tracing

I want to reuse this code more directly in the non lsp driver

* Direct driver: report closure sizes when --ot-memory-profiling

An eventlog memory analysis doesnt' seem so relevant since this mode is not
interactive, but we could easily produce both if wanted to

* Everything is reachable from GhcSessionIO, so compute it last

I suspect the ShakeExtras record is reachable from GhcSessionIO

* bound recursion and use logger

* hlint suggestions

* Fix 8.6 build

* Format imports

* Do the memory analysis with full sharing. GhcSessionIO last

* Fail fast in the memory analysis

* error handling

* runHeapsize now takes initSize as an input argument

* Trace Shake sessions

* Reduced frequency for sampling values length

* Drop the -fexternal-interpreter flag in the Windows stack build

* Produce more benchmark artifacts

* Fix stack descriptors to use heapsize-0.2 from Hackage

* Bump to heapsize-0.3.0

* Record completions snippets (#900)

* Add field for RecordSnippets to CachcedCompletion

* Initial version of local record snippets

* Supprt record snippet completion for non local declarations.

* Better integration of local completions with current implementation

* Clean up non-local completions.

* Remove commented code.

* Switch from String to Text

* Remove ununsed definition

* Treat only Records and leave other defintions as is.

* Differentiate Records from Data constructors for external declaration

* Update test to include snippet in local record completions expected list.

* Update completionTest to also compare insertText.

* Add test for record snippet completion for imported records.

* Hlint fixes

* Hlint fixes

* Hlint suggestions.

* Update type.

* Consolidate imports

* Unpack tuple with explicit names

* Idiomatic changes

* Remove unused variable

* Better variable name

* Hlint suggestions

* Handle exhaustive pattern warning

* Add _ to snippet field name suggestions

* Remove type information passed around but not used

* Update to list comprehension style

* Eliminate intermediate function

* HLint suggestions.

* Idiomatic list comprehension

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

* [nix] use gitignore.nix (#920)

* Ignore import list while producing completions (#919)

* Drop any items in explicit import list

* Test if imports not included in explicit list show up in completions

* Update README.md (#924)

* Custom cradle loading (#928)

When using ghcide as a library, it may be desirable to host the hie.yaml file
in a location other than the project root, or even avoid the file system altogether

* Favor `lookupPathToId` over `pathToId` (#926)

* Favor `lookupPathToId` over `pathToId`

* Fix `typecheckParentsAction`

* Fix `needsCompilationRule`

* Return completion snippets only when client supports it (#929)

* Use the real client capabilities on completions

* Return completion snippets only when supported by the client

Restored from https://github.com/haskell/ghcide/pull/900

* Redundant import

* Fix stack windows build

Co-authored-by: Michalis Pardalos <m.pardalos@gmail.com>
Co-authored-by: Michalis Pardalos <mpardalos@gmail.com>
Co-authored-by: Guru Devanla <gdevanla@users.noreply.github.com>
Co-authored-by: Samuel Ainsworth <skainsworth@gmail.com>
2020-12-05 17:44:17 +00:00
Avi Dessauer
42901e39f7
Simplify and Bump implicit-hie version constraints (#933) 2020-12-04 18:10:16 +01:00
Javier Neira
a345e11aa3
Remove allow-newer (#908) 2020-11-16 22:50:33 +01:00
Pepe Iborra
03e89d9b47
GitHub test action (#903)
* Add github test action

* Disable unreliable test

Does not work reliably on all platforms.

Reenable when #861 lands

* Add hlint and -Werror

* Explicit timeout

6h is the default and also the maximum:

https://docs.github.com/en/free-pro-team@latest/actions/reference/usage-limits-billing-and-administration

* Experiment tests to use Cabal instead of Stack

* Fix an unreliable test

* Trim down matrix

* Add ghc-lib to the test matrix

* Address broken hie-compat ghc-lib build

* Drop stack descriptor family

We keep two stack descriptors:

- One for Nightly
- One for Windows (stuck in GHC 8.10.1)

To ensure that `stack test` doesn't break, we keep running the stack tests in CI

* Update README to point end users to HLS

* Drop support for `stack test`
2020-11-15 23:08:17 +00:00
Avi Dessauer
9b8aaf9b06
Update implicit-hie to 0.3.0 (#905) 2020-11-12 07:55:59 +01:00
Javier Neira
abf0a8abf5
Use implicit-hie-0.1.2.0 (#880) 2020-10-25 13:52:25 +05:30
wz1000
5bf1532b7e
Move HIE files stuff to a new hie-compat package (#877)
* Move HIE files stuff to a new hie-compat package

* add ghc-lib flag for hie-compat

* ghc-lib :(

* ghc-lib :(((

* ghc-lib :((((

* ghc-lib :(((((
2020-10-20 12:48:56 +05:30
Javier Neira
df13c5ad84
Enable test suite in Windows, marking unreliable tests as ignored (#821)
* Enable tests in windows ci

* Use lsp-test-0.11.0.6

* Fix tests in windows

* Use chocolatey to install cabal in ci

* Fix test: type constructor external

* Fix test: non workspace file

* Mark cpp-error as ignored for windows

* Ignore plugin tests for windows
2020-10-02 10:18:28 +02:00
Javier Neira
d868e06d28
Use hie-implicit-cradle-0.2.0.1 (#827)
To fix https://github.com/haskell/haskell-language-server/issues/417
2020-09-23 13:37:06 +02:00
Javier Neira
d686b91ec1
Use implicit-hie-cradle-0.2.0.0 (#806) 2020-09-15 08:52:32 +02:00
Pepe Iborra
436232dc9e
Fix stack 8.6 build (#801)
* Fix stack 8.6 build

* Avoid sharing the cache between test and bench stack builds

* Add hie-bios revision to stack.yaml

https://github.com/haskell/ghcide/pull/801#issuecomment-691833344

Skipping other stack descriptors as not strictly needed

* Disable benchmark job until master is fixed
2020-09-14 13:37:18 +01:00
Javier Neira
f79e930bc0
Use implicit-hie when no explicit hie.yaml (#782)
* Use implicit-hie when no explicit hie.yaml

* Use implicit-hie-cradle master in all build config files

* Set correct hie-bios version for ghc-8.10.1

* Fix windows ci build
2020-09-13 18:41:43 +01:00
Javier Neira
9ae5134d79
Use hie-bios-0.7.1 (#763) 2020-09-08 15:24:49 +02:00
Pepe Iborra
684be6885d
Fully asynchronous request handling (#767)
* Cancellation of user actions

* Dispatch event handlers asynchronously

* add tests for asynchronous features

This adds a new Test plugin for custom requests
and a new blocking Command

* hlint

* Link the Testing plugin only when --testing

* Fix expectNoMoreDiagnostics

Needs also https://github.com/bubba/lsp-test/pull/74

* Upgrade lsp-test to a version that understands CustomClientMethod
2020-09-07 12:29:05 +01:00
Pepe Iborra
251ee08da3
Expect bench experiments to fail with Cabal (#704) 2020-07-20 09:43:22 +02:00
fendor
1ca896980d
Update to hie-bios 0.6.1 (#693) 2020-07-16 11:30:45 +02:00
Pepe Iborra
4e7b2fcdbb
More benchmarks (#625)
* Add a benchmark to track startup times

* Benchmark automation

disable benchmarks easily

save GC stats to file

cradle, rts, filter and samples options

path to ghcide

configurable example

--help

more detailed CSV output

hover after edit

pause for GC

configurable timeout

upgrade extra (required to build bench)

Include max residency in BenchRun

Include all details on output

* reduce threadDelay to avoid upsetting lsp-test

* Fix startup time measurement

* Added new edit experiment

* fix doc comment

* hlints

* Upgrade to lsp-test 0.11.0.2

* Flag failed experiments

* Update ghcide.cabal
2020-06-12 20:46:55 +02:00
Pepe Iborra
a538f0644b
ghc initialization error handling (#609)
There are a couple of cases to handle as seen below.
Thanks @jneira for help discovering them all.
There used to be linking errors but I no longer see those after the multi-cradle patch

Non Nix
=========

The table below shows a couple of combinations of cradles and ghcide versions in a
non-Nix environment. All the version mismatches are now handled as follows:

- "Cannot satisfy package" -  `-package-id` flags referencing
  package versions not available (generally base)
- "bad interface" - tried to load an interface file created by a different version of ghc

cradle/ghcide | 8.6 | 8.8 | 8.10
--------------|-----|----|---
Cabal 8.6   | success | cannot satisfy package | cannot satisfy package
Cabal 8.8   | cannot satisfy package | success | cannot satisfy package
Cabal 8.10  | cannot satisfy package | cannot satisfy package | success
Stack 8.6   | success | bad-interface | bad-interfac-
Stack 8.8   | bad-interface | success | bad-interface
Stack 8.10  | bad-interface | bad-interface | success

Nix
=========

Because Nix redefines the libdir to point at the run-time ghc installation,
it's actually much easier to detect a version mismatch:
just compare the compile-time and run-time libdirs
2020-06-10 14:26:35 +02:00
fendor
9129475b87
Update to hie-bios 0.5.0 (#552)
* Update to hie-bios 0.5.0

* Fix test-cases due to changes in the direct cradle

* Update test/exe/Main.hs comment

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-05-23 09:54:25 +02:00
Luke Lau
cd6f62bbed
Use lsp-test-0.11 (#566)
Replace openDoc' with createDoc which sends out
workspace/didChangedWatchedFiles notifications
2020-05-17 16:37:08 +02:00
Luke Lau
5661348b5e
Upgrade to haskell-lsp-0.22 (#547) 2020-05-13 14:59:51 +02:00
Pepe Iborra
15bb044269
Improve ghc version check (#535)
- retrieve runtime version from ghc executable, not from pkg db (ghc-check 0.3.0.0)
- Do not error when unable to retrieve runtime version
2020-05-08 15:48:05 +02:00
Pepe Iborra
9ccd9eec08
Detect ghc mismatch (#462)
* Detect ghc version mismatches

* Add ghc-check to stack extra deps

* ghc-check: explicit libdir and delay version error
2020-03-24 12:40:21 +01:00
Javier Neira
9951f35b08
Use NormalizedFilePath and adapt types of haskell-lsp-0.21 (#479)
* Use custom version of h-l-t

* Use normalized path functions from h-l-t

* Restore empty path corner case

* Create a wrapper over NFP to override IsString

* Use maybe instead fromMaybe

* Use patched version of lsp-types in all yaml files

* Remove unused import

* Rename specific NormalizeFilePath to NormalizeFilePath'

* Remove specific newtype and IsString instance

* Use released haskell-lsp-0.21

* Adapt to type changes of haskell-lsp-0.21

* Add tags field to CompletionItem

* Fix test case about empty file path

* Correct stack.yaml used in azure ci cache

* Build ghcide including tests in windows azure ci

* Qualify haskell-lsp modules to avoid name clashes
2020-03-23 09:07:04 +01:00
Alan Zimmerman
111b6855e2
Use tasty-rerun to allow rerunning failed tests only (#484)
Use by

  stack --stack-yaml=stack84.yaml test --test-arguments "--rerun"
2020-03-16 09:07:50 +01:00
Moritz Kiefer
e59d3e2c77
Upgrade to haskell-lsp-0.20 (#405) 2020-02-05 10:14:13 +01:00
Neil Mitchell
025fa5be68
#381, require shake-0.18.5, which ensures progress cancellation is robust (#400)
* #381, require shake-0.18.5, which ensures progress cancelation is robust

* Fix a GHC 8.8.2 warning

* Don't allow-newer, do pin hie-bios
2020-02-04 11:59:07 +01:00
fendor
1d04b09add
Update to latest hie-bios (#382)
* Update to latest hie-bios

* Remove explicit usage of type parameter Void from Cradle
2020-02-04 11:09:50 +01:00
Neil Mitchell
f3abff8b7c
Better progress messages (#379)
* Require shake-0.18.4 which contains actionBracket

* Change progress reporting to use files rather than Shake nodes

* Remove inadvertantly writing down Shake twice
2020-02-03 13:26:16 +01:00
Neil Mitchell
913aa5f9fa Don't support old haddock-library versions (#375)
* Don't support old haddock-library versions

* Update stack.yaml values

* Remove some more haddock_library CPP

* Make sure the latest haddock-library is on GHC 8.4
2020-01-28 20:20:38 +01:00
Alejandro Serrano
a0aa013e33 Better docs for completions (#288)
* Remove JSON instances for completions, since we are not implementing "resolve"

* Remove completion resolve data from tests

* Better docs

* Fix tests

* Fix for 8.4

* Turn Haddock markup into Markdown

* Add types to completion items

* Make it work on 8.8 and 8.4

* Revert "Remove completion resolve data from tests"

This reverts commit 625d710f11.

* Revert "Remove JSON instances for completions, since we are not implementing "resolve""

This reverts commit 12ff27dce7.

* Fix tests

* Require higher version of regex-pcre-builtin

* Replace Pandoc with direct conversion from Haddock to Markdown

* Show kinds of type constructors too

* A few fixed to Markdown conversion

* Check optNewColonConvention

* Fix build on 8.4 and 8.8

* More fixes for 8.4 and 8.8

* Check only the common part of the completion text

* Make icons consistent with Outline

* Test docs for completions

* Make constructors return the corresponding CompletionItem + tests for that behavior

* Make test work on 8.4
2020-01-09 09:44:32 +01:00
Neil Mitchell
2c96c9b87f Require hie-bios 0.3.2 or above (#286)
* Require hie-bios 0.3.2 or above

* Update stack.yaml files

* Use newer parser-combinators on GHC 8.4

* Bump parser combinators on 8.6

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-01-03 11:14:09 +01:00
Pepe Iborra
0bcdc6a226 Fix for #45 - remove redundant symbols from imports (#290)
* Test for #45

* Remove redundant symbols from imports

Fixes #45

* Update src/Development/IDE/LSP/CodeAction.hs

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* Add regex-tdfa extra deps to ghc-lib build

* Fix for GHC 8.4 (error message prints qualified binding)

GHC ticket #14881 changed this to print identifiers unqualified

* dropBindingsFromImportLine: make total

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2019-12-30 10:40:13 +01:00
Alejandro Serrano
b52ee607f9 [WIP] Completion support (#227)
* Initial implementation of completion support

* Add fuzzy to set of additional dependencies in 8.8

* Fix test

* Work a bit more on completion

* Attempt at getting completions from last good tckd module

* Revert "Attempt at getting completions from last good tckd module"

This reverts commit 04ca13b9d8.

* "useWithStale" everywhere

* Some suggestions by @cocreature

* Adjust positions in the document

* Start working on tests

* Fix compilation problem

* Fix tests

* Better type tests
2019-12-19 15:00:39 +01:00
Moritz Kiefer
8ea5d69e18
Upgrade to haskell-lsp 0.19 (#254)
* Upgrade to haskell-lsp 0.19

* Clarify version handling
2019-12-16 14:57:38 +01:00
Moritz Kiefer
fc30f1476f
Upgrade to hie-bios (#257)
This does not yet take advantage of any new features but we should at
least be able to benefit from bugfixes.
2019-12-16 11:42:44 +01:00
Moritz Kiefer
bc32a2eab3
Upgrade to new haskell-lsp release (#203) 2019-11-18 09:37:10 +01:00
Moritz Kiefer
2755212f48
Switch to new releases of haskell-lsp and lsp-test (#171) 2019-10-18 20:58:26 +02:00
Moritz Kiefer
5febbcbc48
Fix progress reporting (#153)
* Fix progress reporting

* Bump haskell-lsp and lsp-test revisions

* Change client name

* Fix typo

* Bump revisions
2019-10-17 11:11:52 +02:00
Neil Mitchell
f538492343 Use the latest hie-bios, which now works on Windows (#125) 2019-09-25 08:43:47 +02:00
Domen Kožar
82da406520 bump to hie-bios 0.2.0 and bump *lsp packages (#83) 2019-09-18 13:42:34 +02:00
Ollie Charles
9a5ee23c01 Build on GHC 8.8 (#43) 2019-09-16 15:20:48 +02:00
Moritz Kiefer
2c24f2be15 Cleanup GHC API version checks
Previously we had a mix of GHC_STABLE and checks on
__GLASGOW_HASKELL__. This PR changes this to always check on
MIN_GHC_API_VERSION. Depending on whether you use ghc-lib or not (now
controlled by a cabal flag), this macro expands to MIN_VERSION_ghc or
MIN_VERSION_ghc_lib.
2019-09-16 11:34:25 +02:00
Neil Mitchell
9bd78857d8 #2326, GHC 8.4 compatibility (#2796)
* #2326, GHC 8.4 compatibility

* Fix up CI

* Add a Shake lower bound

* Upgrade to a hie-bios which is GHC 8.4 compatible

* Add a GHC 8.4 stack

* Fix HLint again
2019-09-10 14:52:17 +02:00
Moritz Kiefer
75e53e7633 Bump hie-bios (#2586)
This includes my patches to fix the Stack cradle in hie-bios so
hie-core should now work properly on Stack projects.
2019-09-10 14:52:17 +02:00
Moritz Kiefer
79c04cd202 Upgrade haskell-lsp and lsp-test (#2474)
* Upgrade haskell-lsp and lsp-test

There have been some fixes upstream that should hopefully mean that we
no longer need to mark the lsp-tests as flaky on Windows. I am having
trouble reproducing the flakiness locally, so let’s see what happens
on CI.

* Also bump stack.yaml
2019-09-10 14:52:17 +02:00
Moritz Kiefer
fbe192a7a3 Add a Stack based pipeline for testing hie-core (#2348)
This is in preparation for #2326 as well as for splitting hie-core
into a separate repo. Given that, it explicitely avoids using our
dev-env.

We do need to install a few system packages, so for now this uses the
hosted builder so we can do this. Another option would be to just add
those to our builders. I don’t really have a preference either
way. The builds are < 5 minutes so I don’t expect issues from using
the hosted builders.
2019-09-10 14:52:17 +02:00
Andreas Herrmann
ae37b4b21c stack/cabal for hie-core-tests (#2287)
* stack/cabal for hie-core-tests

* ./fmt.sh
2019-09-10 14:52:17 +02:00
Shayne Fletcher
59e871c6e8 Update the hie-bios commit SHA (#1825)
* Update the hie-bios commit SHA

* Also update the SHA in our bazel WORKSPACE

* Update the hash too

* Tutorial for Emacs integration

* Update hie-bios patch
2019-09-10 14:52:17 +02:00