From fbb59f134510946dca444e7976c113cd0a072c3c Mon Sep 17 00:00:00 2001 From: Bad Date: Sun, 19 Mar 2023 14:36:16 +0100 Subject: [PATCH] Add dart lsp --- flake.lock | 6 +++--- users/modules/neovim/dart.nix | 20 ++++++++++++++++++++ users/modules/neovim/default.nix | 1 + users/modules/neovim/nvim-lsp.nix | 2 ++ users/profiles/neovim/default.nix | 1 + 5 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 users/modules/neovim/dart.nix diff --git a/flake.lock b/flake.lock index 103c526..e657994 100644 --- a/flake.lock +++ b/flake.lock @@ -434,11 +434,11 @@ }, "latest_2": { "locked": { - "lastModified": 1679231546, - "narHash": "sha256-Lp1UbxFkRCOtJKIG0FAxgGsvoxap1ADyqkCN8a5OzRw=", + "lastModified": 1679232602, + "narHash": "sha256-O7dj7MvfhN0G5BQxMjPEUh13iGGjLT87Wxc4U6EH20E=", "owner": "nixos", "repo": "nixpkgs", - "rev": "eefe9c8bae9abcf7a0ec953f6e18f82d8d86e67a", + "rev": "feb661ff785b95dfbfe780143b66ad21814218fc", "type": "github" }, "original": { diff --git a/users/modules/neovim/dart.nix b/users/modules/neovim/dart.nix new file mode 100644 index 0000000..0f885f9 --- /dev/null +++ b/users/modules/neovim/dart.nix @@ -0,0 +1,20 @@ +{ lib, pkgs, config, ... }: +let + cfg = config.mae.nvim.dart; +in +with lib; +{ + options.mae.nvim.dart.enable = lib.mkEnableOption "Enable dart support in neovim"; + + config = mkIf cfg.enable { + mae.nvim.lsp.servers.dartls = { + enable = true; + script = '' + { + cmd = { "${pkgs.latest.dart}/bin/dart", "language-server" }, + } + ''; + }; + programs.neovim.plugins = with pkgs.vimPlugins; [ dart-vim-plugin ]; + }; +} diff --git a/users/modules/neovim/default.nix b/users/modules/neovim/default.nix index 09e9c53..90e368d 100644 --- a/users/modules/neovim/default.nix +++ b/users/modules/neovim/default.nix @@ -13,6 +13,7 @@ in ./python.nix ./clangd.nix ./elixir.nix + ./dart.nix ]; options.mae.nvim = { diff --git a/users/modules/neovim/nvim-lsp.nix b/users/modules/neovim/nvim-lsp.nix index fa617df..bdd9732 100644 --- a/users/modules/neovim/nvim-lsp.nix +++ b/users/modules/neovim/nvim-lsp.nix @@ -20,6 +20,8 @@ let in { options.mae.nvim.lsp = { + + enable = mkEnableOption "Enable lsp support in nvim with nvim-lspconfig and cmp-nvim"; servers = mkOption { type = types.attrsOf lspLangConfigType; diff --git a/users/profiles/neovim/default.nix b/users/profiles/neovim/default.nix index d806d28..29a8f39 100644 --- a/users/profiles/neovim/default.nix +++ b/users/profiles/neovim/default.nix @@ -11,5 +11,6 @@ clangd.enable = true; python.enable = true; elixir.enable = true; + dart.enable = true; }; }