adding in dart ls config
This commit is contained in:
+24
-3
@@ -1,4 +1,5 @@
|
|||||||
local lsp = require("lsp-zero")
|
local lsp = require("lsp-zero")
|
||||||
|
local lsp_config = require('lspconfig')
|
||||||
|
|
||||||
lsp.preset("recommended")
|
lsp.preset("recommended")
|
||||||
|
|
||||||
@@ -44,8 +45,7 @@ lsp.set_preferences({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
lsp.on_attach(function(client, bufnr)
|
|
||||||
local opts = { buffer = bufnr, remap = false }
|
local opts = { buffer = bufnr, remap = false }
|
||||||
|
|
||||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
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", "<leader>gr", function() vim.lsp.buf.references() end, opts)
|
vim.keymap.set("n", "<leader>gr", function() vim.lsp.buf.references() end, opts)
|
||||||
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
|
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
|
||||||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
vim.keymap.set("i", "<C-h>", 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.skip_server_setup({ 'rust_analyzer' })
|
||||||
lsp.setup()
|
lsp.setup()
|
||||||
|
|||||||
Reference in New Issue
Block a user