From 3b15748e9c831161c55470dcdaa31f9c21559d9d Mon Sep 17 00:00:00 2001 From: cryxtalix Date: Mon, 11 May 2026 01:39:07 +0800 Subject: Fix pyright. --- .config/nvim/init.lua | 1 + .config/nvim/lsp/lua_ls.lua | 19 ------------------- .config/nvim/lsp/pyright.lua | 16 ---------------- .config/nvim/lua/configs/pyright.lua | 23 +++++++++++++++++++++++ .config/nvim/nvim-pack-lock.json | 5 +++++ 5 files changed, 29 insertions(+), 35 deletions(-) delete mode 100644 .config/nvim/lsp/lua_ls.lua delete mode 100644 .config/nvim/lsp/pyright.lua create mode 100644 .config/nvim/lua/configs/pyright.lua (limited to '.config/nvim') diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 160ef63..d7f4bb8 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -2,6 +2,7 @@ require("configs.basic") require("configs.vim-plug") require("configs.lsp") +require("configs.pyright") -- Install plugins with native vim.pack -- require("plugins.mason") diff --git a/.config/nvim/lsp/lua_ls.lua b/.config/nvim/lsp/lua_ls.lua deleted file mode 100644 index c0a6d56..0000000 --- a/.config/nvim/lsp/lua_ls.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - -- Command and arguments to start the server. - cmd = { 'lua-language-server' }, - -- Filetypes to automatically attach to. - filetypes = { 'lua' }, - -- Sets the "workspace" to the directory where any of these files is found. - -- Files that share a root directory will reuse the LSP server connection. - -- Nested lists indicate equal priority, see |vim.lsp.Config|. - root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' }, - -- Specific settings to send to the server. The schema is server-defined. - -- Example: https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json - settings = { - Lua = { - runtime = { - version = 'LuaJIT', - } - } - } -} diff --git a/.config/nvim/lsp/pyright.lua b/.config/nvim/lsp/pyright.lua deleted file mode 100644 index aece9a7..0000000 --- a/.config/nvim/lsp/pyright.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - cmd = { "pyright-langserver", "--stdio" }, - filetypes = { "python" }, - root_dir = function(filename) - return util.root_pattern(unpack(root_files))(filename) or util.path.dirname(filename) - end, - settings = { - python = { - analysis = { - autoSearchPaths = true, - diagnosticMode = "workspace", - useLibraryCodeForTypes = true - } - } - } -} diff --git a/.config/nvim/lua/configs/pyright.lua b/.config/nvim/lua/configs/pyright.lua new file mode 100644 index 0000000..e15a7fb --- /dev/null +++ b/.config/nvim/lua/configs/pyright.lua @@ -0,0 +1,23 @@ +vim.pack.add({ + { + src = "https://github.com/neovim/nvim-lspconfig", + version = 'master', + }, +}) + +vim.lsp.config['pyright'] = { + cmd = { "pyright-langserver", "--stdio" }, + filetypes = { "python" }, + + settings = { + python = { + analysis = { + autoSearchPaths = true, + diagnosticMode = "workspace", + useLibraryCodeForTypes = true + } + } + } +} + +vim.lsp.enable('pyright') diff --git a/.config/nvim/nvim-pack-lock.json b/.config/nvim/nvim-pack-lock.json index e09663c..c884659 100644 --- a/.config/nvim/nvim-pack-lock.json +++ b/.config/nvim/nvim-pack-lock.json @@ -44,6 +44,11 @@ "src": "https://github.com/hrsh7th/nvim-cmp", "version": "'main'" }, + "nvim-lspconfig": { + "rev": "451d4ef9abd4f0f08e379ef0d55d1c391b6125a7", + "src": "https://github.com/neovim/nvim-lspconfig", + "version": "'master'" + }, "nvim-treesitter": { "rev": "4916d6592ede8c07973490d9322f187e07dfefac", "src": "https://github.com/nvim-treesitter/nvim-treesitter" -- cgit