From c569c12ae77931fb7e3a5011c4253bf91662a71f Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Wed, 21 May 2025 12:11:58 +0200 Subject: [PATCH] feat(lsp): use jedi+pyright until pyrefly is more mature --- lua/ow/lsp/config/jedi_language_server.lua | 20 ++++++++++++++++ lua/ow/lsp/config/pyrefly.lua | 1 + lua/ow/lsp/config/pyright.lua | 27 ++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 lua/ow/lsp/config/jedi_language_server.lua create mode 100644 lua/ow/lsp/config/pyright.lua diff --git a/lua/ow/lsp/config/jedi_language_server.lua b/lua/ow/lsp/config/jedi_language_server.lua new file mode 100644 index 0000000..865798a --- /dev/null +++ b/lua/ow/lsp/config/jedi_language_server.lua @@ -0,0 +1,20 @@ +---@type ServerConfig +return { + mason = { "jedi-language-server" }, + lspconfig = { + filetypes = { + "python", + }, + cmd = { "jedi-language-server" }, + single_file_support = true, + init_options = { + completion = { + disableSnippets = true, + }, + diagnostics = { + enable = true, + }, + }, + }, +} + diff --git a/lua/ow/lsp/config/pyrefly.lua b/lua/ow/lsp/config/pyrefly.lua index a07967d..dd16caf 100644 --- a/lua/ow/lsp/config/pyrefly.lua +++ b/lua/ow/lsp/config/pyrefly.lua @@ -2,6 +2,7 @@ local util = require("lspconfig.util") ---@type ServerConfig return { + enable = false, dependencies = { "pyrefly" }, lspconfig = { cmd = { "pyrefly", "lsp" }, diff --git a/lua/ow/lsp/config/pyright.lua b/lua/ow/lsp/config/pyright.lua new file mode 100644 index 0000000..3397abb --- /dev/null +++ b/lua/ow/lsp/config/pyright.lua @@ -0,0 +1,27 @@ +---@type ServerConfig +return { + mason = { "pyright" }, + lspconfig = { + filetypes = { + "python", + }, + cmd = { "pyright-langserver", "--stdio" }, + single_file_support = true, + -- https://microsoft.github.io/pyright/#/settings + settings = { + python = { + analysis = { + autoSearchPaths = true, + diagnosticMode = "openFilesOnly", + useLibraryCodeForTypes = true, + typeCheckingMode = "strict", + stubPath = "stubs", + }, + }, + pyright = { + disableLanguageServices = true, + }, + }, + }, +} +