From 0a5e7f62b0b73c88f18d2699b7fa9d95276c4339 Mon Sep 17 00:00:00 2001 From: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:42:04 +0200 Subject: [PATCH] fix(python): better basedpyright defaults (#1094) * fix(python): Check for undefined table in before_init func * fix(python): add better defaults to `basedpyright` --------- Co-authored-by: Micah Halter --- lua/astrocommunity/pack/python/init.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lua/astrocommunity/pack/python/init.lua b/lua/astrocommunity/pack/python/init.lua index 2af132252..bac6ad8d8 100644 --- a/lua/astrocommunity/pack/python/init.lua +++ b/lua/astrocommunity/pack/python/init.lua @@ -7,7 +7,29 @@ return { ---@diagnostic disable: missing-fields config = { basedpyright = { - before_init = function(_, c) c.settings.python.pythonPath = vim.fn.exepath "python" end, + before_init = function(_, c) + if not c.settings then c.settings = {} end + if not c.settings.python then c.settings.python = {} end + c.settings.python.pythonPath = vim.fn.exepath "python" + end, + settings = { + basedpyright = { + analysis = { + typeCheckingMode = "basic", + autoImportCompletions = true, + stubPath = vim.env.HOME .. "/typings", + diagnosticSeverityOverrides = { + reportUnusedImport = "information", + reportUnusedFunction = "information", + reportUnusedVariable = "information", + reportGeneralTypeIssues = "none", + reportOptionalMemberAccess = "none", + reportOptionalSubscript = "none", + reportPrivateImportUsage = "none", + }, + }, + }, + }, }, }, },