summaryrefslogtreecommitdiffstats
path: root/modules/plugins/lsp/presets/dart.nix
blob: 4ce0adc3a317b713ba8c03ec012362a763372516 (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
{
  config,
  lib,
  pkgs,
  ...
}: let
  inherit (lib.modules) mkIf;
  inherit (lib.nvim.types) mkLspPresetEnableOption;
  inherit (lib.meta) getExe;

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

  config = mkIf cfg.enable {
    vim.lsp.servers.dart = {
      enable = true;
      cmd = [(getExe pkgs.dart) "language-server" "--protocol=lsp"];
      root_markers = [".git" "pubspec.yaml"];
      init_options = {
        onlyAnalyzeProjectsWithOpenFiles = true;
        suggestFromUnimportedLibraries = true;
        closingLabels = true;
        outline = true;
        flutterOutline = true;
      };
      settings = {
        dart = {
          completeFunctionCalls = true;
          showTodos = true;
        };
      };
    };
  };
}