replace basedpyright instead by pyrefly and checking syntax by pyright

This commit is contained in:
huyjaky
2025-11-05 18:09:01 +07:00
parent 1f7fda6f21
commit 70f0c7fe5d
8 changed files with 168 additions and 71 deletions

View File

@@ -1,6 +1,6 @@
{ {
"AstroNvim": { "branch": "main", "commit": "55a2b084eabe880c4ffa377f82bb972caec57e09" }, "AstroNvim": { "branch": "main", "commit": "55a2b084eabe880c4ffa377f82bb972caec57e09" },
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, "LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
"aerial.nvim": { "branch": "master", "commit": "6ab1a0ce4874d21610fc5a67a6c82c7b943c635b" }, "aerial.nvim": { "branch": "master", "commit": "6ab1a0ce4874d21610fc5a67a6c82c7b943c635b" },
"astrocore": { "branch": "main", "commit": "c797dd5a592e2bd154f2503e231b8a4083659534" }, "astrocore": { "branch": "main", "commit": "c797dd5a592e2bd154f2503e231b8a4083659534" },
"astrolsp": { "branch": "main", "commit": "0befe28a4ea96e46b7f7c01e4a634c04225ba55a" }, "astrolsp": { "branch": "main", "commit": "0befe28a4ea96e46b7f7c01e4a634c04225ba55a" },
@@ -11,22 +11,22 @@
"better-escape.nvim": { "branch": "master", "commit": "199dcc2643dec5d8dbdab4ec672cf405224dcb3b" }, "better-escape.nvim": { "branch": "master", "commit": "199dcc2643dec5d8dbdab4ec672cf405224dcb3b" },
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
"copilot.vim": { "branch": "release", "commit": "da369d90cfd6c396b1d0ec259836a1c7222fb2ea" }, "copilot.vim": { "branch": "release", "commit": "da369d90cfd6c396b1d0ec259836a1c7222fb2ea" },
"flash.nvim": { "branch": "main", "commit": "3be9bf7e85550045ec576379a0c45aac144d0438" }, "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" },
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
"heirline.nvim": { "branch": "master", "commit": "fae936abb5e0345b85c3a03ecf38525b0828b992" }, "heirline.nvim": { "branch": "master", "commit": "fae936abb5e0345b85c3a03ecf38525b0828b992" },
"lazy.nvim": { "branch": "main", "commit": "db067881fff0fd4be8c00e5bde7492e0e1c77a2f" }, "lazy.nvim": { "branch": "main", "commit": "e6a8824858757ca9cd4f5ae1a72d845fa5c46a39" },
"lazydev.nvim": { "branch": "main", "commit": "01bc2aacd51cf9021eb19d048e70ce3dd09f7f93" }, "lazydev.nvim": { "branch": "main", "commit": "01bc2aacd51cf9021eb19d048e70ce3dd09f7f93" },
"lsp_signature.nvim": { "branch": "master", "commit": "62cadce83aaceed677ffe7a2d6a57141af7131ea" }, "lsp_signature.nvim": { "branch": "master", "commit": "62cadce83aaceed677ffe7a2d6a57141af7131ea" },
"markview.nvim": { "branch": "main", "commit": "c93ea99d96b4bfda5b7c7d0dfca9c26edf6e78f0" }, "markview.nvim": { "branch": "main", "commit": "b41c643a8b99ea556e4dcefb60dbc043f75eb20d" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
"mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" }, "mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" },
"mini.move": { "branch": "main", "commit": "f33406ae7d95b931c6a0d3ba11e50983fe800afb" }, "mini.move": { "branch": "main", "commit": "4d214202d71e0a4066b6288176bbe88f268f9777" },
"neo-tree.nvim": { "branch": "main", "commit": "8cdd6b1940f333c1dd085526a9c45b30fb2dbf50" }, "neo-tree.nvim": { "branch": "main", "commit": "8cdd6b1940f333c1dd085526a9c45b30fb2dbf50" },
"neoconf.nvim": { "branch": "main", "commit": "7a8d7fd36f95f5cbbf57d4a5c463f6c54ad54cd3" }, "neoconf.nvim": { "branch": "main", "commit": "7a8d7fd36f95f5cbbf57d4a5c463f6c54ad54cd3" },
"none-ls-extras.nvim": { "branch": "main", "commit": "402c6b5c29f0ab57fac924b863709f37f55dc298" }, "none-ls-extras.nvim": { "branch": "main", "commit": "402c6b5c29f0ab57fac924b863709f37f55dc298" },
@@ -49,7 +49,7 @@
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" }, "resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" },
"smart-splits.nvim": { "branch": "master", "commit": "ddb23c1a1cf1507bda487cda7f6e4690965ef9f5" }, "smart-splits.nvim": { "branch": "master", "commit": "ddb23c1a1cf1507bda487cda7f6e4690965ef9f5" },
"snacks.nvim": { "branch": "main", "commit": "fc84ed42a44247a99846f6e8d87f0482f15c1787" }, "snacks.nvim": { "branch": "main", "commit": "eadb0ca316ee9af078a181ff9517ce54cb048769" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
"ultimate-autopair.nvim": { "branch": "v0.6", "commit": "6a51446c2c8f09a7c207d2dc2aaa5bbbda36e093" }, "ultimate-autopair.nvim": { "branch": "v0.6", "commit": "6a51446c2c8f09a7c207d2dc2aaa5bbbda36e093" },

View File

@@ -1,4 +1,3 @@
-- Some commands that I want to execute in specific timing -- Some commands that I want to execute in specific timing
vim.api.nvim_create_augroup("disable_comment_newline", { clear = true }) vim.api.nvim_create_augroup("disable_comment_newline", { clear = true })
vim.api.nvim_create_augroup("auto_wrap", { clear = true }) vim.api.nvim_create_augroup("auto_wrap", { clear = true })
@@ -35,3 +34,37 @@ vim.api.nvim_create_autocmd("BufWinEnter", {
pattern = "*", pattern = "*",
command = "let @/ = ''", command = "let @/ = ''",
}) })
-- vim.lsp.config("pyrefly", {
-- -- example of how to run `uv` installed Pyrefly without adding to your path
-- cmd = { "uvx", "pyrefly", "-c", "~/.config/nvim/pyrefly_config.yaml", "lsp" },
-- capabilities = {
-- textDocument = {
-- completion = {
-- completionItem = {
-- snippetSupport = false,
-- preselectSupport = false,
-- },
-- },
-- },
-- },
-- })
vim.lsp.enable "pyrefly"
vim.lsp.config("pyrefly", {
cmd = {
"uvx",
"pyrefly",
"lsp",
},
capabilities = {
textDocument = {
completion = {
completionItem = {
snippetSupport = false,
preselectSupport = false,
},
},
},
},
})

