From 94f0bf1c95672f787e64da253f872c6a27b57b94 Mon Sep 17 00:00:00 2001 From: kossLAN Date: Thu, 5 Jun 2025 13:15:25 -0400 Subject: [PATCH] ftplugin: add dart lsp --- nix/neovim-overlay.nix | 1 + nvim/ftplugin/dart.lua | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 nvim/ftplugin/dart.lua diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 35cd41f..ea0d5fc 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -109,6 +109,7 @@ with final.pkgs.lib; let typescript-language-server # css lsp thing qt6.qtdeclarative # qmlls omnisharp-roslyn # c# lsp + dart # dart lsp # autoformatters alejandra # amazing nix autoformatter diff --git a/nvim/ftplugin/dart.lua b/nvim/ftplugin/dart.lua new file mode 100644 index 0000000..68e17b1 --- /dev/null +++ b/nvim/ftplugin/dart.lua @@ -0,0 +1,18 @@ +-- Exit if the language server isn't available +if vim.fn.executable('dart') ~= 1 then + return +end + +local root_files = { + '.git', +} + +local lsp = require('user.lsp') + +vim.lsp.start { + name = 'dartls', + cmd = { 'dart', 'language-server', '--protocol=lsp' }, + root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]), + capabilities = lsp.make_client_capabilities(), + on_attach = lsp.on_attach, +}