dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

HLS isn't using hlint or stylish-haskell

Open samhh opened this issue 3 years ago • 4 comments

hls: -32600: No plugin enabled for STextDocumentFormatting, available: []

samhh avatar Apr 08 '22 11:04 samhh

Can/should this be configured per-project via Nix? Not sure how comfortably that can interoperate with my nvim config.

samhh avatar Apr 08 '22 11:04 samhh

Possibly should be per-project: https://haskell4nix.readthedocs.io/nixpkgs-users-guide.html#how-to-install-haskell-language-server

Be careful when installing hls globally and using a pinned nixpkgs for a Haskell project in a nix-shell. If the nixpkgs versions deviate to much (e.g. use different glibc versions) hls might fail. It is recommended to then install hls in the nix-shell from the nixpkgs version pinned in there.

If you know, that you only use one ghc version, e.g. in a project specific nix-shell You can either use an override as given above or simply install pkgs.haskellPackages.haskell-language-server instead of the top-level attribute pkgs.haskell-language-server.

samhh avatar Apr 09 '22 18:04 samhh

Tried building from scratch like so and still no HLint:

{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
  buildInputs = with pkgs.haskell.packages.ghc8107; [
    cabal-install
    ghc
    haskell-language-server
    hlint
    # stylish-haskell
  ];

  shellHook = ''
    export NIX_GHC="${pkgs.haskell.packages.ghc8107.ghc}/bin/ghc"
    export NIX_GHCPKG="${pkgs.haskell.packages.ghc8107.ghc}/bin/ghc-pkg"
    export NIX_GHC_DOCDIR="${pkgs.haskell.packages.ghc8107.ghc}/share/doc/ghc/html"
    export NIX_GHC_LIBDIR="${pkgs.haskell.packages.ghc8107.ghc}/lib/ghc-$($NIX_GHC --numeric-version)"
  '';
}

Had some trouble with stylish-haskell hence commenting it out. hls-hlint-plugin also failed to build.

samhh avatar Apr 09 '22 21:04 samhh

No idea. https://github.com/NixOS/nixpkgs/issues/168064

samhh avatar Apr 09 '22 22:04 samhh

FYI: https://github.com/NixOS/nixpkgs/pull/191987.

dschrempf avatar Sep 26 '22 19:09 dschrempf

On a recent nixpkgs-unstable HLS targeting GHC 9.0.2 HLint now works, but stylish-haskell still doesn't. Might be an issue specific to stylish-haskell; tempted to look at other formatters anyway.

samhh avatar Oct 14 '22 20:10 samhh

stylish-haskell is working now too. :blush:

samhh avatar Aug 04 '23 21:08 samhh