summaryrefslogtreecommitdiffstats
path: root/modules/plugins/lsp/presets/solargraph.nix
blob: c0f4ba2403edca512d99073fe0a2a085c61b62ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
  config,
  lib,
  pkgs,
  ...
}: let
  inherit (lib.modules) mkIf;
  inherit (lib.nvim.types) mkLspPresetEnableOption;
  inherit (lib.meta) getExe;

  cfg = config.vim.lsp.presets.solargraph;
in {
  options.vim.lsp.presets.solargraph = {
    enable = mkLspPresetEnableOption {
      option = "solargraph";
      display = "Solargraph";
    };
  };

  config = mkIf cfg.enable {
    vim.lsp.servers.solargraph = {
      enable = true;
      cmd = [(getExe pkgs.rubyPackages.solargraph) "stdio"];
      root_markers = [".git"];
      settings = {
        solargraph = {
          diagnostics = true;
        };
      };
      flags = {
        debounce_text_changes = 150;
      };
      init_options = {
        formatting = true;
      };
    };
  };
}