* handle trailing comma in import list properly
* no longer backup .ghcup in gitpod
* fix for ghc < 9
* fix it without using CPP
* explain gitpod change
* read trailing comma before adding one
* refine imports
* refine gitpod
* gitpod store ghcide and hie-bios cache
These cache directories are small, but not preserving them requires
HLS to compile all modules in local project on workspace restarts.
* fix code styling
* 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>
* ghcide: lower bounds
Before `ghc-exactprint-1.4` some `instance Default` are missing.
`UnliftIO.Directory` appears only in `unliftio-0.2.6`.
`tasty-hunit < 0.10` does not re-export `HasCallStack`.
* Correct bounds for ghc-exactprint
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>
* test: add tests for record puns
* feat: rename indirect references
refactor: remove "safe" from function names
* test: ignore record field tests for ghc92 (#2915)
* test: ignore record field tests for ghc90 (#2915)
* fix: update record field test ignore message
* expand comment about indirect reference renaming
* fix: find all punned references
* test: ignore record field pun test for ghc > 9
* docs: mention test in indirect pun explaination
* link issue for ignored record field rename tests
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Add material about using versions of GHC that aren't supported yet
* Add a note about clearing out the build cache
* Add note about cabal update to ghcup instructions
* Minor improvements to installing doc
* Tweak ghcup docs more
* Minor fixes
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Add partial functions under alternative import names
* Ban tracing functions also
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Hlint: CodeAction with isPreferred
> A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
For hlint it is the likeliest choice to apply the fix. Ignore the rule
for the complete module is preferred less.
* Hlint: Comment for isPreferred
Including the rationale for why we're making this decision as a comment in the code.
I don't think anyone is going to fix this soon, let's just disable it so
we can move on.
Fixes#2997.
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.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
* #2414 fix new import position
* fix auto import for ghc version < 9.2
* re-fix it for ghc-9.2
* handle comments
* add more comments
* reword comments of findPositionNoImports
Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* 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>
* HLint partial functions
* Delete commented out stuff
* Delete flag-based warnings, unclear they add much
* Delete DA-specific hints
* Delete extra cpp args
* Delete extension options relating to dead build system
* Don't bother trying to restrict CPP for now, it's everywhere
* Make the hlint job fail if there are any errors
* Fix for rebase, add unsafePerformIO and fold1 variants
* Add some more indexing functions
* Try turning off hlint on this test file
* Add .hlint.yaml file for hls-hlint-plugin
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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.
Adds a new rule `GetLinkable` which is called on demand by
hscCompileCoreExprHook whenever a linkable is required for a splice.
Adds a MonadUnliftIO instance for Action to faciliate the above
We write Core Files whenever a linkable could potentially be required for a file
(i.e it is in the transitive closure of a module that uses TH/compile time code
execution)
However, we only generate byte/object code when such a linkable is
really required by a splice (i.e. the module is in the transitive closure
of any symbol called from a splice).
No linkables are stored in `HiFileResult`. If a linkable is required, then
it must be obtained via a call to `GetLinkable`.
Also use hashes to do fine grained recompilation checking for TH instead of
mod times. This simplifies recompilation checking quite a bit.
Add a `.hi.core` file format to which we serialize out compiled core after generating it.
This core is then read back in on subsequent runs and compiled to bytecode.
This greatly speeds up startup times when we need compilation, as we can simply read bytecode
off the disk instead of having to recompile a lot of modules
This is based off Fat Interface files in GHC: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/7502
- Also add --verify-core-file to do roundtrip testing of core-files
- Use closed world assumption for core and .hie files
* 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".
Fourmolu 0.7 (due to Ormolu 0.5) removes the `--cabal-default-extensions` flag, instead looking for Cabal files by default. If input is taken from stdin and `--stdin-input-file` isn't specified, it therefore fails.
We don't need to make any changes in non-CLI mode because the Cabal file handling logic occurs at a higher level outside the entry point we use to the library (the `ormolu` function).