summaryrefslogtreecommitdiffstats
path: root/modules/plugins/lsp/presets/fsautocomplete.nix
blob: cf77c32ed71feba65e788bb8f5719c14f0715c6d (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
  config,
  lib,
  pkgs,
  ...
}: let
  inherit (lib.modules) mkIf;
  inherit (lib.nvim.types) mkLspPresetEnableOption;
  inherit (lib.meta) getExe;
  inherit (lib.generators) mkLuaInline;

  cfg = config.vim.lsp.presets.fsautocomplete;
in {
  options.vim.lsp.presets.fsautocomplete = {
    enable = mkLspPresetEnableOption {
      option = "fsautocomplete";
      display = "F# Autocomplete";
    };
  };

  config = mkIf cfg.enable {
    vim.lsp.servers.fsautocomplete = {
      enable = true;
      cmd = [(getExe pkgs.fsautocomplete) "--adaptive-lsp-server-enabled"];
      root_dir = mkLuaInline ''
        function(bufnr, on_dir)
          on_dir(vim.fs.root(bufnr, function(name, path)
            return name == ".git" or name:match("%.sln$") or name:match("%.fsproj$")
          end))
        end
      '';
      init_options = {
        AutomaticWorkspaceInit = true;
      };
      settings = {
        FSharp = {
          keywordsAutocomplete = true;
          ExternalAutocomplete = false;
          Linter = true;
          UnionCaseStubGeneration = true;
          UnionCaseStubGenerationBody = ''failwith "Not Implemented"'';
          RecordStubGeneration = true;
          RecordStubGenerationBody = ''failwith "Not Implemented"'';
          InterfaceStubGeneration = true;
          InterfaceStubGenerationObjectIdentifier = "this";
          InterfaceStubGenerationMethodBody = ''failwith "Not Implemented"'';
          UnusedOpensAnalyzer = true;
          UnusedDeclarationsAnalyzer = true;
          UseSdkScripts = true;
          SimplifyNameAnalyzer = true;
          ResolveNamespaces = true;
          EnableReferenceCodeLens = true;
        };
      };
    };
  };
}