fixes to formatting
This commit is contained in:
parent
fa60bceabe
commit
3246e55fd0
7 changed files with 21 additions and 43 deletions
|
@ -16,6 +16,6 @@ conf.handlers["bashls"] = {
|
|||
}
|
||||
}
|
||||
|
||||
conf.required = { "lua_ls", "bashls" }
|
||||
conf.required = { "lua_ls" }
|
||||
|
||||
return conf
|
|
@ -1,14 +0,0 @@
|
|||
return {
|
||||
filter = function(client)
|
||||
if require("funcs").is_available("none-ls.nvim") then
|
||||
local n = require "null-ls"
|
||||
local s = require "null-ls.sources"
|
||||
local method = n.methods.FORMATTING
|
||||
local available_formatters = s.get_available(vim.bo.filetype, method)
|
||||
if #available_formatters > 0 then
|
||||
return client.name == "null-ls"
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
return function()
|
||||
local nb = require("null-ls").builtins
|
||||
return {
|
||||
nb.code_actions.shellcheck,
|
||||
nb.diagnostics.shellcheck
|
||||
}
|
||||
end
|
|
@ -135,7 +135,7 @@ function M.file_worktree(file, worktrees)
|
|||
"ls-files",
|
||||
"--error-unmatch",
|
||||
file
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
}):wait()
|
||||
if r.code == 0 then
|
||||
return worktree
|
||||
|
@ -228,7 +228,7 @@ function M.lsp_on_attach(client, bufnr)
|
|||
lsp_mappings.n["<leader>li"] = { "<cmd>LspInfo<cr>", desc = "LSP information" }
|
||||
end
|
||||
|
||||
if M.is_available("null-ls.nvim") then
|
||||
if M.is_available("none-ls.nvim") then
|
||||
lsp_mappings.n["<leader>lI"] = { "<cmd>NullLsInfo<cr>", desc = "Null-ls information" }
|
||||
end
|
||||
|
||||
|
@ -327,7 +327,19 @@ function M.lsp_on_attach(client, bufnr)
|
|||
if client.supports_method("textDocument/formatting") then
|
||||
lsp_mappings.n["<leader>lf"] = {
|
||||
function()
|
||||
vim.lsp.buf.format(require("config.lsp.format"))
|
||||
vim.lsp.buf.format({
|
||||
filter = function(c)
|
||||
local filetype = vim.bo.filetype
|
||||
local n = require "null-ls"
|
||||
local s = require "null-ls.sources"
|
||||
local method = n.methods.FORMATTING
|
||||
local available_formatters = s.get_available(filetype, method)
|
||||
if #available_formatters > 0 then
|
||||
return c.name == "null-ls"
|
||||
end
|
||||
return true
|
||||
end
|
||||
})
|
||||
end,
|
||||
desc = "Format buffer",
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
local M = { "williamboman/mason-lspconfig.nvim" }
|
||||
local serverconf = require("config.lsp.servers")
|
||||
local serverconf = require("config.lsp")
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" }
|
||||
|
|
|
@ -2,6 +2,6 @@ local M = { "jay-babu/mason-null-ls.nvim" }
|
|||
|
||||
M.dependencies = { "mason.nvim" }
|
||||
|
||||
M.config = true
|
||||
M.opts = { handlers = {} }
|
||||
|
||||
return M
|
||||
|
|
|
@ -4,21 +4,8 @@ M.event = { "BufReadPost", "BufNewFile" }
|
|||
|
||||
M.dependencies = { "mason-null-ls.nvim" }
|
||||
|
||||
M.opts = function()
|
||||
return {
|
||||
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", "Makefile", ".git", "ansible.cfg"),
|
||||
on_attach = require("funcs").lsp_on_attach,
|
||||
sources = require("config.lsp.null")(),
|
||||
}
|
||||
end
|
||||
|
||||
-- M.init = function()
|
||||
-- vim.api.nvim_create_autocmd({ "LspAttach" }, {
|
||||
-- desc = "Ensure null-ls run its sources a lsp client starts",
|
||||
-- callback = function()
|
||||
-- pcall(require("null-ls").enable, {})
|
||||
-- end,
|
||||
-- })
|
||||
-- end
|
||||
M.opts = {
|
||||
on_attach = require("funcs").lsp_on_attach,
|
||||
}
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Reference in a new issue