From 727a6bcfbc1b1bad0c2bfe1a001d6e241a8041c4 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Wed, 27 Mar 2024 02:41:32 +0100 Subject: [PATCH] add flutter plugin and config --- lua/lsp.lua | 19 +++++++----- lua/plugins/flutter.lua | 66 +++++++++++++++++++++++++++++++++++++++++ lua/plugins/init.lua | 8 +++++ 3 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 lua/plugins/flutter.lua diff --git a/lua/lsp.lua b/lua/lsp.lua index e133dfa..a659fe2 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -13,9 +13,6 @@ local on_attach = function(client, bufnr) utils.map("n", "wa", "lua vim.lsp.buf.add_workspace_folder()") utils.map("n", "wr", "lua vim.lsp.buf.remove_workspace_folder()") - -- use vim's default coloring - client.server_capabilities.semanticTokensProvider = nil - if client.supports_method("textDocument/formatting") then vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) vim.api.nvim_create_autocmd("BufWritePre", { @@ -26,6 +23,12 @@ local on_attach = function(client, bufnr) 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 local nvim_lsp = require('lspconfig') @@ -34,6 +37,7 @@ local capabilities = vim.lsp.protocol.make_client_capabilities() -- LSPs local servers = { "clangd", + "dartls", "gleam", "lua_ls", "ocamllsp", @@ -63,9 +67,9 @@ nvim_lsp.rust_analyzer.setup({ enable = true, }, }, - --procMacro = { - -- enable = true - --}, + procMacro = { + enable = true + }, checkOnSave = { command = "clippy", }, @@ -105,8 +109,7 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = do local method = "textDocument/publishDiagnostics" local default_handler = vim.lsp.handlers[method] - vim.lsp.handlers[method] = function(err, method, result, client_id, bufnr, - config) + vim.lsp.handlers[method] = function(err, method, result, client_id, bufnr, config) default_handler(err, method, result, client_id, bufnr, config) local diagnostics = vim.diagnostic.get() local qflist = {} diff --git a/lua/plugins/flutter.lua b/lua/plugins/flutter.lua new file mode 100644 index 0000000..5bafc9e --- /dev/null +++ b/lua/plugins/flutter.lua @@ -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 = { + -- + -- } + --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 = { "" }, + renameFilesWithClasses = "prompt", + enableSnippets = true, + updateImportsOnRename = true, + } + } +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 27b2b4f..1710b77 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -81,6 +81,13 @@ require('packer').startup(function() -- Misc use { 'jbyuki/venn.nvim' } -- ascii diagrams use { 'hashivim/vim-terraform' } + use { + 'akinsho/flutter-tools.nvim', + requires = { + 'nvim-lua/plenary.nvim', + 'stevearc/dressing.nvim', -- optional for vim.ui.select + }, + } end) require('plugins.cmp') @@ -89,3 +96,4 @@ require('plugins.neogit') require('plugins.oil') require('plugins.telescope') require('plugins.venn') +require("plugins.flutter")