Commit Graph

139 Commits

Author SHA1 Message Date
Andy
21c8e9b83e
Hlint: A handful of fixes to hints (#3259)
* CI: rwe/actions-hlint-run v2

* fmt script: Fix missing directories

Otherwise will fail

* Hlint: Automatically fix warnings via apply-refact

* Hlint: Do not suggest fromMaybe

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2022-10-10 11:47:42 +00:00
Zubin Duggal
816cd6301e Prepare 1.8.0.0
Use hiedb from hackage

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

hie-bios

update hie bios

update hie bios

bounds

hie-bios fixes

hie-bios fixes

lsp 1.6

cabal.project fixes

hie-bios fixes

lsp and hie-bios from hackage

Mark hie-bios error as expectFail

hie-bios fixes

hie-bios fixes

Stack

Stack

stack fixes
2022-09-14 02:27:17 +05:30
Pepe Iborra
d0e3e0fe3f
HLS benchmarks (#3117)
* extract ghcide:experiments-types

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

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

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

* HLS benchmark suite

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

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

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

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

* CI - fix artifact names for uniqueness

* disable shorten HLS step

* Do not store eventlogs to avoid out of disk space

* render durations up to milliseconds

* shorten titles

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

* exclude formatting plugin configurations

* Extract ghcide-bench to a standalone package

* ghcide-bench: fix stderr capturing

* Fix mem stats

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

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

* feedbacks

* delete Example plugins
2022-08-25 15:08:57 +01:00
Pepe Iborra
9ef66c9679 Add plugin priorities 2022-08-19 15:49:39 +05:30
Pepe Iborra
c9ed045f7b
Do not send Heap Stats to the LSP log (#3111) 2022-08-18 06:25:01 +00:00
Lei Zhu
49373fd014
Fix #3047 (#3092)
* Make path canonicalized

* Update extra-source-files

* Replace with normalise

* Change to a more detailed log

* Comment patch detail

* 2 spaces indent
2022-08-14 14:44:59 +00:00
Andy
e20b026c50
Probe-tools: Print stack ghc version (#3093)
* Probe-tools: Print stack ghc version

The ghc version on the $PATH is often not relevant for stack projects.
The ghc version stack is using is printed in addition.

* Probetools: cradle ghc version added to wrapper

* Revert stack ghc changes to Ide.Main

* Update exe/Wrapper.hs

Co-authored-by: fendor <fendor@users.noreply.github.com>

* Probe tools: Print version with padded spaces

Addressing <https://github.com/haskell/haskell-language-server/pull/3093#discussion_r944428948>

Co-authored-by: fendor <fendor@users.noreply.github.com>
2022-08-12 15:42:27 +00:00
Kobayashi
255498147a
upgrade lsp to 1.5 (#3072)
* upgrade lsp to 1.5

* fix stack.yaml

* try fix tests

* disable verbose logging in ghcide

* fix more tests in ghcide

* fix floskell test

* disable debug log in func-test

* disable debug log in lsp itself

* Revert "disable debug log in func-test"

This reverts commit 1fd6658c77.

* remove unused import

* fix hls test utils

* upgrade lsp in nix

* fix func-tests

* Revert "fix func-tests"

This reverts commit 2ecd76d0ba.

* fix waitForDiagnosticsFromSourceWithTimeout

* use Null as dummy message in waitForDiagnosticsFromSourceWithTimeout

* simplify a test case

* add comment about lsp bad logs
2022-08-12 09:09:07 +00:00
Lei Zhu
0e74593e8d
hls-explicit-fixity-plugin (#2941)
* init hls-explicit-fixity-plugin

* Update dependencies

* Refactor: Prevent block on startup

* Run pre-commit

* Compatibility: Add emptyMessages

* Remove unused ModIface

* Comment why to make this plugin a lower priority

* Provide hover content while testing fail

* Avoid lambda

* 4 space indent

* Pass Text instead of Name

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2022-08-11 11:48:18 -04:00
Kobayashi
dc682ba118
add a prefix to plugin CPP (#3065) 2022-07-29 10:28:31 +00:00
Dmitry Pogodin
347a7187f2
Run pre-commit hooks (#3059) 2022-07-28 16:48:13 +00:00
Gregory Gerasev
078fc14dda
Stan integration #258 (#2908) 2022-07-28 02:11:31 +03:00
Kobayashi
445192e21d
refactor selection range plugin (#3003)
* update Gitpod config

* update nix shellHook & docs

* install pre-commit hook

* add kokobd as code owner to .gitpod.*

* add gen-hie to Gitpod

* add tools for doc

* remove .pre-commit-config.yaml from .gitignore

* set vscode formatter to stylish-haskell in Gitpod

* refactor selection range plugin

* refine selection range

* add CodeKind to CodeRange

* rename hls-selection-range-plugin to hls-code-range-plugin

* update docs about selection range

* cleanup RuleTypes.hs

* add the missing bang pattern

* fix subRange

* add some unit tests to CodeRange.Rules

* add tests for removeInterleaving

* add even more tests

* fix extra sources

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-07-11 04:24:35 +00:00
Stefan Matting
cdc8f78a98
Turn HLS-wrapper into an LSP Server (#2960)
* Make wrapper a LSP on failure

* Fix incorrect imports

* revert import block for smaller diff

* add missing imports

* Fix: callProcess on win32 machines not called

* import container only on win32

* add missing liftIO

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2022-06-26 11:39:07 +00:00
fendor
907a6e645b
Teach HLS about different file extensions (#2945)
* Fix parameter switch-up

* Generalise file extension handling for plugins

NotificationHandler now distinguishes between different file extensions
RequestHandler distinguishes between different file extensions

* Introduce PluginMethod Typeclass hierarchy

The hierarchy looks as follows:

            PluginMethod (pluginEnabled)
                          |
         -----------------------------------
         |                                 |
 PluginRequestMethod             PluginNotificationMethod

* Add example plugin

* Improve documentation for plugins

* Simplify Plugin Handling code

Co-authored-by: Jana Chadt <jana.chadt@nets.at>
Co-authored-by: Jana Chadt <jana.chadt@tuwien.ac.at>
Co-authored-by: Fendor <walross.power@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-06-22 15:38:13 +00:00
Akshay Mankar
2121495209
hls-class-plugin: Only create placeholders for unimplemented methods (#2956)
* hls-class-plugin: Only create placeholders for unimplemented methods

* hls-class-plugin: Add logs
2022-06-20 02:46:29 +00:00
George Thomas
09968a1567
More Fourmolu improvements (#2959)
* Use proper structured logging for Fourmolu

Previously we just printed directly to stdout and stderr.

* Don't run Fourmolu in debug mode

It prints to stderr, due to uses of `traceM`, and it's not nice to work around this downstream.

It's of questionable utility anyway. The fact that it mostly prints information about extensions, and does so in a hard-to-read format (a string displayed as a list!) indicates that it probably isn't widely used.

* Fourmolu: parse strings to integers before comparing versions

Whoever originally wrote this (😳) had clearly had one too many beers the night before: `show @Int` is not monotonic since e.g. "10" < "2".
2022-06-17 13:31:31 +00:00
Nick Suchecki
8f68882f81
Add throwPluginError to Plugin Utilities (#2924)
* Add new PluginUtility function.

Add the function `throwPluginError`. This function is intended to
provide a common `ResponseError` message for use in logging.

Renamed `response` to `pluginResponse` for more clarity.

* Call hierarchy clean up

* Make Descriptor usable as String/Text or PluginID

* Update reference to ChangeTypeSignature descriptor

* Use unpack rather than show

* Import cleanup

* Merge cleanup

* Fix test suites for effected plugins

* forgot to change the CodeAction kind in the test suite...

* Update new plugin
2022-05-27 15:11:08 +00:00
Lei Zhu
faa88f685e
A plugin for GADT syntax converter (#2899)
* initial hls-gadt-plugin

* Correct condition

* Render context correctly

* Fix typo

* Support from ghc-8.6 to ghc-9.0

* ghc8.6 compat

* Try to fix test for ghc-8.6

* Pretty name

* Add GADTs pragma automatically

* Enrich Readme

* Clean up

* Update hls docs

* Update CODEOWNERS

* Fix typo

* Rename withTempDir with withCanonicalTempDir

* Add @michaelpj's suggestions

* Pass PluginId through descriptor

* Explicit forall
2022-05-26 17:13:09 +08:00
Pepe Iborra
65fbc5e41c
Restore compat. with prettyprinter 1.6 (#2877) 2022-05-01 15:58:43 +00:00
wz1000
3c24c20c5d
Avoid race conditions with VFS and VFS versions (#2789)
* Avoid race conditions with VFS and VFS version

We need to take VFS snapshots as soon as we get a change notification.

Consider the following interleaving of events:

1. Change Notification A (updates LSP VFS)
2. Restart Shake Session (A changed) initiated
3. Change Notification B (updates LSP VFS)
4. Restart Shake Session (A changed) takes VFS snapshot and possibly performs more computation
5. Restart Shake Session (B changed)

In particular, between step 3 and 5, we took a snapshot for a previous build,
but this snapshot included changes from a newer VFS state that the build should
not have seen.

To fix this, we need to take snapshots as soon as a notification handler is
called, before forking any threads. This works because LSP calls all handlers
in a single threaded fashion and these handlers block message processing. It
is essential to this on the LSP handler thread rather than the reactor thread
that GHCIDE sets up in order to maintin the property.

* Disable flaky test 'add missing module (non workspace)'
2022-04-16 20:43:44 +00:00
Michael Peyton Jones
82a3cd5640
Refactor LSP logger and log via window/logMessage also (#2758)
* Refactor LSP logger and log via `window/logMessage`

* Skip logging notifications in tests

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2022-03-08 17:56:32 +00:00
Julian Ospald
73fdd91e5a
Fix the tower of Babel (#2757) 2022-03-06 21:24:51 +00:00
Pepe Iborra
30b3fec2f0
Adjust rendering of error logs and drop unneeded MonadUnliftIO instance (#2755)
* drop unneeded MonadUnliftIO instance

* Adjust error message

* fixups
2022-03-06 14:29:20 +00:00
Pepe Iborra
5afb0770c9
LSP window message log recorder (#2750)
* failing to set the unsafe dynflags is an error

* makeLspRecorder

* include link to the issue tracker

* avoid double popup

* catch another ghc lib dir error
2022-03-06 09:18:46 +00:00
Nick Suchecki
911fe59d7f
Change Type Signature Plugin (#2660)
* First go

* Match against specific error message.

* Basic Change Type Signature implementation.

This implementation only matches a single GHC Error message:

```
    • Couldn't match type ‘Int’
                     with ‘Data.HashSet.Internal.HashSet Int’
      Expected type: Int -> Int
        Actual type: Data.HashSet.Internal.HashSet Int -> Int
    • In the expression: head . toList
      In an equation for ‘test’: test = head . toList
```

Specifically on `Expected type: ...`, `Actual type:...` and `In an equation ...`.

There are plenty of error messages that match this format but aren't actually valid.

* GHC 9.2.0 compat change

* Lift expectedError message into a separate binding

* Move ChangeTypeAction into it's own plugin

* Add New Error Message parsing.

- Add new regex for matching extra errors message types

- Revamp original regex to match more.

- Add basic test suite.

- Begin adding `tidyActualType` semantics to provide slightly prettier
TyVars

* Added Error Message Validation to ignore bad Messages.

- Add Pretty Printing for Types
- Added a few test scenarios

* Miscellaneous Cleanup.

* Update Tide Type Signature logic.

- Be able to tidy signatures with operators in it
- Use T.words instead of regex matching to split tyVars

* Remove locA (defaults to id in 8.10) to satisfy 9.0+

* Touch up 9.2.1

* Clean up review notes

* Update stack.yamls

* Fix copy-paste error

* Fix Local Signature resolution

* Improve logging (#2558)

* convert to contravariant logging style part 1, uses additional hardcoded log file to see it side by side with original logging

* convert Session to contravariant logging style

* convert Plugin/HLS and FireStore to contravariant logging style

* convert Rules (and most of the universe) to contravariant logging style

* fix tests, allow old style logging and contravariant logging to write to same log file

* fix import inside wrong CPP

* add CPP for LogTactic constructor

* remove redundant import

* fix ghcide tests

* remove unused import

* fix plugin tests

* LSP_TEST_STDERR should apply to contra logger as well

* fix tactic plugin test

* use CPP for Log datatype plugin constructors, remove unused imports

* add a few Pretty instances, add prettyprinter to haskell-language-sever and hls-plugin-api dependencies

* add Pretty Log instances for Session, FileStore, Notifications

* add remaining Pretty Log instances

* add logToPriorities

* fix slight interleaving issue with hslogger and logger both logging, have default logger be mutex stderr or file handle, use stderr if failing to open log file

* forgot to add .cabal files with hslogger dep

* dont use UnliftIO file IO helpers because they are too new

* remove log helper comments, use Doc instead of Text as final console/file logger input, renaming, export Log constructors

* remove accidentally added useless file, removed prettyprinter dep from hls-plugin-api because stack ghc8.6.5 doesnt have it?

* use deprecated prettyprint modules import for the sake of circleci ghc-8.6.5

* use dummy stderr logger for plugin cli commands, use priorityToHsLoggerPriority function instead of manual mapping

* remove old plugin detritus that somehow got committed

* fix prettyprinter imports for 8.6.5

* try enforcing prettyprinter bounds?

* enforcing bound makes no sense

* maybe changing stack yamls does trick

* filter out warnings when their diags are empty to more closely match original

* add ability to select wanted logging columns, match prev ghcide exe logging behaviour

* dont log anything when diags are empty in some defineEarlyCutoff versions

* use non-deprecated prettyprinter imports

* fix ghcide test module

* change logWith to accept priority at call site, remove all logToPriority functions, add cmapWithPrio that contramaps through WithPriority

* remove useless hiding import list, add comments to default recorder makers

* make cradleToOptsAndLibDir take concrete cradle to remove existential type var in Log constructor

* Types.Logger now re-exports prettyprinter, remove unused dependencies on prettyprinter and hslogger

* existential type var to remove boilerplate in Plugins.hs, remove a few Show instances

* add SourceLoc logging column, inline logToDoc functions, add comment explaining hslogger setup existence

* qualify a name to match original source

* fix -WError

* Delete the Telemetry log level (#2727)

It's a bit non-standard, and moreover it's entirely dead.

* Wall and 9.2 fix

* Remove unneeded comments/code

Co-authored-by: J. S <shenjonathan0@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
2022-03-03 23:08:42 +00:00
J. S
3b687a52ac
Improve logging (#2558)
* convert to contravariant logging style part 1, uses additional hardcoded log file to see it side by side with original logging

* convert Session to contravariant logging style

* convert Plugin/HLS and FireStore to contravariant logging style

* convert Rules (and most of the universe) to contravariant logging style

* fix tests, allow old style logging and contravariant logging to write to same log file

* fix import inside wrong CPP

* add CPP for LogTactic constructor

* remove redundant import

* fix ghcide tests

* remove unused import

* fix plugin tests

* LSP_TEST_STDERR should apply to contra logger as well

* fix tactic plugin test

* use CPP for Log datatype plugin constructors, remove unused imports

* add a few Pretty instances, add prettyprinter to haskell-language-sever and hls-plugin-api dependencies

* add Pretty Log instances for Session, FileStore, Notifications

* add remaining Pretty Log instances

* add logToPriorities

* fix slight interleaving issue with hslogger and logger both logging, have default logger be mutex stderr or file handle, use stderr if failing to open log file

* forgot to add .cabal files with hslogger dep

* dont use UnliftIO file IO helpers because they are too new

* remove log helper comments, use Doc instead of Text as final console/file logger input, renaming, export Log constructors

* remove accidentally added useless file, removed prettyprinter dep from hls-plugin-api because stack ghc8.6.5 doesnt have it?

* use deprecated prettyprint modules import for the sake of circleci ghc-8.6.5

* use dummy stderr logger for plugin cli commands, use priorityToHsLoggerPriority function instead of manual mapping

* remove old plugin detritus that somehow got committed

* fix prettyprinter imports for 8.6.5

* try enforcing prettyprinter bounds?

* enforcing bound makes no sense

* maybe changing stack yamls does trick

* filter out warnings when their diags are empty to more closely match original

* add ability to select wanted logging columns, match prev ghcide exe logging behaviour

* dont log anything when diags are empty in some defineEarlyCutoff versions

* use non-deprecated prettyprinter imports

* fix ghcide test module

* change logWith to accept priority at call site, remove all logToPriority functions, add cmapWithPrio that contramaps through WithPriority

* remove useless hiding import list, add comments to default recorder makers

* make cradleToOptsAndLibDir take concrete cradle to remove existential type var in Log constructor

* Types.Logger now re-exports prettyprinter, remove unused dependencies on prettyprinter and hslogger

* existential type var to remove boilerplate in Plugins.hs, remove a few Show instances

* add SourceLoc logging column, inline logToDoc functions, add comment explaining hslogger setup existence

* qualify a name to match original source

* fix -WError
2022-02-20 21:50:28 +00:00
Julian Ospald
5271f6312c
Improve wrapper cradle errors (#2711)
* Improve wrapper cradle errors

* Refactor cradle result unpacking

* Fix runGhcCmd when NoImplicitPrelude is on

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-14 21:58:27 +00:00
Julian Ospald
a96b623c2b
Implement distribution of dynamic builds (#2675) 2022-02-11 07:54:09 +00:00
Kobayashi
310e6a4683
support selection range lsp feature (#2565)
* add selection range support

* add the whole import area as a selection step

* add selection range plugin to all project files

* merge type signature with value definition

* support ghc 9

* fix it for ghc-9.0

* remove unnecessary import

* reformat GhcIde.hs

* selection range: make it easier to understand

* selection range: improve error handling

* update lsp-types to 1.4.0.1

* add selection range to doc

* fix comment for findSelectionRangesByPositions

* remove a use of partial function

* update author & maintainer

* use foldlM1 instead of foldl1

* add testdata to cabal file

* update performace tips and log level

* update lsp-types in nix

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2022-01-24 13:13:56 +00:00
Nick Suchecki
1a74937ca5
HLS Plugin to provide Alternate Literal Formats. (#2350)
* Initialize and Setup Plugin Source.

* Provide Traversal Module to Haskell AST that collects Literals.

* Change Literals module to return type.

Update our parsing module to return the data type we will use in our
plugin.

The datatype: Literal

Constructors:

Overloaded - Contains an overloaded literal with a SrcSpan

NonOverloaded - Contains non-overloaded literals with a SrcSpan

NoLocation - currently unused.

This data type is bound to change. This module is designed to capture
ALL numeric literals for use in the plugin. When parsing Haskell source
tree, certain cases result in getting a plain `Expr`. This means it is
not annotated with a SrcSpan. As a result, we pass along a SrcSpan
through most functions to keep track of the most recent SrcSpan
encountered. This isn't a fool proof plan and may be removed in the
future.

* Implement Logic for actual CodeActions.

The traversal of Haskell source has been turned into a rule. This rule
generates hidden diagnostics which allow a user to run a code action
over (most) literals.

There is some "dead code" in the sense that some literals (prims to be
exact) are not allowed to be changed, despite existing in code. The
other "dead code" exists in the FormatType type. Certain extensions
exist that alter how numbers are shown or act, we make note of those
extensions but call them "NoFormat", which essentially means it's a
NOOP.

Most of the conversion is done via the Numeric module. There are plenty
of "show" functions that provide the translation of numbers into the
various formats. The only custom format is a slightly "dumb"
NumDecimal-extension-function that generates three separate options,
instead of using a numeric defined function.

* Clarify source code comments. Reformat file structure.

* Set up Test Scaffolding.

* Miscellaneous clean-up.

* Use Regex to Match Source Text.

* Remove unneccessary diagnostics from Rule.

* Update all stack versions to include new Plugin.

* Clean up Conversion.hs and AlternateNumberFormat.

Clean up function names and add supporting haddock documentation for
exported functions.

* Update cabal file bounds and add Github workflow test

* Add plugin package to all cabal.project

* Add plugin to test suite

* Push SYB changes. Test.hs is merely for testing and will be removed prior to Merge.

* Use Generics.SYB for parsing Literals from GHC Source.

Updated Literals.hs to use custom SYB traversal of the AST.

* Update hls-alternate-number-format-plugin.cabal

* WIP: run tests

* Test additions and GHC compatability changes.

* Removed dead code.

PrimLiterals were defined originally, however GHC source doesn't provide
the source text. This is one of the needs of the plugin so we don't
provide duplicate suggestions.

Swapped `Maybe Text` to `Text`. Similar to above we now ignore all
literals that have no source text attached.

Swapped `Maybe SrcSpan` to `RealSrcSpan`. Again, similar to the previous
points we now ignore literals that don't get a sourceSpan attached.
Similarly, we drop any `UselessSpan`'s as those are also not very
helpful.

* Use Set to remove duplicates from CollectLiterals Result.

Certain AST representations are traversed multiple times with the switch
to SYB. Using Set allows to easily remove duplicate Literals from our
result.

Added a test suite to monitor for regressions.

* Delete Test.hs

Inadvertently commit this file.

* Add README and bump version to 1.0.0.0.

* Update HLS cabal file for version change.

* Additional Tests.

* Update Test file to use Path library function.

* Miscellaneous Code Fixes.

- Remove unneeded imports/functions.

- Export only specified functions from each module (and add Haddock
  Comment if necessary)

- Minor text changes for accuracy

* Add README to Extra Source Files.

* Update Extra Source Files to include Test Haskell Source files.

* Update Features.md and Minor Bug Fix :)

* Add new plugins to hackage workflow

* Fix Bug caused by Minor Bug Fix.

Co-authored-by: jneira <atreyu.bbb@gmail.com>
Co-authored-by: Fendor <power.walross@gmail.com>
2021-12-01 14:12:06 +00:00
J. S
d0ccc2f9f3
Qualify imported names plugin (#2355)
* actual initial qualify imported names implementation

* renamed and added tests for QualifyImportedNames plugin

* fix backtick and parenthesized operators not being qualified correctly

* add tests, and remove logging

* add license, readme, and demo

* remove old demo, add slightly better demo

* remove old mp4 demo, add slightly gif demo

* update readme to use demo

* readme typo

* slight rewording of readme

* slight rewording of readme 2

* remove Demo header from readme

* don't need ShakeExtras and remove some more logging stuff

* hopefully fix ghc 9 differences, rename plugin cabal file

* forgot comma on module re-export

* minimize imports

* fix Hashmap import for ghc <= 8.8, remove unused extension pragmas

* fix hls-qualify-imported-names ghcide bound

* add test suite to CI

* add more tests for qualify imported names plugin

* change ghcide bound to match what @hololeap is doing

* add qualify imported names to feature list

* add demo, readme, test files, test hie.yaml to extra source files

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-11-29 17:58:25 +00:00
Oliver Madine
28222e9005
New rename plugin implementation (#2108)
* initial commit

project structure
initial test cases
directly modify source to rename references

* code style

* enable for ghc < 8.8.0

* remove aeson from build-depends

* update support

support ghc9
revert retrie version bump
disable feature by default

* enable plugin for testing

* fix test.yml

* code style, ghc9 retrie bump

remove unnecessary flag in test.yml
consistent indentation
increase retrie version for ghc 9.0.1 (decreased by mistake)

* avoid using Data.List.nub

* code style

fix typo in indentation test
break lines at 100 chars
rename some vars

* code style / performance

remove Retire dependency by using exactprint directly
group references by file to increase speed of checking `elem` per file
add test cases (typeclass, let expression)
add some documentation
fix bug when looking up reference in HieDb
improve error messages
rename some function / vars

* replace GhcPlugins import with Name import

* use GHC.Types.Name for ghc >= 9.0.1
2021-08-21 20:06:53 +02:00
Lei Zhu
d815d0474d
Call hierarchy support (#1955)
* Initialize structure

* Add basic tests

* prepareCallHierarchy

* Add prepare call hierarchy tests

* Prepare call hierarchy support

* add outgoing calls

* Rename incoming to outgoing

* Add incoming calls support

* Fix panic error caused by parameters

* Prepare callhierarchy tests

* Duplication items support

* Format and add missing components for review

* Use local lsp

* Add CI test

* Fix typo

* Add flag for 9.0.1

* Change lsp repo

* Fix query error in data declaration

* Add incoming/outgoing call tests

* Add flag for test ghc 9.0.1

* Ignore test on 9.0.1

* Add 9.0.1 test

* Specifying lsp for cabal

* Refresh hiedb before incoming/outgoing calls

* Add moduleUnit on ghc 9.0.1

* Compatible with ghc 9.0.1

* Add missing qualifier

* Remove ghcide capability test
2021-07-27 22:40:04 +01:00
Pepe Iborra
547138213e
Allow HLS plugins to declare cli commands (#1999)
* turn into subcommands and move to Default.Main

* remove redundant logger

* fixup subcommands

* HLS plugin cli commands

* Add an example

* print -> putStrLn
2021-07-06 12:45:41 +01:00
Potato Hatsue
f35e2cdf9d
Remove hls-ghc-x.y from install script and wrapper (#1805)
* Remove hls-ghc-x.y from install script and wrapper
2021-05-07 14:27:01 +02:00
fendor
0da416847b
Unify session loading using implicit-hie (#1783)
* Unify session loading using implicit-hie

Make Wrapper and Session loader use the same logic to avoid
loading logic divergence.

Cleans up existing usages to use infrastructure in place.

* Add major CLI mode for printing the cradle type

Adds test-case for proving that wrapper and hls report the
same cradle type for a project.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-05-02 20:26:53 +00:00
Ray Shih
54737e9e2d
Implement refine imports (#1686)
* Implement refine imports

* Implement code action for refine imports

* fix stack.yaml

* fix stack-*.yaml

* fix missing records fields after merge master

* fix nix

* reduce duplicated functions

* [Plugin][RefineImports] add tests and fix overriding issue

* add hls-refine-imports-plugin to CI workflow

Co-authored-by: Junyoung/Clare Jang <jjc9310@gmail.com>
2021-04-29 22:32:19 -04:00
Pepe Iborra
607ae3b95a
support custom Ide commands (#1666)
* Added a command to index the database and exit

* WIP wait for it

* Load FOIs (otherwise nothing happens) and wait for the hiedb writer

* Add a command in ghcide exe

* reuse Development.IDE.Main.Command

* Fix verbosity

* Fix Wrapper

* Fix tests

* projectRoot

* Generalized custom commands

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
2021-04-08 05:55:27 +00:00
Pavan Rikhi
a4e22dbc77
Add CPP Options for Stylish Haskell & Brittany Formatters (#1620)
This fixes an issue where the `stylish-haskell` & `brittany` plugins
weren't being added to the enabled plugins list, even if HLS was
compiled with their specific flags or the `all-formatters` flag.

Also removed the AGPL flag checking when adding the `brittany` plugin,
since that is no longer defined anywhere.

Co-authored-by: Potato Hatsue <1793913507@qq.com>
Co-authored-by: Junyoung/Clare Jang <jjc9310@gmail.com>
2021-03-26 09:19:09 +00:00
Potato Hatsue
7255b408da
Extract hls-test-utils (#1606)
* Extract hls-test-utils

* Use test utils in brittany plugin and stylish haskell plugin

* stack

* Set locale encoding to utf8 in defaultMain

* Remove with-utf8
2021-03-23 18:45:45 +08:00
Pepe Iborra
b9c6e6cf4d
Add ability for plugins to handle file change notifications (#1588)
* Provide pluginNotificationhandlers too

Like pluginHandlers, but for notifications

At present the last one in the chain wins, so if one is set it
overrides the one built into ghcide

* Fix handling of config

* run the handlers in parallel

* add missing instances

* Extract ghcide notification handlers to an HLS plugin

This is required to allow for user defined notification handlers, otherwise
HLS plugins will overwrite the ghcide handlers and nothing will work

* Update hls-plugin-api/src/Ide/Types.hs

Co-authored-by: wz1000 <zubin.duggal@gmail.com>

* bump version numbers to track breaking changes

* hlint pragma

* fixup! Update hls-plugin-api/src/Ide/Types.hs

* relax depends constraints

* redundant import

* fixup! Update hls-plugin-api/src/Ide/Types.hs

* clean up

* run notification handlers sequentially

* Drop PluginNotification (redundant)

* sort out tracing

Co-authored-by: Alan Zimmerman <alanzimm@fb.com>
Co-authored-by: wz1000 <zubin.duggal@gmail.com>
2021-03-20 14:26:41 +00:00
Potato Hatsue
f135edb131
Regularize custom config of plugins (#1576)
* Support declarative custom config, add --vscode-extension-schema

* Add globalOn

* Add --generate-default-config

* Port tactic plugin

* Fix build of tactic plugin test

* Fix tactic plugin test

* Revert format changes in tactics plugin

* Change the descriptor of tactics plugin to "tactics"

* Update plugins/hls-tactics-plugin/src/Wingman/LanguageServer.hs

Co-authored-by: Sandy Maguire <sandy@sandymaguire.me>

* Apply a bunch of @isovector's suggestions

* Document Ide.Plugin.ConfigUtils

* Add TInteger

* Fix build

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

* Add the brittany plugin to all the stack descriptors

* Extract tests into a standalone testsuite

* Drop AGPL flag

* Change the default logger to print to stderr

* add hls-brittany-plugin test suite to CI

* Add strict version bounds

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

* includes breaking API change: bump ghcide version number

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

* Format all files
2021-02-24 21:34:35 -05:00
Pepe Iborra
a065cd66ee
Configuration for initial ghc lib dir (#1378)
* getInitialGhcLibDir

* Fix build and use Data.Default consistently

* Fix log line

* Fix build

* (unrelated) Honor the rules config in the setup tester
2021-02-17 13:28:53 +00:00
wz1000
755fc378f5
References via hiedb (#704)
* Integrate hiedb

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

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

* Update ghcide/bench/lib/Experiments.hs

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

* Clear deleted files from hiedb

* make garbage collection async

* bump hiedb

Co-authored-by: Pepe Iborra <pepeiborra@me.com>
Co-authored-by: Peter Wicks Stringfield <peterwicksstringfield@gmail.com>
2021-01-30 11:27:32 +00:00
Pepe Iborra
0c9dd30e38
Break down ghcide functionality in HLS plugins (#1257)
* Clean up no longer needed handlers

* Move some log lines to debug verbosity

* Extract type signature code lenses to an HLS plugin

This was worth doing to clean up the messy command handlers

* Extract the block command handler to an HLS plugin

Previously defined together with the type lenses command handler

* fix command capability check

* Extract completions into an HLS plugin

We might want to break them down into multiple HLS plugins
later on (local, non local, and module header).

* Extract code actions into an HLS plugin

* Group ghcide plugins
2021-01-25 08:40:35 +00:00
Peter Wicks Stringfield
b64caa7775 Eliminate redundant $. 2021-01-18 09:01:06 -06:00
Peter Wicks Stringfield
0067b7d64b Eliminate redundant brackets. 2021-01-18 08:54:02 -06:00