add flutter plugin and config

This commit is contained in:
Vladan Popovic 2024-03-27 02:41:32 +01:00
parent a35b743b62
commit 727a6bcfbc
3 changed files with 85 additions and 8 deletions

View file

@ -13,9 +13,6 @@ local on_attach = function(client, bufnr)
utils.map("n", "<leader>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>") utils.map("n", "<leader>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
utils.map("n", "<leader>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>") utils.map("n", "<leader>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>")
-- use vim's default coloring
client.server_capabilities.semanticTokensProvider = nil
if client.supports_method("textDocument/formatting") then if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", { vim.api.nvim_create_autocmd("BufWritePre", {
@ -26,6 +23,12 @@ local on_attach = function(client, bufnr)
end, end,
}) })
end end
-- use vim's default coloring
client.server_capabilities.semanticTokensProvider = nil
for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do
vim.api.nvim_set_hl(0, group, {})
end
end end
local nvim_lsp = require('lspconfig') local nvim_lsp = require('lspconfig')
@ -34,6 +37,7 @@ local capabilities = vim.lsp.protocol.make_client_capabilities()
-- LSPs -- LSPs
local servers = { local servers = {
"clangd", "clangd",
"dartls",
"gleam", "gleam",
"lua_ls", "lua_ls",
"ocamllsp", "ocamllsp",
@ -63,9 +67,9 @@ nvim_lsp.rust_analyzer.setup({
enable = true, enable = true,
}, },
}, },
--procMacro = { procMacro = {
-- enable = true enable = true
--}, },
checkOnSave = { checkOnSave = {
command = "clippy", command = "clippy",
}, },
@ -105,8 +109,7 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] =
do do
local method = "textDocument/publishDiagnostics" local method = "textDocument/publishDiagnostics"
local default_handler = vim.lsp.handlers[method] local default_handler = vim.lsp.handlers[method]
vim.lsp.handlers[method] = function(err, method, result, client_id, bufnr, vim.lsp.handlers[method] = function(err, method, result, client_id, bufnr, config)
config)
default_handler(err, method, result, client_id, bufnr, config) default_handler(err, method, result, client_id, bufnr, config)
local diagnostics = vim.diagnostic.get() local diagnostics = vim.diagnostic.get()
local qflist = {} local qflist = {}

66
lua/plugins/flutter.lua Normal file
View file

@ -0,0 +1,66 @@
require("flutter-tools").setup {
ui = {
border = "rounded",
notification_style = 'native'
},
decorations = {
statusline = {
app_version = false,
device = false,
project_config = false,
}
},
debugger = {
enabled = false,
run_via_dap = false,
exception_breakpoints = {},
--register_configurations = function(paths)
-- require("dap").configurations.dart = {
-- <put here config that you would find in .vscode/launch.json>
-- }
--end,
},
flutter_path = "/usr/bin/flutter",
flutter_lookup_cmd = nil,
root_patterns = { ".git", "pubspec.yaml" },
fvm = false,
widget_guides = {
enabled = false,
},
closing_tags = {
highlight = "Comment",
prefix = "/ ",
enabled = true,
},
dev_log = {
enabled = true,
notify_errors = false,
open_cmd = "tabedit",
},
dev_tools = {
autostart = false,
auto_open_browser = false,
},
outline = {
open_cmd = "30vnew",
auto_open = false,
},
lsp = {
color = {
enabled = false,
background = false,
background_color = nil,
foreground = false,
virtual_text = false,
virtual_text_str = "",
},
settings = {
showTodos = true,
completeFunctionCalls = true,
-- analysisExcludedFolders = { "<path-to-flutter-sdk-packages>" },
renameFilesWithClasses = "prompt",
enableSnippets = true,
updateImportsOnRename = true,
}
}
}

View file

@ -81,6 +81,13 @@ require('packer').startup(function()
-- Misc -- Misc
use { 'jbyuki/venn.nvim' } -- ascii diagrams use { 'jbyuki/venn.nvim' } -- ascii diagrams
use { 'hashivim/vim-terraform' } use { 'hashivim/vim-terraform' }
use {
'akinsho/flutter-tools.nvim',
requires = {
'nvim-lua/plenary.nvim',
'stevearc/dressing.nvim', -- optional for vim.ui.select
},
}
end) end)
require('plugins.cmp') require('plugins.cmp')
@ -89,3 +96,4 @@ require('plugins.neogit')
require('plugins.oil') require('plugins.oil')
require('plugins.telescope') require('plugins.telescope')
require('plugins.venn') require('plugins.venn')
require("plugins.flutter")