* Support initial generic config for plugins
This enables opt-in plugins, i.e. plugins that are not enabled by default
* Support initial generic config for plugins
This enables opt-in plugins, i.e. plugins that are not enabled by default
* Address review comments and remove optionality in configInitialGenericConfig
I can't remember why this was optional in the first place, which probably means no good reason for it to be
* use defConfig instead of def
* test
* descriptor is the golden source for plugin default configs
Read plugin defaults from plugin descriptor instead of copying into initial config
This is less fragile as now the initial generic config specified in the plugin
descriptor is enforced by construction.
The downside is that now the descriptor is needed to parse the config, which
means a few places where a plugin id was enough now require a plugin descriptor,
which is much harder to get. We paper over this by moving these call sites to
the Action monad.
* redundant import
* simplify
* Build fixes
* Build fixes
* pedantic fixes
* Move RangeMap under hls-plugin-api and add benchmark
* Add some documentation
* Rename benchmark case
* Make explicit fields plugin work with RealSrcSpans
* Add test to ensure both filtering approaches are identical
* Add some coverage checks (for reference)
* Remove outdated comment
* Add use-fingertree flag to hls-plugin-api
* Add more instances to RangeMap
* Extend test generators to cover multiline ranges
* Add more documentation
* Extract cabal plugin in its own package
* hls-cabal-plugin: Add plugin
Add golden parse test for test/testdata/simple.cabal
Add module Ide.Plugin.Cabal.Diag
Also: add -Wall
Add parseCabalFileContents
Use VFS for cabal file contents
Diagnostics
* Parse and display Errors
* Parse and display Warnings
Code Actions
* Code Action for License Field
* Add CI workflow
* Add test-suite for hls-cabal-plugin
* Fix various cabal issues
* Update Codeowners file for hls-cabal-plugin
* Document Bytestring is UTF-8 encoded
Co-authored-by: Julian Ospald <hasufell@posteo.de>
* Remove code duplication
* Add cabal files of interest and kick function
Configure a "kick" function for cabal files that is run when the shake
queue needs to be restarted.
Copy pastes from ghcide and 'files of interest'. Maybe more abstraction
needed.
* Add more documentation
* Mark flaky test-case as flaky with issue ref
* Make fendor the only CODEOWNER for hls-cabal-plugin
* Add missing extra-source-files for hls-cabal-plugin
* Add proper CHANGELOG entry for the first version of hls-cabal-plugin
* Add support for Cabal 3.8
* Set diagnostics source to cabal
* Remove unused function
* Add unit tests for code action utilities
* Remove overly specific logging of diagnostics from hls-cabal-plugin
* Improve logging for Cabal FOIs
* Add Range manipulation functions
* Use Range manipulation functions from hls-plugin-api
* Add more documentation for crucial shake restart function
* Add hls-cabal-plugin features to features.md
* Re-use existing GetFileContents rule
Co-authored-by: Fendor <power.walross@gmail.com>
Co-authored-by: fendor <fendor@users.noreply.github.com>
Co-authored-by: Julian Ospald <hasufell@posteo.de>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Add plugin for formatting cabal files using cabal-fmt
* Add 'isolateTests' cabal flag to make plugin install cabal-fmt
For CI, we want to run the tests with a specific cabal-fmt version,
installed automatically by cabal.
However, locally, we might want to test with a locally installed
cabal-fmt version.
This flag allows developers to either let cabal install the
build-tool-depends or install a fitting version locally.
* Ignore failing cabal-fmt test on windows
* Add log message for missing cabal-fmt executable
Co-authored-by: Jana Chadt <jana.chadt@tuwien.ac.at>
Co-authored-by: Fendor <power.walross@gmail.com>
* save some progress: add basic starter code for folding ranges
* save some progress: add function to traverse through coderange and form folding ranges
* save some progress: add parsing of folding ranges
* fix: maybe issue with foldingRanges
* add: generate folding ranges from coderange
* add: plugin request method instance for folding ranges
* ref: alter function and var names
* post review: cleanup crk to frk & fix typo
* fix: find folding ranges function
* format: run formatter and add comments
* fix: return all response results of folding range request
* Revert "format: run formatter and add comments"
This reverts commit e6a2b5ca3e.
* add: removed comments after revert
* fix: formatting
* docs: add folding range to features section and cabal file
* refactor: use destructuring for createFoldingRange function and use characters
* test: add basic unit test for findFoldingRanges function
* test: add tests for children and code kind
* test: add more test cases
* test: add test for createFoldingRange
* test: add integration test for folding ranges
* fix: duplicate start line foldingranges and remove single line
foldingranges
* refactor: duplicate folding range functionality
* fix: formatting in code range plugin
* added more descriptive comments and encorporate code review suggestions
* revert: automatic formatting for selection range test case file
* fix: ignoring children if root fails to provide folding ranges
* remove: redundant match on crkToFrk
* revert: filtering same line foldings and multiple foldings on the same line as it can be handled by clients
* revert: formatting change to selection range test file
* fix: entire file folding because of root node
Co-authored-by: Kobayashi <contact@zelinf.net>
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
All code actions have been moved to hls-refactor-plugin
Mostly straightforward, only slight complication was that completion auto imports
depends on exactprint, but I didn't want to remove all completion logic from ghcide
just for this.
Instead, I added logic to dynamically lookup the plugin that provides
the extend import command, so that auto imports work as expected when you have
hls-refactor-plugin enabled.
Move lookupPluginId out of loop
Replace code actions with lenses in benchmarks
Allow plugins to use GetAnnotatedParsedSource by linking it in when depended on
Move lookupPluginId to IdePlugins
Add default extensions
Move traceAst
* 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
The error message displayed by `prettyResponseError` in
`Development.IDE.Plugin.HLS` looks awkward with the pluginId. This error
is not the fault of plugins anyways, so let's just be generic.
* 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
* 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>
Before `opentelemetry-0.4` `SpanInFlight` is not exported.
Before `dependent-sum-0.7` `GCompare` is not coming from `some`, but is defined elsewhere, which leads to incompatibility with `lsp`.
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Log ResponseErrors when returned from Plugins
* Log from Plugins
* Create 'logAndReturnError' that will log any failures in plugins
* Missed opportunity to use logAndReturnError
* Revert throwPluginError to throwE
This reverts a change made previously to try to make pluginErrors have a
common error format. This will be updated in the near future.
* Warning -> Error
* Fix Functional Test for Plugin Response Error
* Add orphan instances for
* Revert back to Warning
* Update log format in test suite
Don't hard-wire handlers, but make sure all handlers are associated to a
PluginDescriptor, s.t. we can check that the handler is actually enabled
for a given request.
* 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
* 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)'
* 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>
* 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
* Add list of merged prs
* Remove branch trigger
* Update release instructions
* Include 9.2.1 in the current release
* Bump up hls version
* remove duplicate mention
* Remove references to branch name
* Fix cabal.project gen
* Correct fail-fast condition
* Bump up minor version
* Bump up major version
* Bump up major version
* Allow brittany only for 9.0.1
* brittany not supported in hackage and 9.0.2
* Not short hls for hackage
* Bump up versions everywhere
* Update hackage index
* Add ghcide in rename plugin
* Apply linter and add selection demo
* Add header linkable
* Add first version of release description
* Add last prs
* Mention wingman
* Grammar corrections
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
* Correct mention
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
* Warn about th in docs
* Remove reference to install doc
* Rephrasing
Co-authored-by: J. S. <document_done@hotmail.com>
* Better style
Co-authored-by: Junyoung "Clare" Jang <jjc9310@gmail.com>
* Use could to stress it likely will not work
* REmove reliable from the warning
* Reorder comments
* Rephrasing
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Update docs/supported-versions.md
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Use last version of internal deps
* Restore original wording
* One more pr
* One more pr
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
Co-authored-by: J. S. <document_done@hotmail.com>
Co-authored-by: Junyoung "Clare" Jang <jjc9310@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* 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>
* add a failing test case for positionInRange
* fix positionInRange in PluginUtils
* add hls-plugin-api to CI
* fix ci
Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
* Enable tests for brittany and 9.0.2
* Enable tests for floskell plugin
* cabal-ghc901.project: naively enable brittany
* haskell-language-server.cabal: bump brittany flag <(9.0.1->9.2.1)
* Trying to add support for brittany
* Use last hackage floskell version
* Activate floskell in func-test suite
* Restrict brittany in hackage for ghc<9.0.1
* Adapt to Aeson.Key
* Update lsp source repo package
* Refer pr for butcher
* Add missing prefix
* Adapt to aeson-2 (incomplete)
* Use compat module
* Support for aeson-2 and extra-1.7.10
* Remove lsp
* Allow newer aeson for stylish-haskell
* Add needed import for non windows
* Remove insertJson and toJsonKey
* Update cabal-ghc901.project
* Missing import
* Avoid CPP by using lens-aeson
* Update hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs
* Use ghcide compat module
* Use type alias in cpp
* Fix stack build for ghc-8.6.5
* Use lens-aeson key
* Use lens-aeson in func-test
* Fixup shake-bench
* Update docs
* Switch to lens ix
* Try this
Co-authored-by: Anton-Latukha <anton.latukha@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Update to latest version of lsp libraries
* Compute completions on kick
This is not only for faster completions.
It's also needed to have semi-fresh completions after editing.
This is specially important for the first completion request of a file - without this change there are no completions available at all
* Emit LSP custom messages on kick start/finish
useful to synchonize on these events in tests
* Fix completions tests after https://github.com/haskell/lsp/pull/376
* Restore cabal update with comments
* Use new lsp in stack 9.0.1
Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: jneira <atreyu.bbb@gmail.com>
`response`, `handleMaybe`, `handleMaybeM` are three functions that pop
up in a variety of plugins. This commit centralizes these three
functions into one module, and makes the change across the related
plugins.
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
* Use hackage version of czipwith
* Update stack.yaml's
* Remove source czipwith
* Update index and clean cabal-ghc921.project
* extra-1.7.9 has a breaking change so no way
* Increase resources for circleci
As for November 16, circleci has set a timeout of 1 hour for jobs in free plans
Trying to increase resources to make the build faster as suggested by its support center
* Use more threads reduce build times
* Correct runs-on field
* Update stack.yaml's
* Dont fail fast if we are checking
* Use ref_name to check it is a check
* Bump patch version of brittany plugin
* Allow newer base/th for czipwith
* Add enough allow-newers to allow build the project
Having all subpackages included in the `packages` field
* Correct allow-newer's
* Add missing cd's
* Bump up ghcide to 1.5.0
* Exclude pkgs not buildable with 9.0.1
* Bum up plugins with changes versions
* Bum up subpackages with changes versions
* Bum up hls version to 1.5.0
* Bump up haddock plugin version
* Allow ghcide 1.5
* Use ghcide 1.5.0 in the rest of plugins
* Use ghcide 1.5.0 for pragmas
* Allow tactics 1.5.0 for hls
* Remove czipwith in hackage ci script
* Disable 9.0.1 for hackage ci
* Use bounds operator consistently
* Build formatters with newer ghc-lib-parser
* Only stylish-haskell needs newer ghc-lib
* Avoid ghc-9.0.1 in other way
* Script needs a min time version
* First draft of 1.5.0 changelog
* Comment out hackage for 9.0.1
* allow newer ghc-lib-parser
* Remove redundant entry
* Correct condition
* Cancel previous hackage jobs
* Add link to pepe's talk slides
* Use th-extras master
* Use th-extras master and uncomment packages
* add extra-1.7.9
* Add required extra-deps
* Comment unbuildable packages again
* Add ignore-plugins-ghc-bounds
* Add #2354
* Complete ghc deprecation notice
* Add extra-1.7.9
* Add #2346 to Changelog