View File

@@ -10,23 +10,26 @@ return {
features = { features = {
autoformat = false, -- enable or disable auto formatting on start autoformat = false, -- enable or disable auto formatting on start
codelens = true, -- enable/disable codelens refresh on start codelens = true, -- enable/disable codelens refresh on start
inlay_hints = false, -- enable/disable inlay hints on start inlay_hints = true, -- 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 -- customize lsp formatting options
formatting = require "plugins.configs.lsp.formatting", formatting = require "plugins.configs.lsp.formatting",
-- enable servers that you already have installed without mason -- enable servers that you already have installed without mason
servers = {}, servers = {}, -- customize language server configuration options passed to `lspconfig`
-- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields ---@diagnostic disable: missing-fields
config = { config = {
-- clangd = require "plugins.configs.lsp.config.clangd",
basedpyright = require "plugins.configs.lsp.config.basedpyright",
jedi_language_server = require "plugins.configs.lsp.config.jedi_language",
pyright = require "plugins.configs.lsp.config.pyright", pyright = require "plugins.configs.lsp.config.pyright",
ruff = require "plugins.configs.lsp.config.ruff", -- basedpyright = require "plugins.configs.lsp.config.basedpyright",
pylsp = require "plugins.configs.lsp.config.pylsp", -- clangd = require "plugins.configs.lsp.config.clangd",
-- jedi_language_server = require "plugins.configs.lsp.config.jedi_language",
-- ruff = require "plugins.configs.lsp.config.ruff",
-- pylsp = require "plugins.configs.lsp.config.pylsp",
pyrefly = {
}
}, },
-- customize how language servers are attached -- customize how language servers are attached
handlers = { handlers = {
@@ -37,11 +40,11 @@ return {
-- the key is the server that is being setup with `lspconfig` -- the key is the server that is being setup with `lspconfig`
-- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server -- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server
-- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed -- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed
}, },
-- Configure buffer local auto commands to add when attaching a language server -- Configure buffer local auto commands to add when attaching a language server
autocmds = { autocmds = {
-- first key is the `augroup` to add the auto commands to (:h augroup) -- first key is the `augroup` to add the auto commands to (:h augroup)
lsp_document_highlight = { lsp_document_highlight = {
-- Optional condition to create/delete auto command group -- Optional condition to create/delete auto command group
-- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean`
@@ -63,6 +66,8 @@ return {
callback = function() vim.lsp.buf.clear_references() end, callback = function() vim.lsp.buf.clear_references() end,
}, },
}, },
-- NOTE: start
-- disable inlay hints in insert mode -- disable inlay hints in insert mode
disable_inlay_hints_on_insert = { disable_inlay_hints_on_insert = {
-- only create for language servers that support inlay hints -- only create for language servers that support inlay hints
@@ -89,6 +94,7 @@ return {
end, end,
}, },
}, },
-- ----------------------------------------------------------------------------------
}, },
-- mappings to be set up on attaching of a language server -- mappings to be set up on attaching of a language server
mappings = { mappings = {
@@ -99,55 +105,84 @@ return {
on_attach = function(client, bufnr) on_attach = function(client, bufnr)
-- this would disable semanticTokensProvider for all clients -- this would disable semanticTokensProvider for all clients
-- client.server_capabilities.semanticTokensProvider = nil -- client.server_capabilities.semanticTokensProvider = nil
-- Disable ruff_lsp hover in favor of pyright -- Disable ruff_lsp hover in favor of pyright
if client.name == "ruff" then -- if client.name == "ruff" then
-- client.server_capabilities.hoverProvider = false
-- client.server_capabilities.completionProvider = false
-- end
-- if client.name == "jedi_language_server" then client.server_capabilities.renameProvider = false end
if client.name == "pyright" then
client.server_capabilities.hoverProvider = false client.server_capabilities.hoverProvider = false
client.server_capabilities.completionProvider = false client.server_capabilities.renameProvider = false
end client.server_capabilities.signatureHelpProvider = nil
client.server_capabilities.completionProvider = nil
-- if client.name == "pyright" then client.server_capabilities.definitionProvider = false
-- -- disable pyright analysis features client.server_capabilities.codeLensProvider = nil
-- client.server_capabilities.documentFormattingProvider = false
-- client.server_capabilities.hoverProvider = false
-- end
if client.name == "jedi_language_server" then client.server_capabilities.renameProvider = false end
if client.name == "basedpyright" then
-- client.server_capabilities.completionProvider = false
-- client.server_capabilities.hoverProvider = false
-- client.server_capabilities.renameProvider = false
-- client.server_capabilities.definitionProvider = false
-- client.server_capabilities.signatureHelpProvider = false
client.server_capabilities.codeLensProvider = false
client.server_capabilities.colorProvider = false client.server_capabilities.colorProvider = false
client.server_capabilities.callHierarchyProvider = false client.server_capabilities.callHierarchyProvider = false
client.server_capabilities.documentFormattingProvider = false client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false client.server_capabilities.documentRangeFormattingProvider = false
client.server_capabilities.declarationProvider = false client.server_capabilities.declarationProvider = false
client.server_capabilities.documentLinkProvider = false client.server_capabilities.documentLinkProvider = nil
client.server_capabilities.documentOnTypeFormattingProvider = false client.server_capabilities.documentOnTypeFormattingProvider = nil
client.server_capabilities.documentSymbolProvider = false client.server_capabilities.documentSymbolProvider = false
client.server_capabilities.inlineCompletionProvider = false client.server_capabilities.inlineCompletionProvider = false
client.server_capabilities.inlineValueProvider = false client.server_capabilities.inlineValueProvider = false
client.server_capabilities.notebookDocumentSync = false client.server_capabilities.notebookDocumentSync = nil
client.server_capabilities.typeDefinitionProvider = false client.server_capabilities.typeDefinitionProvider = false
client.server_capabilities.workspaceSymbolProvider = false client.server_capabilities.workspaceSymbolProvider = false
client.server_capabilities.monikerProvider = false client.server_capabilities.monikerProvider = false
client.server_capabilities.semanticTokensProvider = false client.server_capabilities.semanticTokensProvider = nil
client.server_capabilities.referencesProvider = false client.server_capabilities.referencesProvider = false
client.server_capabilities.implementationProvider = false client.server_capabilities.implementationProvider = false
client.server_capabilities.foldingRangeProvider = false client.server_capabilities.foldingRangeProvider = false
client.server_capabilities.selectionRangeProvider = false client.server_capabilities.selectionRangeProvider = false
client.server_capabilities.linkedEditingRangeProvider = false client.server_capabilities.linkedEditingRangeProvider = false
client.server_capabilities.executeCommandProvider = false client.server_capabilities.executeCommandProvider = nil
client.server_capabilities.workspace = { client.server_capabilities.workspace = {
workspaceFolders = { supported = false }, workspaceFolders = { supported = false },
fileOperations = { supported = false }, fileOperations = { supported = false },
} }
end end
-- if client.name == "basedpyright" then
-- -- client.server_capabilities.definitionProvider = false # turn on inlay hints
-- client.server_capabilities.renameProvider = false
-- client.server_capabilities.completionProvider = nil
-- client.server_capabilities.hoverProvider = false
-- client.server_capabilities.signatureHelpProvider = nil
--
-- client.server_capabilities.codeLensProvider = nil
-- client.server_capabilities.colorProvider = false
-- client.server_capabilities.callHierarchyProvider = false
-- client.server_capabilities.documentFormattingProvider = false
-- client.server_capabilities.documentRangeFormattingProvider = false
-- client.server_capabilities.declarationProvider = false
-- client.server_capabilities.documentLinkProvider = nil
-- client.server_capabilities.documentOnTypeFormattingProvider = nil
-- client.server_capabilities.documentSymbolProvider = false
-- client.server_capabilities.inlineCompletionProvider = false
-- client.server_capabilities.inlineValueProvider = false
-- client.server_capabilities.notebookDocumentSync = nil
-- client.server_capabilities.typeDefinitionProvider = false
-- client.server_capabilities.workspaceSymbolProvider = false
-- client.server_capabilities.monikerProvider = false
-- client.server_capabilities.semanticTokensProvider = nil
-- client.server_capabilities.referencesProvider = false
-- client.server_capabilities.implementationProvider = false
-- client.server_capabilities.foldingRangeProvider = false
-- client.server_capabilities.selectionRangeProvider = false
-- client.server_capabilities.linkedEditingRangeProvider = false
-- client.server_capabilities.executeCommandProvider = nil
-- client.server_capabilities.workspace = {
-- workspaceFolders = { supported = false },
-- fileOperations = { supported = false },
-- }
-- end
end, end,
}, },
} }

View File

@@ -35,7 +35,7 @@ return {
completion = { completion = {
list = { list = {
selection = { selection = {
preselect = true, -- preselect = true,
-- auto_insert = true, -- auto_insert = true,
}, },
}, },

View File

@@ -5,33 +5,42 @@ return {
c.settings.python.pythonPath = vim.fn.exepath "python3" c.settings.python.pythonPath = vim.fn.exepath "python3"
end, end,
settings = { settings = {
python = false,
basedpyright = { basedpyright = {
disableLanguageServices = false, disableLanguageServices = false,
disableOrganizeImports = true, disableOrganizeImports = true,
disableTaggedHints = true, disableTaggedHints = true,
useLibraryCodeForTypes = true,
useLibraryCodeForTypes = false,
openFilesOnly = true, openFilesOnly = true,
analysis = { analysis = {
autoSearchPath = false, verboseOutput = false,
useLibraryCodeForTypes = false, autoImportCompletions = false,
logLevel = "Trace", pythonPlatform = "Linux",
autoSearchPaths = true,
typeCheckingMode = "basic",
deprecateTypingAliases = false, deprecateTypingAliases = false,
diagnosticMode = "openFilesOnly", logLevel = "Error",
typeCheckingMode = "off",
inlayHints = { inlayHints = {
variableTypes = true, variableTypes = false,
genericTypes = true, genericTypes = true,
callArgumentNames = false, callArgumentNames = true,
},
exclude = {
"**/unsloth_compiled_cache/**",
"**/__pycache__/**",
"**/.venv/**",
"__index__",
"**/.*",
}, },
ignore = { ignore = {
"**/unsloth_compiled_cache/**", "**/unsloth_compiled_cache/**",
"**/__pycache__/**", "**/__pycache__/**",
"__index__", "__index__",
"**/.venv/**",
"**/*.ipynb",
}, },
autoImportCompletions = false,
}, },
}, },
}, },

View File

@@ -4,17 +4,38 @@ return {
if not c.settings.python then c.settings.python = {} end if not c.settings.python then c.settings.python = {} end
c.settings.python.pythonPath = vim.fn.exepath "python3" c.settings.python.pythonPath = vim.fn.exepath "python3"
end, end,
settings = { settings = {
pyright = { python = {
disableLanguageServices = false, disableLanguageServices = true,
disableOrganizeImports = true, disableOrganizeImports = true,
analysis = { disableTaggedHints = true,
diagnosticMode = "openFilesOnly", openFilesOnly = true,
typeCheckingMode = "basic", useLibraryCodeForTypes = false,
autoSearchPath = true,
-- diagnosticSeverityOverrides = false, analysis = {
logLevel = "Error", useLibraryCodeForTypes = false,
}, autoImportCompletions = false,
}, diagnosticMode = "openFilesOnly",
}, typeCheckingMode = "off",
autoSearchPath = false,
logLevel = "Error",
verboseOutput = false,
pythonPlatform = "Linux",
exclude = {
"**/unsloth_compiled_cache/**",
"**/__pycache__/**",
"**/.venv/**",
"__index__",
"**/.*",
},
ignore = {
"**/unsloth_compiled_cache/**",
"**/__pycache__/**",
"__index__",
"**/.venv/**",
"**/*.ipynb",
},
},
},
},
} }

View File

@@ -9,7 +9,7 @@ return {
type = "󰜁 ", type = "󰜁 ",
parameter = "󰏪 ", parameter = "󰏪 ",
offspec = "󰀒 ", -- hint kind not defined in official LSP spec offspec = "󰀒 ", -- hint kind not defined in official LSP spec
unknown = " ", -- hint kind is nil unknown = " ", -- hint kind is nil
}, },
label = { label = {
truncateAtChars = 100, truncateAtChars = 100,

View File

@@ -2,5 +2,4 @@
-- This is just pure lua so anything that doesn't -- This is just pure lua so anything that doesn't
-- fit in the normal config locations above can go here -- fit in the normal config locations above can go here
require"core.autocmds" require "core.autocmds"