astro-nvim-v3 - fix linter2

This commit is contained in:
huyjaky
2025-01-03 11:57:45 +07:00
parent 193a915d3a
commit 11d5685aaa
7 changed files with 139 additions and 43 deletions

View File

@@ -51,6 +51,7 @@
"neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, "neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
"neoconf.nvim": { "branch": "main", "commit": "05d25c121e07c464d6b4203204aa113453eca152" }, "neoconf.nvim": { "branch": "main", "commit": "05d25c121e07c464d6b4203204aa113453eca152" },
"noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" }, "noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" },
"none-ls-extras.nvim": { "branch": "main", "commit": "6557f20e631d2e9b2a9fd27a5c045d701a3a292c" },
"none-ls.nvim": { "branch": "main", "commit": "c279e541f73a2deea9deb5231b9c037678dd6353" }, "none-ls.nvim": { "branch": "main", "commit": "c279e541f73a2deea9deb5231b9c037678dd6353" },
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" }, "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
"nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" }, "nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" },
@@ -59,6 +60,7 @@
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" },
"nvim-highlight-colors": { "branch": "main", "commit": "68a4df620cf58e2c7336e53738e8cf3a522ad694" }, "nvim-highlight-colors": { "branch": "main", "commit": "68a4df620cf58e2c7336e53738e8cf3a522ad694" },
"nvim-lsp-endhints": { "branch": "main", "commit": "a449f2f27b6b985ff216964572224ce432d94a86" },
"nvim-lspconfig": { "branch": "master", "commit": "5a812abc65d529ea7673059a348814c21d7f87ff" }, "nvim-lspconfig": { "branch": "master", "commit": "5a812abc65d529ea7673059a348814c21d7f87ff" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "29b33efc802a304b1cf13ab200915d4e9e67373d" }, "nvim-notify": { "branch": "master", "commit": "29b33efc802a304b1cf13ab200915d4e9e67373d" },

View File

