From 4ccaf51e6598ae34df29dee3132a0b5f24a2af8a Mon Sep 17 00:00:00 2001 From: Henrik Bakken Date: Wed, 24 Sep 2025 00:10:15 +0200 Subject: [PATCH] nvim lsp only use ty for python --- nvim/init.lua | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/nvim/init.lua b/nvim/init.lua index 680e491..6b63bd1 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -382,15 +382,6 @@ local function makespec_lspconfig() on_dir(require("lspconfig").util.root_pattern(unpack(root_markers))(vim.fn.bufname(bufnr))) end end - local pyroot = { - ".git", - "pyproject.toml", - "setup.py", - "setup.cfg", - "requirements.txt", - "Pipfile", - "pyrightconfig.json", - } return { "neovim/nvim-lspconfig", lazy = false, @@ -446,14 +437,20 @@ local function makespec_lspconfig() }, }, }) + vim.lsp.config("ty", { + cmd = { "ty", "server" }, + filetypes = { "python" }, + root_dir = rootdirfix({ ".git", "pyproject.toml", "setup.py", "setup.cfg" }), + settings = { ty = { experimental = { rename = true } } }, + }) vim.lsp.config("pyrefly", { cmd = { "pyrefly", "lsp" }, filetypes = { "python" }, - root_dir = rootdirfix(pyroot), + root_dir = rootdirfix({ ".git", "pyproject.toml", "setup.py", "setup.cfg", "pyrefly.toml" }), }) vim.lsp.config("pylsp", { filetypes = { "python" }, - root_dir = rootdirfix(pyroot), + root_dir = rootdirfix({ ".git", "pyproject.toml", "setup.py", "setup.cfg" }), settings = { pylsp = { plugins = { @@ -470,7 +467,7 @@ local function makespec_lspconfig() vim.lsp.config("basedpyright", { cmd = { "basedpyright-langserver", "--stdio", "--threads", "20" }, filetypes = { "python" }, - root_dir = rootdirfix(pyroot), + root_dir = rootdirfix({ ".git", "pyproject.toml", "setup.py", "setup.cfg", "pyrightconfig.json" }), settings = { python = { analysis = { @@ -532,9 +529,10 @@ local function makespec_lspconfig() vim.lsp.enable("html") vim.lsp.enable("lua_ls") vim.lsp.enable("nushell") + vim.lsp.enable("ty") -- vim.lsp.enable("pyrefly") - vim.lsp.enable("pylsp") - vim.lsp.enable("basedpyright") + -- vim.lsp.enable("pylsp") + -- vim.lsp.enable("basedpyright") vim.lsp.enable("tinymist") vim.lsp.enable("vtsls") vim.lsp.enable("yamlls")