From 22db39f5c2acfc252085adcebb967e630edaa2bf Mon Sep 17 00:00:00 2001 From: talksik Date: Mon, 3 Jul 2023 10:41:42 -0700 Subject: [PATCH] adding in dart ls config --- after/plugin/lsp.lua | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 2964e8a..8a55ade 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -1,4 +1,5 @@ local lsp = require("lsp-zero") +local lsp_config = require('lspconfig') lsp.preset("recommended") @@ -44,8 +45,7 @@ lsp.set_preferences({ } }) - -lsp.on_attach(function(client, bufnr) +local on_attach = function(client, bufnr) local opts = { buffer = bufnr, remap = false } vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) @@ -59,7 +59,28 @@ lsp.on_attach(function(client, bufnr) vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, opts) vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) -end) +end + + +lsp.on_attach(on_attach) + +lsp_config["dartls"].setup({ + on_attach = on_attach, + root_dir = lsp_config.util.root_pattern('.git'), + settings = { + dart = { + analysisExcludedFolders = { + vim.fn.expand("$HOME/AppData/Local/Pub/Cache"), + vim.fn.expand("$HOME/.pub-cache"), + vim.fn.expand("/opt/homebrew/"), + vim.fn.expand("$HOME/tools/flutter/"), + }, + updateImportsOnRename = true, + completeFunctionCalls = true, + showTodos = true, + } + }, +}) lsp.skip_server_setup({ 'rust_analyzer' }) lsp.setup()