Skip to content

Formatters block on session setup #4168

Open
@michaelpj

Description

@michaelpj

At the moment, most of our formatter plugins require the GHC session in order to acquire the DynFlags for a module. This is even true for the CLI modes - most of the plugins still get the flags so that they can pass them to the CLI executable.

This means that formatting is generally going to block until the session is set up. This isn't great: in particular, it's not uncommon to have some kind of format-on-save set up, and that means you can't save a file until HLS is finished setting up! (I think there's also a client problem there: I think it should be the client's responsibility to time out formatting in that case)

So it would be nice if this didn't happen. The best thing I can think of doing is just to let the formatters do whatever they do if they don't get the flags specified. That presumably means guessing them from cabal files etc, but crucially in a way that doesn't block on HLS. It would also make them more likely to line up with how a CLI formatter would operate. Or at least if we're in the CLI mode I think we shouldn't take the flags from HLS, since the whole point is to match what the CLI formatter does.

Thoughts from formatting plugin maintainers? @georgefst @peterbecich ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    HackathonThis issue is suitable for hackathon sessionstype: enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions