Skip to content

Sync with upstream #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 29 commits into from
Closed

Sync with upstream #2

wants to merge 29 commits into from

Conversation

9999years
Copy link
Member

Most of the changes in this repo have been upstreamed, so I've pulled changes from upstream and rebased on top of them.

This leaves only a few commits specific to the Mercury fork:

Of these, the sha256 hashes in hls.nix are the new feature here, for supporting Nix flakes in mwb: https://github.com/MercuryTechnologies/mercury-web-backend/pull/9571

parsonsmatt and others added 29 commits June 11, 2022 06:45
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).
Allows us to use Fourmolu 0.7.
* Support ghc-9.2.3

* ormolu-0.5

* Update stack.yaml

Co-authored-by: Pepe Iborra <[email protected]>
* 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".
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
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.
…askell#2956)

* hls-class-plugin: Only create placeholders for unimplemented methods

* hls-class-plugin: Add logs
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.
* 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 <[email protected]>
Co-authored-by: Jana Chadt <[email protected]>
Co-authored-by: Fendor <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* 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>
* 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>
* 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 <[email protected]>
* haskell#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 <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Motivation is to be able to sub-in our own GHC version, and I don't know
how to / if it's possible to do that when everything is defined inside a
flake. Ideally would have the flake use existing non-flake definitions.
Currently uses the .mwb suffix for haskell packages; should remove that
or abstract it.
@9999years 9999years mentioned this pull request Jun 27, 2022
@parsonsmatt
Copy link

Hmm this process should be documented -

I think it's probably good that we have a master branch that is synced with origin master, and then we can have a PR up that shows our changes to master. That way it is easy to see the ways in which our code has diverged from upstream, in the hopes of eventually landing a PR and incorporating these changes somehow.

For the weird regex thing and gitignore, that's.. hopefully something that is going to be fixed upstream of HLS. But really it's a bug of some sort in how nix was compiled on my laptop in particular (WHYYYYYY).

So this PR should ideally get master up-to-date with upstream master, and then we should see the remaining changes that haven't been upstreamed in the diff.

Does that make sense?

@avieth
Copy link
Collaborator

avieth commented Jun 27, 2022

That hls.nix file is something we ought to deal with. I made that because I needed to get HLS to build with the same GHC that mwb is build with. I think a proper good solution would be to change mainline HLS's nix definitions so that everything is exported non-flake and the flake.nix simply picks the inputs and calls the non-flake definitions. I could make a patch and see if the maintainers will consider it.

@matthewbauer matthewbauer self-requested a review June 27, 2022 19:06
@9999years 9999years closed this Jun 27, 2022
@9999years
Copy link
Member Author

Resolution:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.