From 4d76fdc8c3be8b457d878a90363986fc844b3946 Mon Sep 17 00:00:00 2001 From: huyjaky Date: Sat, 4 Jan 2025 11:15:35 +0700 Subject: [PATCH] astro-nvim-v3 - prevent dap ui close when session terminate --- lazy-lock.json | 1 + lua/plugins/astrolsp.lua | 18 ++++++++--- lua/plugins/cmp.lua | 22 ++++++------- .../configs/lsp/config/basedpyright.lua | 15 ++++++--- lua/plugins/faster.lua | 4 +++ lua/plugins/mason.lua | 9 ++---- lua/plugins/neo-tree.lua | 1 + lua/plugins/nvim-dap-ui.lua | 32 +++++++++---------- lua/plugins/treesitter.lua | 2 +- 9 files changed, 60 insertions(+), 44 deletions(-) create mode 100644 lua/plugins/faster.lua diff --git a/lazy-lock.json b/lazy-lock.json index 89a095a..fc88452 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -22,6 +22,7 @@ "cyberdream.nvim": { "branch": "main", "commit": "cd3c2e7955034a5bec0e1beb9d7cb80c639ef5d5" }, "dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" }, "duplicate.nvim": { "branch": "main", "commit": "ab057af7872c44e6fbd48df9b03983c8e67c50a7" }, + "faster.nvim": { "branch": "main", "commit": "c3a5286765b43263791eb736affeb6fdff81e4ef" }, "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" }, diff --git a/lua/plugins/astrolsp.lua b/lua/plugins/astrolsp.lua index 762c38b..84e9a2e 100644 --- a/lua/plugins/astrolsp.lua +++ b/lua/plugins/astrolsp.lua @@ -12,7 +12,7 @@ return { autoformat = false, -- enable or disable auto formatting on start codelens = false, -- enable/disable codelens refresh on start inlay_hints = false, -- enable/disable inlay hints on start - semantic_tokens = true, -- enable/disable semantic token highlighting + semantic_tokens = false, -- enable/disable semantic token highlighting }, -- customize lsp formatting options formatting = require "plugins.configs.lsp.formatting", @@ -23,16 +23,23 @@ return { config = { -- clangd = require "plugins.configs.lsp.config.clangd", basedpyright = require "plugins.configs.lsp.config.basedpyright", - + jedi_language_server = { init_options = { completion = { -- disableSnippets = true, }, - diagnostics = { enable = false, - } + }, + jediSettings = { + autoImportModules = { + "numpy", + "pandas", + "torch", + "sklearn", + }, + }, }, }, ruff = { @@ -71,7 +78,8 @@ return { "TD003", "FIX002", "N803", - "PD901" + "PD901", + "F401", }, fixable = { "ALL" }, }, diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 09cb163..b517a12 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -21,19 +21,19 @@ return { { name = "nvim_lsp", priority = 700, - entry_filter = function(entry, ctx) + -- entry_filter = function(entry, ctx) - local kind = cmp.get_registered_sources() - -- if kind.sources == 'jedi_language_server' then return true end return false - for _, source in ipairs(kind) do - -- Kiểm tra nếu nguồn là 'jedi_language_server' - if source.name == "nvim_lsp" and source.source.client.name == "jedi_language_server" then - return true - end - end + -- local kind = cmp.get_registered_sources() + -- -- if kind.sources == 'jedi_language_server' then return true end return false + -- for _, source in ipairs(kind) do + -- -- Kiểm tra nếu nguồn là 'jedi_language_server' + -- if source.name == "nvim_lsp" and source.source.client.name == "jedi_language_server" then + -- return true + -- end + -- end - return false - end, + -- return false + -- end, }, { name = "buffer", priority = 500 }, { name = "path", priority = 250 }, diff --git a/lua/plugins/configs/lsp/config/basedpyright.lua b/lua/plugins/configs/lsp/config/basedpyright.lua index 5155059..abe3aca 100644 --- a/lua/plugins/configs/lsp/config/basedpyright.lua +++ b/lua/plugins/configs/lsp/config/basedpyright.lua @@ -7,10 +7,12 @@ return { settings = { basedpyright = { + disableOrganizeImports = true, + analysis = { -- diagnosticMode = "workspace", diagnosticMode = "openFilesOnly", - typeCheckingMode = "off", + typeCheckingMode = "basic", autoImportCompletions = false, autoSearchPath = false, logLevel = "error", @@ -18,15 +20,20 @@ return { inlayHints = { variableTypes = true, functionReturnTypes = true, - callArgumentNames = true, + callArgumentNames = false, pytestParameters = true, }, useLibraryCodeForTypes = false, - strictListInference = true, - strictDictionaryInference = true, deprecateTypingAliases = false, enableReachabilityAnalysis = false, + strictListInference = true, + strictDictionaryInference = true, + strictSetInference = true, + + analyzeUnannotatedFunctions = false, + -- ignore = { "**/*.py" }, + diagnosticSeverityOverrides = { reportUnusedImport = "none", reportUnusedFunction = "none", diff --git a/lua/plugins/faster.lua b/lua/plugins/faster.lua new file mode 100644 index 0000000..35d5ba5 --- /dev/null +++ b/lua/plugins/faster.lua @@ -0,0 +1,4 @@ +return { + "pteroctopus/faster.nvim", + opts = {}, +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua index 8dc64e3..27063c4 100644 --- a/lua/plugins/mason.lua +++ b/lua/plugins/mason.lua @@ -12,7 +12,7 @@ return { "lua_ls", -- "jedi_language_server", "ruff", - -- "basedpyright", + "basedpyright", }) end, }, @@ -22,12 +22,7 @@ return { -- overrides `require("mason-null-ls").setup(...)` opts = function(_, opts) -- add more things to the ensure_installed table protecting against community packs modifying it - opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { - -- "stylua", - -- "clang-format", - -- "black", - -- "prettier", - }) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {}) end, }, { diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index 637600c..9694d6e 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -25,6 +25,7 @@ return { '*.rar', '*.pdf', }, + }, }, enable_git_status = false, diff --git a/lua/plugins/nvim-dap-ui.lua b/lua/plugins/nvim-dap-ui.lua index 559514c..a8383f0 100644 --- a/lua/plugins/nvim-dap-ui.lua +++ b/lua/plugins/nvim-dap-ui.lua @@ -43,26 +43,26 @@ return { -- }, }, position = "bottom", - size = 20, + size = 8, }, }, }, - config = function(_, opts) - local dap = require "dap" - local dapui = require "dapui" + -- config = function(_, opts) + -- local dap = require "dap" + -- local dapui = require "dapui" - -- Initialize dap-ui - dapui.setup(opts) + -- -- Initialize dap-ui + -- dapui.setup(opts) - -- Prevent UI from closing when debugging session ends - dap.listeners.after.event_terminated["dapui"] = function() - -- Do nothing, keeping the UI open - end - dap.listeners.after.event_exited["dapui"] = function() - -- Do nothing, keeping the UI open - end + -- -- Prevent UI from closing when debugging session ends + -- dap.listeners.after.event_terminated["dapui"] = function() + -- -- Do nothing, keeping the UI open + -- end + -- dap.listeners.after.event_exited["dapui"] = function() + -- -- Do nothing, keeping the UI open + -- end - -- Optionally, open dap-ui when session starts - dap.listeners.after.event_initialized["dapui"] = function() dapui.open() end - end, + -- -- Optionally, open dap-ui when session starts + -- dap.listeners.after.event_initialized["dapui"] = function() dapui.open() end + -- end, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 55af936..9891436 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -14,7 +14,7 @@ return { }) opts.highlight = { enable = true, - disable = { "c", "rust", "tsx", "javascript", "python"}, + disable = { "c", "rust", "tsx", "javascript"}, additional_vim_regex_highlighting = false, custom_captures = { -- Highlight local variables