From ff20726ade7005cd84f9b462c987139f0a320652 Mon Sep 17 00:00:00 2001 From: doryan Date: Sun, 13 Apr 2025 00:21:43 +0400 Subject: [PATCH] feat(dev plugins): update plugins configs for developing --- lua/config/plugins/autocomplete.lua | 1 + lua/config/plugins/autotag.lua | 10 +-- lua/config/plugins/dap.lua | 128 ++++++++++++++-------------- lua/config/plugins/lsp_config.lua | 82 +++++++++--------- lua/config/plugins/rustaceanvim.lua | 15 ++-- lua/config/plugins/treesitter.lua | 5 +- 6 files changed, 122 insertions(+), 119 deletions(-) diff --git a/lua/config/plugins/autocomplete.lua b/lua/config/plugins/autocomplete.lua index 3e78b0c..6cc282d 100644 --- a/lua/config/plugins/autocomplete.lua +++ b/lua/config/plugins/autocomplete.lua @@ -89,6 +89,7 @@ cmp.setup{ sources = { { name = "nvim_lsp" }, + { name = "luasnip" }, { name = "buffer" }, { name = "path" }, }, diff --git a/lua/config/plugins/autotag.lua b/lua/config/plugins/autotag.lua index 3be1748..3529ee3 100644 --- a/lua/config/plugins/autotag.lua +++ b/lua/config/plugins/autotag.lua @@ -1,7 +1,7 @@ require('nvim-ts-autotag').setup({ - opts = { - enable_close = true, - enable_rename = true, - enable_close_on_slash = false - }, + opts = { + enable_close = true, + enable_rename = true, + enable_close_on_slash = true, + }, }) diff --git a/lua/config/plugins/dap.lua b/lua/config/plugins/dap.lua index 19477da..ef4cb3b 100755 --- a/lua/config/plugins/dap.lua +++ b/lua/config/plugins/dap.lua @@ -1,88 +1,88 @@ local dap = require('dap') require("dap-vscode-js").setup({ - debugger_path = "/.local/share/lunarvim/site/pack/lazy/opt/vscode-js-debug", - debugger_cmd = { "js-debug-adapter" }, - adapters = { 'node-terminal' }, - }) + debugger_path = "/.local/share/lunarvim/site/pack/lazy/opt/vscode-js-debug", + debugger_cmd = { "js-debug-adapter" }, + adapters = { 'node-terminal' }, +}) dap.configurations.cpp = { - { - name = "Launch file", - type = "codelldb", - request = "launch", - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - cwd = '${workspaceFolder}', - stopOnEntry = false, - }, + { + name = "Launch file", + type = "codelldb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + }, } dap.configurations.c = dap.configurations.cpp dap.configurations.rust = dap.configurations.cpp dap.adapters["pwa-node"] = { - type = "server", - host = "localhost", - port = "${port}", - executable = { - command = "node", - args = {os.getenv("HOME") .. "/.local/share/lvim/mason/packages/js-debug-adapter/js-debug/src/dapDebugServer.js", "${port}"}, - } + type = "server", + host = "localhost", + port = "${port}", + executable = { + command = "node", + args = { os.getenv("HOME") .. "/.local/share/lvim/mason/packages/js-debug-adapter/js-debug/src/dapDebugServer.js", "${port}" }, + } } dap.configurations.javascript = { - { - type = "pwa-node", - request = "launch", - name = "Launch file", - program = "${file}", - cwd = "${workspaceFolder}", - }, + { + type = "pwa-node", + request = "launch", + name = "Launch file", + program = "${file}", + cwd = "${workspaceFolder}", + }, } dap.adapters.chrome = { - type = "executable", - command = "node", - args = {os.getenv("HOME") .. "/.local/share/lvim/mason/packages/chrome-debug-adapter/out/src/chromeDebug.js"}, + type = "executable", + command = "node", + args = { os.getenv("HOME") .. "/.local/share/lvim/mason/packages/chrome-debug-adapter/out/src/chromeDebug.js" }, } dap.adapters.firefox = { - type = 'executable', - command = 'node', - args = {os.getenv('HOME') .. '/.local/share/lvim/mason/packages/firefox-debug-adapter/dist/adapter.bundle.js'}, + type = 'executable', + command = 'node', + args = { os.getenv('HOME') .. '/.local/share/lvim/mason/packages/firefox-debug-adapter/dist/adapter.bundle.js' }, } dap.configurations.typescriptreact = { - { - name = 'Next.js: debug server-side', - type = "pwa-node", - request = "launch", - runtimeExecutable = "npm", - runtimeArgs = { "run", "dev" }, - cwd = "${workspaceFolder}", - }, - { - name = "Next.js: debug client-side with chrome", - type = "chrome", - request = "launch", - url = "http://localhost:3000" - }, - { - name = "Next.js: debug client-side with firefox", - type = "firefox", - request = "launch", - url = 'http://localhost:3000', - webRoot = '${workspaceFolder}', - firefoxExecutable = '/usr/bin/waterfox', - pathMappings = { - { - url = "webpack://_n_e/", - path = "${workspaceFolder}/" - } - }, - }, + { + name = 'Next.js: debug server-side', + type = "pwa-node", + request = "launch", + runtimeExecutable = "npm", + runtimeArgs = { "run", "dev" }, + cwd = "${workspaceFolder}", + }, + { + name = "Next.js: debug client-side with chrome", + type = "chrome", + request = "launch", + url = "http://localhost:3000" + }, + { + name = "Next.js: debug client-side with firefox", + type = "firefox", + request = "launch", + url = 'http://localhost:3000', + webRoot = '${workspaceFolder}', + firefoxExecutable = '/usr/bin/waterfox', + pathMappings = { + { + url = "webpack://_n_e/", + path = "${workspaceFolder}/" + } + }, + }, } dap.configurations.javascriptreact = dap.configurations.typescriptreact; @@ -91,9 +91,9 @@ require("dapui").setup() local dap, dapui = require("dap"), require("dapui") + dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open({}) + dapui.open({}) end vim.keymap.set('n', 'ui', require 'dapui'.toggle) - diff --git a/lua/config/plugins/lsp_config.lua b/lua/config/plugins/lsp_config.lua index 2e026a0..9f9f515 100644 --- a/lua/config/plugins/lsp_config.lua +++ b/lua/config/plugins/lsp_config.lua @@ -1,50 +1,52 @@ local lspconfig = require("lspconfig") +lspconfig.clangd.setup({}) + lspconfig.lua_ls.setup({ - settings = { - Lua = { - hint = { - enable = true, - }, - }, - } + settings = { + Lua = { + hint = { + enable = true, + }, + }, + } }) lspconfig.eslint.setup({ - settings = { - codeActionOnSave = { - enable = true, - mode = "all", - }, - format = true, - } + settings = { + codeActionOnSave = { + enable = true, + mode = "all", + }, + format = true, + } }) lspconfig.ts_ls.setup({ - settings = { - typescript = { - inlayHints = { - includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all' - includeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHints = true, - includeInlayVariableTypeHintsWhenTypeMatchesName = false, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, - }, - }, - javascript = { - inlayHints = { - includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all' - includeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayVariableTypeHints = true, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHintsWhenTypeMatchesName = false, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, - }, - }, - } + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all' + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayVariableTypeHintsWhenTypeMatchesName = false, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all' + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayVariableTypeHints = true, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHintsWhenTypeMatchesName = false, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + } }) diff --git a/lua/config/plugins/rustaceanvim.lua b/lua/config/plugins/rustaceanvim.lua index c717538..d0657b5 100644 --- a/lua/config/plugins/rustaceanvim.lua +++ b/lua/config/plugins/rustaceanvim.lua @@ -1,25 +1,22 @@ local navic = require("nvim-navic") vim.g.rustaceanvim = { - tools = { - autoSetHints = true, - inlay_hints = { - show_parameter_hints = true, - parameter_hints_prefix = "in: ", -- "<- " - other_hints_prefix = "out: " -- "=> " - } - }, server = { on_attach = function(client, bufnr) navic.attach(client, bufnr) end, settings = { ['rust-analyzer'] = { + procMacro = { + enable = true, + }, assist = { importEnforceGranularity = true, importPrefix = "create" }, - cargo = { allFeatures = true }, + cargo = { + allFeatures = true, + }, checkOnSave = { command = "clippy", allFeatures = true diff --git a/lua/config/plugins/treesitter.lua b/lua/config/plugins/treesitter.lua index 92837bf..8eff016 100644 --- a/lua/config/plugins/treesitter.lua +++ b/lua/config/plugins/treesitter.lua @@ -1,8 +1,11 @@ -require'nvim-treesitter.configs'.setup { +require 'nvim-treesitter.configs'.setup { ensure_installed = { 'rust', 'c', 'lua', 'tsx', 'javascript', 'typescript' }, sync_install = false, auto_install = true, highlight = { enable = true, + }, + autotag = { + enable = true, } }