Skip to content

Commit

Permalink
fix(python): better basedpyright defaults (#1094)
Browse files Browse the repository at this point in the history
* fix(python): Check for undefined table in before_init func

* fix(python): add better defaults to `basedpyright`

---------

Co-authored-by: Micah Halter <[email protected]>
  • Loading branch information
Uzaaft and mehalter authored Jul 8, 2024
1 parent 96c8887 commit 0a5e7f6
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion lua/astrocommunity/pack/python/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
},
},
},
},
},
Expand Down

0 comments on commit 0a5e7f6

Please sign in to comment.