null-ls: add black
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "e2b82cf4c68b453eeab5833d90c042ed4b49d0e1" },
|
||||
"mason.nvim": { "branch": "main", "commit": "f557094c77c4fa91c3613cfbd22cbcdbe0569793" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "d4594231a06cecce73a78a256b0d7c7ab51f7dd5" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "45ae3122a4c7744db41298b41f9f5a3f092123e6" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "aae0c3e4e778ca4be6fabc52e388cbd5b844b7a5" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "1712672e4da3003a0dd9f771d30389600b360f42" },
|
||||
|
||||
+19
-4
@@ -9,6 +9,11 @@ return { {
|
||||
},
|
||||
config = function(_, opts)
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Avoiding LSP formatting conflicts
|
||||
local null_ls_table = { pyright = true }
|
||||
if null_ls_table[client.name] then
|
||||
client.server_capabilities.documentFormattingProvider = false -- 0.8 and later
|
||||
end
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
@@ -43,18 +48,29 @@ return { {
|
||||
map("n", "<Leader>fm", vim.lsp.buf.format, { desc = "Format Document" })
|
||||
end
|
||||
local lspconfig = require('lspconfig')
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local lsp_formatting = function(bufnr)
|
||||
vim.lsp.buf.format({
|
||||
filter = function(client)
|
||||
-- apply whatever logic you want (in this example, we'll only use null-ls)
|
||||
return client.name == "null-ls"
|
||||
end,
|
||||
bufnr = bufnr,
|
||||
})
|
||||
end
|
||||
require("mason-lspconfig").setup(opts)
|
||||
require("mason-lspconfig").setup_handlers {
|
||||
|
||||
function(server_name) -- default handler (optional)
|
||||
require("lspconfig")[server_name].setup({
|
||||
on_attach = on_attach
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
|
||||
["lua_ls"] = function()
|
||||
lspconfig.lua_ls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
@@ -66,8 +82,7 @@ return { {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-- capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
return { { "jose-elias-alvarez/null-ls.nvim",
|
||||
opts = function()
|
||||
local null_ls = require("null-ls")
|
||||
return {
|
||||
-- null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.black,
|
||||
}
|
||||
end } }
|
||||
Reference in New Issue
Block a user