Commit Graph

2848 Commits

Author SHA1 Message Date
Kobayashi
2f886bfdca
handle trailing comma in import list properly (#3035)
* 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
2022-07-16 10:16:55 +00:00
Michael Peyton Jones
fa868b5f34
Simplify hlint config (#3038)
Apparently I was just doing it wrong and naming multiple functions this
way does work properly!
2022-07-13 00:08:43 +01: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
Dmitry Pogodin
b747aa0bd2
Fix Stack build with Nix on macOS (#3031) 2022-07-10 20:23:00 -04:00
ˌbodʲɪˈɡrʲim
b689abb69e
hls-eval-plugin: add lower bound for parser-combinators (#3029) 2022-07-10 01:02:11 +00:00
ˌbodʲɪˈɡrʲim
4b0b99efc1
haskell-language-server: add lower bound for githash (#3030) 2022-07-09 16:44:08 +00:00
ˌbodʲɪˈɡrʲim
531646b047
hls-fourmolu-plugin: add lower bound for process-extras (#3028) 2022-07-09 15:33:09 +01:00
ˌbodʲɪˈɡrʲim
37e6e85f22
ghcide: lower bounds (#3025)
* 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
2022-07-09 11:12:25 +01:00
ˌbodʲɪˈɡrʲim
12095b2e53
hls-plugin-api: add lower bounds (#3022)
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>
2022-07-08 10:07:56 +00:00
Kobayashi
5dc134ef77
remove all usages of pre-commit-check in nix (#3024) 2022-07-08 09:30:30 +01:00
Oliver Madine
0f6cd41d51
Renaming of indirect references (RecordFieldPuns) (#3013)
* 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>
2022-07-07 11:34:18 +00:00
ˌbodʲɪˈɡrʲim
ffefe761c8
hls-graph: add lower bound for async (#3021)
`Control.Concurrent.Async` is not available before `async-2.0`

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-07-06 23:17:38 +00:00
Michael Peyton Jones
293704f612
Improve troubleshooting and installation docs a bit (#3004)
* 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>
2022-07-06 23:04:46 +00:00
Michael Peyton Jones
a32db0b296
Hlint more partial functions, and Debug.Trace (#3000)
* Add partial functions under alternative import names

* Ban tracing functions also

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-07-06 13:36:22 +00:00
Andy
1bc1def498
Hlint: CodeAction with isPreferred (#3018)
* 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.
2022-07-06 12:44:05 +01:00
0rphee
6dcc0eeade
add Helix to configuration.md (#3014) 2022-07-05 15:39:59 +00:00
Kobayashi
344323be54
re-enable haddock (#3015)
* re-enable haddock

* fix it for old GHC

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-07-05 03:49:32 +00:00
Michael Peyton Jones
ffef347fa7
Disable flaky test on Windows (#3008)
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>
2022-07-04 08:42:54 +00:00
Nick Suchecki
d4eea6627c
Missed this during PR fixes (#3009) 2022-07-03 12:08:14 +01:00
Nick Suchecki
73652d7515
Log response errors returned from Plugins (#2988)
* 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
2022-07-01 22:52:51 +00:00
Michael Peyton Jones
510bd51e46
Remove some partial functions from Shake.hs (#2986)
Also removes a partial pattern match from Action.hs.
2022-06-29 09:00:49 +01:00
Attila Gáspár
c3c73cf30b
Add associated type families to local completions (#2987)
Co-authored-by: Lei Zhu <julytreee@gmail.com>
2022-06-28 13:44:42 +00:00
Kobayashi
771d8f44e6
unify pre-commit hook & update Gitpod config (#2991)
* 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
2022-06-28 08:54:32 +00:00
Kobayashi
0b8c793dfd
fix new import position (#2981)
* #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>
2022-06-27 02:01:54 +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
Michael Peyton Jones
efcb8e2589
Set up partial functions ratchet (#2974)
* 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>
2022-06-24 10:46:35 +00:00
Lei Zhu
34618236aa
hls-class-plugin enhancement (#2920)
* hls-class-plugin enhancement

* Comment to be compatible

* Add HasSrcSpan instances

* hls-class-plugin enhancement

* Comment to be compatible

* Add HasSrcSpan instances

* Compitable fix

* Qualified name

* Fix compatibility

* Resolve reviews

* Rename test files

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-06-22 17:30:45 +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
Lei Zhu
0ba7c8da28
Update doc (#2983) 2022-06-22 13:39:31 +00:00
fendor
44be7416c8
Implement PluginMethod for hard-wired in handlers (#2977)
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.
2022-06-20 22:46:42 +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
Zubin Duggal
dc45afc63d Handle exceptions when reading core files 2022-06-20 02:31:10 +05:30
Zubin Duggal
6556ab7ccf GHC 9.2 supports unboxed things in bytecode 2022-06-20 02:31:10 +05:30
Zubin Duggal
41e01ec703 Fix eval plugin 2022-06-20 02:31:10 +05:30
Zubin Duggal
aa2446d0e2 Address some review comments 2022-06-20 02:31:10 +05:30
Zubin Duggal
d29f62436c Don't force codegen from the corefile if we just need the hash 2022-06-20 02:31:10 +05:30
Pepe Iborra
4a1d981503 Values store -> build graph 2022-06-20 02:31:10 +05:30
Pepe Iborra
76c5a0f8e1 fix a few imports 2022-06-20 02:31:10 +05:30
Pepe Iborra
d56f6c506a Shake store -> Values store 2022-06-20 02:31:10 +05:30
Zubin Duggal
37f9ec1eee Fix eval plugin 2022-06-20 02:31:10 +05:30
Zubin Duggal
c047b052b1 Generate bytecode/object code on demand
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.
2022-06-20 02:31:10 +05:30
Zubin Duggal
ae3d178fc3 Serialize core to core files
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
2022-06-20 02:31:10 +05:30
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
Lei Zhu
e64b61e7fd
Support ghc-9.2.3 (#2936)
* Support ghc-9.2.3

* ormolu-0.5

* Update stack.yaml

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
2022-06-16 15:29:38 +08:00
George Thomas
8a5840a020
Merge pull request #2950 from haskell/fourmolu-0.7-fixes
Fix Fourmolu 0.7 support
2022-06-13 19:16:16 +02:00
George Thomas
581686c472 Only use Fourmolu --no-cabal flag on recent versions 2022-06-13 12:25:21 +02:00
George Thomas
0bbc545300 Bump index state
Allows us to use Fourmolu 0.7.
2022-06-12 19:57:45 +01:00
George Thomas
3d9f9a2889 Support Fourmolu 0.7 in CLI mode
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).
2022-06-12 16:10:50 +02:00
Matt Parsons
bb6b4e167a
Support fourmolu ^>= 0.7 (#2944) 2022-06-11 06:45:21 +02:00
Matthieu Coudron
140f9040ae
chore(nix): bump nixpkgs to prevent glibc issues (#2937) 2022-06-01 22:51:30 +01:00