python black

This commit is contained in:
Piotr Domański 2024-07-21 12:14:42 +02:00
parent 98f46a60fd
commit a5d56bdc85

View file

@ -66,7 +66,6 @@ return {
}) })
end, end,
}, },
-- LSP -- LSP
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
@ -78,34 +77,44 @@ return {
{ "williamboman/mason.nvim" }, { "williamboman/mason.nvim" },
}, },
config = function() config = function()
local lsp = require("lsp-zero") require('mason').setup({})
require('mason-lspconfig').setup({
lsp.ensure_installed( -- Replace the language servers listed here
{ -- with the ones you want to install
ensure_installed = {
"lua_ls", "lua_ls",
"gopls", "gopls",
"pylsp", "pylsp",
"tsserver", "tsserver",
},
handlers = {
function(server_name)
require('lspconfig')[server_name].setup({})
end,
} }
) })
local lsp = require("lsp-zero")
lsp.on_attach(function(client, bufnr) lsp.on_attach(function(client, bufnr)
lsp.default_keymaps({ buffer = bufnr }) lsp.default_keymaps({ buffer = bufnr })
end) end)
local read_exec_path = function(exec_name) local nvim_lsp = require("lspconfig")
local handle = io.popen("which " .. exec_name)
local result = handle:read("*a"):gsub("\n", "")
handle:close()
return result
end
nvim_lsp = require("lspconfig")
nvim_lsp.lua_ls.setup(lsp.nvim_lua_ls()) nvim_lsp.lua_ls.setup(lsp.nvim_lua_ls())
nvim_lsp.gopls.setup({}) nvim_lsp.gopls.setup({})
nvim_lsp.dartls.setup({}) nvim_lsp.dartls.setup({})
nvim_lsp.pylsp.setup({})
nvim_lsp.tsserver.setup({}) nvim_lsp.tsserver.setup({})
nvim_lsp.pylsp.setup({
settings = {
pylsp = {
plugins = {
black = { enabled = true },
isort = { enabled = true, profile = "black" },
},
},
},
})
lsp.setup() lsp.setup()
end, end,