Skip to content

Formatting suddenly stopped working #3667

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
chris-martin opened this issue Jun 22, 2023 · 7 comments
Closed

Formatting suddenly stopped working #3667

chris-martin opened this issue Jun 22, 2023 · 7 comments
Labels
status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@chris-martin
Copy link

I have no idea what changed. The autoformat command was working one day, stopped working the next.

When I run the format command in vscode, I see this in the Haskell output tab:

2023-06-22T18:35:59.131211Z | Warning | No plugin enabled for STextDocumentFormatting
[Warn  - 12:35:59 PM] No plugin enabled for STextDocumentFormatting
[Error - 12:35:59 PM] Request textDocument/formatting failed.
  Message: No plugin enabled for STextDocumentFormatting, available: cabalfmt
  Code: -32600 

An example environment can be found here - https://github.com/typeclasses/integer-types/tree/b8ec4030f0e7ca0160b4f83b8334bd21a7938855 - Nix+direnv will install haskell-language-server et al.

My "formatting provider" is set to "ormolu." Ormolu is on the PATH. I notice that the setting description includes has a note says "Ensure the plugin is enabled." but it doesn't say what plugin to enable.

@chris-martin chris-martin added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Jun 22, 2023
@fendor
Copy link
Collaborator

fendor commented Jun 22, 2023

Since only hls-cabal-fmt-plugin is enabled, you have probably upgraded your HLS version to a version where none of the plugins are either installed or available.
So, what's the HLS and GHC version? Should be at the top of the logs.

@chris-martin
Copy link
Author

haskell-language-server version: 1.10.0.0 (GHC: 9.6.2)

@fendor
Copy link
Collaborator

fendor commented Jun 22, 2023

Apparently, no formatter compiles or is compatible with that GHC version, so we can't ship any either. https://haskell-language-server.readthedocs.io/en/latest/support/plugin-support.html#current-plugin-support-tiers

@chris-martin
Copy link
Author

Is there any way I can just get it to run the ormolu that's already installed? I can run ormolu from the command line and it's fine, only HLS has a problem with it.

@fendor
Copy link
Collaborator

fendor commented Jun 24, 2023

No, currently not. I think for ormolu we only support built-in ormolu versions. I think you can do it with fourmolu. Also, maybe building #3668 from source might be helpful.

@michaelpj
Copy link
Collaborator

Unfortunately, although the fourmolu plugin got fixed for 9.6, it wasn't enabled so I don't think it's in the latest release either.

I'm also working on getting stylish-haskell updated: haskell/stylish-haskell#459

@michaelpj
Copy link
Collaborator

Anyway, there is no bug here I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

3 participants