diff --git a/aspects/dotfiles/files/.home/.zshenv b/aspects/dotfiles/files/.home/.zshenv index 7d6dc5978..d525804bf 100644 --- a/aspects/dotfiles/files/.home/.zshenv +++ b/aspects/dotfiles/files/.home/.zshenv @@ -40,8 +40,8 @@ export SSB_HOME="$XDG_DATA_HOME/zoom" export GTK_THEME="oomox-xresources-reverse" export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" export WGETRC="$XDG_CONFIG_HOME/wgetrc" -export XAUTHORITY="$HOME/.Xauthority" -#export XAUTHORITY="$XDG_CONFIG_HOME/Xauthority" +# export XAUTHORITY="$HOME/.Xauthority" +export XAUTHORITY="$XDG_CONFIG_HOME/Xauthority" export PASSWORD_STORE_DIR="$XDG_CONFIG_HOME/password-store" export MBSYNCRC="$XDG_CONFIG_HOME/mbsync/mbsyncrc" export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config" diff --git a/aspects/dotfiles/files/.local/share/autojump/autojump.txt b/aspects/dotfiles/files/.local/share/autojump/autojump.txt index acc901d88..10a50b8de 100644 Binary files a/aspects/dotfiles/files/.local/share/autojump/autojump.txt and b/aspects/dotfiles/files/.local/share/autojump/autojump.txt differ diff --git a/aspects/dotfiles/files/.local/share/autojump/autojump.txt.bak b/aspects/dotfiles/files/.local/share/autojump/autojump.txt.bak index 9704770ee..e4e3bbb73 100644 Binary files a/aspects/dotfiles/files/.local/share/autojump/autojump.txt.bak and b/aspects/dotfiles/files/.local/share/autojump/autojump.txt.bak differ diff --git a/aspects/dotfiles/files/.local/share/bookmarks/current b/aspects/dotfiles/files/.local/share/bookmarks/current index 11594c1ae..137bb709d 100644 Binary files a/aspects/dotfiles/files/.local/share/bookmarks/current and b/aspects/dotfiles/files/.local/share/bookmarks/current differ diff --git a/aspects/dotfiles/files/.local/share/bookmarks/websites b/aspects/dotfiles/files/.local/share/bookmarks/websites index 887914efa..8ffc0cd37 100644 Binary files a/aspects/dotfiles/files/.local/share/bookmarks/websites and b/aspects/dotfiles/files/.local/share/bookmarks/websites differ diff --git a/aspects/dotfiles/files/.local/share/newsboat/cache.db b/aspects/dotfiles/files/.local/share/newsboat/cache.db index 1c76a4dd8..05215c04f 100644 Binary files a/aspects/dotfiles/files/.local/share/newsboat/cache.db and b/aspects/dotfiles/files/.local/share/newsboat/cache.db differ diff --git a/aspects/dotfiles/files/.local/share/zathura/history b/aspects/dotfiles/files/.local/share/zathura/history index f076d4742..d653c8d03 100644 Binary files a/aspects/dotfiles/files/.local/share/zathura/history and b/aspects/dotfiles/files/.local/share/zathura/history differ diff --git a/aspects/nvim/files/.config/nvim/ftplugin/dart.lua b/aspects/nvim/files/.config/nvim/ftplugin/dart.lua new file mode 100644 index 000000000..677f9bd73 --- /dev/null +++ b/aspects/nvim/files/.config/nvim/ftplugin/dart.lua @@ -0,0 +1,46 @@ +local which_key = require("which-key") +local options = require("config.global").which_key_vars.options + +options = vim.tbl_deep_extend("force", { + filetype = "dart", + buffer = vim.api.nvim_get_current_buf(), +}, options) + +which_key.register({ + ["L"] = { + name = "Language", + p = { "FlutterRun", "Run project" }, + d = { "FlutterDevices", "List connected devices" }, + e = { "FlutterEmulators", "List of emulators" }, + q = { "FlutterQuit", "End running session" }, + D = { "FlutterDetach", "End running session locally" }, + o = { "FlutterOutlineToggle", "Toggle outline window" }, + t = { "FlutterDevTools", "Start Dart Dev Tools server" }, + a = { "FlutterDevToolsActivate", "Start Dart Dev Tools server" }, + P = { "FlutterCopyProfilerUrl", "Copy profiler url to system clipboard" }, + l = { "FlutterLspRestart", "Restart LSP" }, + s = { "FlutterSuper", "Go to super class" }, + r = { "FlutterRename", "Rename and updates imports" }, + }, +}, options) + +local dap = require("dap") +local mason_path = vim.fn.glob(vim.fn.stdpath("data")) .. "/mason/" +local dart_debug_adapter_exec_path = mason_path .. "packages/dart-debug-adapter" + +dap.adapters.dart = { + type = "executable", + command = "node", + args = {dart_debug_adapter_exec_path .. "/extension/out/dist/debug.js", "flutter"} +} +dap.configurations.dart = { + { + type = "dart", + request = "launch", + name = "Launch flutter", + dartSdkPath = os.getenv("HOME") .. "/.config/flutter/bin/cache/dart-sdk/", + flutterSdkPath = os.getenv("HOME") .. "/.config/flutter", + program = "${workspaceFolder}/lib/main.dart", + cwd = "${workspaceFolder}", + } +} diff --git a/aspects/nvim/files/.config/nvim/lua/modules/debugging/plugins.lua b/aspects/nvim/files/.config/nvim/lua/modules/debugging/plugins.lua index db93d6415..90fda9ff7 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/debugging/plugins.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/debugging/plugins.lua @@ -9,6 +9,12 @@ return function(use) "nvim-neotest/neotest-plenary", "nvim-neotest/neotest-vim-test", "haydenmeade/neotest-jest", + { + "sidlatau/neotest-dart", ft = { "dart" }, + config = function() + require("neotest-dart") { command = "flutter" } + end + }, }, }) diff --git a/aspects/nvim/files/.config/nvim/lua/modules/lsp/config.lua b/aspects/nvim/files/.config/nvim/lua/modules/lsp/config.lua index 9e7ac9b8e..364645293 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/lsp/config.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/lsp/config.lua @@ -70,14 +70,14 @@ function config.navigator() cssmodules_ls = { filetypes = { "css" } }, dartls = { filetypes = { "dart" } }, solargraph = { filetypes = { "ruby" } }, - tsserver = require("modules.lsp.settings.tsserver"), + -- tsserver = require("modules.lsp.settings.tsserver"), yamlls = require("modules.lsp.settings.yamlls"), sqlls = require("modules.lsp.settings.sqlls"), cssls = { filetypes = { "css" } }, html = require("modules.lsp.settings.html"), texlab = require("modules.lsp.settings.texlab"), bashls = { filetypes = { "bash", "sh" } }, - clangd = require("modules.lsp.settings.clangd"), + -- clangd = require("modules.lsp.settings.clangd"), tailwindcss = { filetypes = { "html", @@ -178,4 +178,75 @@ function config.glance() }) end +function config.clangd_extensions() + local setup = { + server = { + root_dir = function(...) + return require("lspconfig.util").root_pattern("compile_commands.json", "compile_flags.txt", "configure.ac", ".git")(...) + end, + capabilities = { + offsetEncoding = { "utf-16" }, + }, + cmd = { + "clangd", + "--background-index", + "--clang-tidy", + "--header-insertion=iwyu", + "--completion-style=detailed", + "--function-arg-placeholders", + "--fallback-style=llvm", + }, + init_options = { + usePlaceholders = true, + completeUnimported = true, + clangdFileStatus = true, + }, + }, + extensions = { + inlay_hints = { + inline = true, + }, + }, + } + + require("clangd_extensions").setup { + server = setup.server, + extensions = setup.extensions, + } +end + +function config.flutter_tools() + local line = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" } + + require("flutter-tools").setup({ + ui = { border = line }, + debugger = { + enabled = false, + run_via_dap = false, + exception_breakpoints = {}, + }, + outline = { auto_open = false }, + decorations = { + statusline = { device = true, app_version = true }, + }, + widget_guides = { enabled = true, debug = false }, + dev_log = { enabled = true, open_cmd = "tabedit" }, + lsp = { + color = { + enabled = false, + -- enabled = true, + -- background = true, + -- virtual_text = false, + }, + settings = { + showTodos = true, + renameFilesWithClasses = "always", + updateImportsOnRename = true, + completeFunctionCalls = true, + lineLength = 100, + }, + }, + }) +end + return config diff --git a/aspects/nvim/files/.config/nvim/lua/modules/lsp/handlers.lua b/aspects/nvim/files/.config/nvim/lua/modules/lsp/handlers.lua index 28a20ca0b..ad9d6f5c6 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/lsp/handlers.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/lsp/handlers.lua @@ -92,6 +92,18 @@ lsp.on_attach = function(client, bufnr) if client.name == "sqls" then require("sqls").on_attach(client, bufnr) + elseif client.name == "gopls" then + if not client.server_capabilities.semanticTokensProvider then + local semantic = client.config.capabilities.textDocument.semanticTokens + client.server_capabilities.semanticTokensProvider = { + full = true, + legend = { + tokenTypes = semantic.tokenTypes, + tokenModifiers = semantic.tokenModifiers, + }, + range = true, + } + end end if servers_that_dont_work_with_navic[client.name] ~= nil then @@ -100,19 +112,19 @@ lsp.on_attach = function(client, bufnr) require("colorizer").attach_to_buffer(bufnr) - -- if client.resolved_capabilities.code_lens then - -- local codelens = vim.api.nvim_create_augroup( - -- "LSPCodeLens", - -- { clear = true } - -- ) - -- vim.api.nvim_create_autocmd({ "BufEnter", "InsertLeave", "CursorHold" }, { - -- group = codelens, - -- callback = function() - -- vim.lsp.codelens.refresh() - -- end, - -- buffer = bufnr, - -- }) - -- end + if client.resolved_capabilities.code_lens then + local codelens = vim.api.nvim_create_augroup( + "LSPCodeLens", + { clear = true } + ) + vim.api.nvim_create_autocmd({ "BufEnter", "InsertLeave", "CursorHold" }, { + group = codelens, + callback = function() + vim.lsp.codelens.refresh() + end, + buffer = bufnr, + }) + end end return lsp diff --git a/aspects/nvim/files/.config/nvim/lua/modules/lsp/plugins.lua b/aspects/nvim/files/.config/nvim/lua/modules/lsp/plugins.lua index 20204e301..2400c3405 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/lsp/plugins.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/lsp/plugins.lua @@ -161,8 +161,17 @@ return function(use) build = ":lua require('go.install').update_all_sync()" }) - use({ "akinsho/flutter-tools.nvim", ft = { "dart" } }) - use({ "p00f/clangd_extensions.nvim", ft = { "cpp", "c" } }) + use({ + "akinsho/flutter-tools.nvim", + config = conf.flutter_tools, + ft = { "dart" }, + }) + + use({ + "p00f/clangd_extensions.nvim", + config = conf.clangd_extensions, + ft = { "cpp", "c" }, + }) use({ "hbarral/vim-dadbod", diff --git a/aspects/nvim/files/.config/nvim/lua/modules/lsp/settings/gopls.lua b/aspects/nvim/files/.config/nvim/lua/modules/lsp/settings/gopls.lua index 30284f662..ab6d861da 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/lsp/settings/gopls.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/lsp/settings/gopls.lua @@ -1,14 +1,7 @@ --- local util = require("lspconfig.util") - return { - -- root_dir = util.root_pattern("go.mod", "go.work", ".git"), filtypes = { "go", "gomod", "gowork", "gotmpl" }, settings = { gopls = { - staticcheck = true, - semanticTokens = true, - completeUnimported = true, - usePlaceholders = true, analyses = { unusedparams = true, }, @@ -21,6 +14,9 @@ return { parameterNames = true, rangeVariableTypes = true, }, + staticcheck = true, + semanticTokens = true, }, }, + golangci_lint_ls = {}, } diff --git a/aspects/nvim/files/.config/nvim/lua/modules/ui/config.lua b/aspects/nvim/files/.config/nvim/lua/modules/ui/config.lua index 4732dae98..7ad904b21 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/ui/config.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/ui/config.lua @@ -23,7 +23,11 @@ function config.zen_mode() twilight = { enabled = false }, }, on_open = function() - require("lsp-inlayhints").toggle() + local status, inlayhints = pcall(require, "lsp-inlayhints") + if status then + inlayhints.toggle() + end + vim.g.cmp_active = false vim.cmd("LspStop") local status_ok, _ = pcall(vim.api.nvim_set_option_value, "winbar", nil, { scope = "local" }) @@ -35,7 +39,11 @@ function config.zen_mode() end end, on_close = function() - require("lsp-inlayhints").toggle() + local status, inlayhints = pcall(require, "lsp-inlayhints") + if status then + inlayhints.toggle() + end + vim.g.cmp_active = true vim.cmd("LspStart") end, @@ -45,11 +53,11 @@ end function config.hlslens() require("hlslens").setup() vim.cmd([[ - hi default link HlSearchNear IncSearch - hi default link HlSearchLens WildMenu - hi default link HlSearchLensNear IncSearch - hi default link HlSearchFloat IncSearch - ]]) + hi default link HlSearchNear IncSearch + hi default link HlSearchLens WildMenu + hi default link HlSearchLensNear IncSearch + hi default link HlSearchFloat IncSearch + ]]) local kopts = { noremap = true, silent = true }