@@ -11,7 +11,7 @@ return {
features = { features = {
autoformat = false, -- enable or disable auto formatting on start autoformat = false, -- enable or disable auto formatting on start
codelens = false, -- enable/disable codelens refresh on start codelens = false, -- enable/disable codelens refresh on start
inlay_hints = true, -- enable/disable inlay hints on start inlay_hints = false, -- enable/disable inlay hints on start
semantic_tokens = true, -- enable/disable semantic token highlighting semantic_tokens = true, -- enable/disable semantic token highlighting
}, },
-- customize lsp formatting options -- customize lsp formatting options
@@ -23,23 +23,76 @@ return {
config = { config = {
-- clangd = require "plugins.configs.lsp.config.clangd", -- clangd = require "plugins.configs.lsp.config.clangd",
basedpyright = require "plugins.configs.lsp.config.basedpyright", basedpyright = require "plugins.configs.lsp.config.basedpyright",
jedi_language_server = { jedi_language_server = {
init_options = { init_options = {
completion = { completion = {
disableSnippets = true, -- disableSnippets = true,
}, },
-- diagnostics = {
-- enable = fa, diagnostics = {
-- } enable = false,
}
}, },
}, },
ruff = { ruff = {
init_options = { init_options = {
settings = { settings = {
args = { lint = {
"--extend-select=W,COM,ICN", select = {
"--ignore=E501,E722,COM812", "ALL",
},
ignore = {
"ANN",
"COM",
"C90",
"DJ",
"EXE",
"T10",
"TID",
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"D200",
"D205",
"D212",
"D400",
"D401",
"D415",
"E402",
"E501",
"TRY003",
"TD002",
"TD003",
"FIX002",
"N803",
"PD901"
},
fixable = { "ALL" },
},
args = {},
},
},
},
pylsp = {
settings = {
pylsp = {
plugins = {
pyflakes = { enabled = false },
pycodestyle = { enabled = false },
autopep8 = { enabled = false },
yapf = { enabled = false },
mccabe = { enabled = false },
-- pylint = { enabled = false },
pylsp_mypy = { enabled = false },
pylsp_black = { enabled = false },
pylsp_isort = { enabled = false },
}, },
}, },
}, },

View File

@@ -16,6 +16,29 @@ return {
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
end end
cmp.setup.filetype("python", {
sources = cmp.config.sources {
{
name = "nvim_lsp",
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
return false
end,
},
{ name = "buffer", priority = 500 },
{ name = "path", priority = 250 },
},
})
return require("astrocore").extend_tbl(opts, { return require("astrocore").extend_tbl(opts, {
-- Configure window style -- Configure window style
window = { window = {
@@ -74,22 +97,4 @@ return {
}) })
end, end,
}, },
-- {
-- "neovim/nvim-lspconfig",
-- opts = function(_, opts)
-- local lspconfig = require "lspconfig"
-- -- Setup `jedi-language-server` for Python files
-- lspconfig.jedi_language_server.setup {
-- on_attach = opts.on_attach,
-- capabilities = opts.capabilities,
-- filetypes = { "python" },
-- }
-- -- Optionally, you can disable pyright
-- lspconfig.pyright.setup {
-- filetypes = {},
-- }
-- end,
-- },
} }

View File

@@ -6,28 +6,37 @@ return {
end, end,
settings = { settings = {
basedpyright = { basedpyright = {
pyright = {enabled = false},
analysis = { analysis = {
-- diagnosticMode = "workspace", -- diagnosticMode = "workspace",
diagnosticMode = "openFilesOnly", diagnosticMode = "openFilesOnly",
typeCheckingMode = "basic", typeCheckingMode = "off",
autoImportCompletions = false, autoImportCompletions = false,
autoSearchPath = true, autoSearchPath = false,
logLevel = "error",
indexing = true,
inlayHints = { inlayHints = {
variableTypes = true, variableTypes = true,
functionReturnTypes = true, functionReturnTypes = true,
callArgumentNames = true, callArgumentNames = true,
pytestParameters = true, pytestParameters = true,
}, },
useLibraryCodeForTypes = true, useLibraryCodeForTypes = false,
strictListInference = true,
strictDictionaryInference = true,
deprecateTypingAliases = false,
enableReachabilityAnalysis = false,
diagnosticSeverityOverrides = { diagnosticSeverityOverrides = {
reportUnusedImport = "information", reportUnusedImport = "none",
reportUnusedFunction = "information", reportUnusedFunction = "none",
reportUnusedVariable = "information", reportUnusedVariable = "none",
-- reportGeneralTypeIssues = "none", reportGeneralTypeIssues = "none",
-- reportOptionalMemberAccess = "none", reportOptionalMemberAccess = "none",
-- reportOptionalSubscript = "none", reportOptionalSubscript = "none",
-- reportPrivateImportUsage = "none", reportPrivateImportUsage = "none",
reportInvalidStubStatement = "none",
reportIncompleteStub = "none",
}, },
}, },
}, },

View File

@@ -10,9 +10,9 @@ return {
-- add more things to the ensure_installed table protecting against community packs modifying it -- 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, { opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
"lua_ls", "lua_ls",
"jedi_language_server", -- "jedi_language_server",
"ruff", "ruff",
"basedpyright", -- "basedpyright",
}) })
end, end,
}, },
@@ -23,7 +23,7 @@ return {
opts = function(_, opts) opts = function(_, opts)
-- add more things to the ensure_installed table protecting against community packs modifying it -- 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, { opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
"stylua", -- "stylua",
-- "clang-format", -- "clang-format",
-- "black", -- "black",
-- "prettier", -- "prettier",
@@ -38,7 +38,7 @@ return {
opts = function(_, opts) opts = function(_, opts)
-- add more things to the ensure_installed table protecting against community packs modifying it -- 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, { opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
"codelldb", -- "codelldb",
"python", "python",
}) })
end, end,

View File

@@ -3,6 +3,10 @@
---@type LazySpec ---@type LazySpec
return { return {
"nvimtools/none-ls.nvim", "nvimtools/none-ls.nvim",
dependencies = {
"nvimtools/none-ls-extras.nvim",
"jay-babu/mason-null-ls.nvim",
},
opts = function(_, opts) opts = function(_, opts)
-- config variable is the default configuration table for the setup function call -- config variable is the default configuration table for the setup function call
local null_ls = require "null-ls" local null_ls = require "null-ls"
@@ -11,7 +15,8 @@ return {
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
opts.sources = { opts.sources = {
-- Set a formatter require('none-ls.formatting.ruff').with { extra_args = { '--extend-select', 'F' } },
require 'none-ls.formatting.ruff_format', -- Set a formatter
} }
return opts return opts
end, end,

View File

@@ -0,0 +1,22 @@
return {
"chrisgrieser/nvim-lsp-endhints",
event = "LspAttach",
opts = {
icons = {
type = "󰜁 ",
parameter = "󰏪 ",
offspec = "", -- hint kind not defined in official LSP spec
unknown = "", -- hint kind is nil
},
label = {
truncateAtChars = 20,
padding = 1,
marginLeft = 0,
sameKindSeparator = ", ",
},
extmark = {
priority = 50,
},
autoEnableHints = true,
},
}