python: lsp_auto_brackets to set if brackets will be added

This commit is contained in:
ShIRann 2024-04-07 16:48:36 +08:00
parent 97480dc5d2
commit 74a874781b

View file

@ -2,9 +2,11 @@ if lazyvim_docs then
-- LSP Server to use for Python. -- LSP Server to use for Python.
-- Set to "basedpyright" to use basedpyright instead of pyright. -- Set to "basedpyright" to use basedpyright instead of pyright.
vim.g.lazyvim_python_lsp = "pyright" vim.g.lazyvim_python_lsp = "pyright"
vim.g.lazyvim_python_lsp_auto_brackets = true
end end
local lsp = vim.g.lazyvim_python_lsp or "pyright" local lsp = vim.g.lazyvim_python_lsp or "pyright"
local lsp_brackets = vim.g.lazyvim_python_lsp_auto_brackets == nil and true or false
return { return {
{ {
@ -111,8 +113,10 @@ return {
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
opts = function(_, opts) opts = function(_, opts)
if lsp_brackets then
opts.auto_brackets = opts.auto_brackets or {} opts.auto_brackets = opts.auto_brackets or {}
table.insert(opts.auto_brackets, "python") table.insert(opts.auto_brackets, "python")
end
end, end,
}, },
} }