From fe8a9849312bc08b6b46ae3f3669bfd0f14615a2 Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Sat, 22 Apr 2023 15:09:15 +0200 Subject: [PATCH] feat: added ccls to neovim --- home-manager-modules/neovim/default.nix | 34 ++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/home-manager-modules/neovim/default.nix b/home-manager-modules/neovim/default.nix index fec540f..2dab183 100644 --- a/home-manager-modules/neovim/default.nix +++ b/home-manager-modules/neovim/default.nix @@ -23,7 +23,7 @@ with lib; coc = { enable = true; settings = { - coc.preferences.formatOnSaveFiletypes = [ "nix" "rust" "sql" "python" ]; + coc.preferences.formatOnSaveFiletypes = [ "nix" "rust" "sql" "python" "haskell" ]; rust-analyzer.enable = true; rust-analyzer.cargo.allFeatures = true; rust-analyzer.checkOnSave.allTargets = true; @@ -35,8 +35,23 @@ with lib; }; haskell = { - command = "haskell-language-server"; - filetypes = [ "hs" ]; + command = "haskell-language-server-wrapper"; + args = [ "--lsp" ]; + rootPatterns = [ + "*.cabal" + "cabal.project" + "hie.yaml" + ".stack.yaml" + ]; + filetypes = [ "haskell" "lhaskell" "hs" "lhs" ]; + settings = { + haskell = { + checkParents = "CheckOnSave"; + checkProject = true; + maxCompletions = 40; + formattingProvider = "ormolu"; + }; + }; }; nix = { @@ -49,6 +64,17 @@ with lib; }; }; }; + + ccls = { + command = "ccls"; + filetypes = [ "c" "cpp" "objc" "objcpp" ]; + rootPatterns = [ ".ccls" "compile_commands.json" ".vim/" ".git/" ".hg/" ]; + initializationOptions = { + cache = { + directory = "/tmp/ccls"; + }; + }; + }; }; }; }; @@ -91,7 +117,7 @@ with lib; rust-vim ]; - extraPackages = with pkgs; [ rust-analyzer pkgs.unstable.nil pyright haskell-language-server nixpkgs-fmt ]; + extraPackages = with pkgs; [ rust-analyzer pkgs.unstable.nil pyright nixpkgs-fmt ormolu ccls ]; extraConfig = '' luafile ${./settings.lua}