mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-28 03:30:05 +02:00
fix: format on save tidak respon jika menggunakan lsp format
This commit is contained in:
parent
2e64635d7e
commit
f5f74f80e0
6 changed files with 159 additions and 157 deletions
|
@ -1,10 +1,14 @@
|
|||
local null_ls = require("null-ls")
|
||||
local ok, null_ls = pcall(require, "null-ls")
|
||||
local M = {}
|
||||
|
||||
M.list_registered = function(filetype)
|
||||
local method = null_ls.methods.FORMATTING
|
||||
local registered_providers = require("user.utils.lsp").list_registered_providers_names(filetype)
|
||||
return registered_providers[method] or {}
|
||||
if ok then
|
||||
local method = null_ls.methods.FORMATTING
|
||||
local registered_providers = require("user.utils.lsp").list_registered_providers_names(filetype)
|
||||
return registered_providers[method] or {}
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
M.list_registered_all = function()
|
||||
|
|
|
@ -1,19 +1,27 @@
|
|||
local null_ls = require("null-ls")
|
||||
local ok, null_ls = pcall(require, "null-ls")
|
||||
local M = {}
|
||||
|
||||
M.alternative_methods = {
|
||||
null_ls.methods.DIAGNOSTICS,
|
||||
null_ls.methods.DIAGNOSTICS_ON_OPEN,
|
||||
null_ls.methods.DIAGNOSTICS_ON_SAVE,
|
||||
}
|
||||
if ok then
|
||||
M.alternative_methods = {
|
||||
null_ls.methods.DIAGNOSTICS,
|
||||
null_ls.methods.DIAGNOSTICS_ON_OPEN,
|
||||
null_ls.methods.DIAGNOSTICS_ON_SAVE,
|
||||
}
|
||||
else
|
||||
M.alternative_methods = {}
|
||||
end
|
||||
|
||||
M.linter_list_registered = function(filetype)
|
||||
local registered_providers = require("user.utils.lsp").list_registered_providers_names(filetype)
|
||||
local providers_for_methods = vim.iter(vim.tbl_map(function(m)
|
||||
return registered_providers[m] or {}
|
||||
end, M.alternative_methods))
|
||||
if ok then
|
||||
local registered_providers = require("user.utils.lsp").list_registered_providers_names(filetype)
|
||||
local providers_for_methods = vim.iter(vim.tbl_map(function(m)
|
||||
return registered_providers[m] or {}
|
||||
end, M.alternative_methods))
|
||||
|
||||
return providers_for_methods
|
||||
return providers_for_methods
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -93,7 +93,8 @@ return {
|
|||
if type(msg) == "boolean" or #msg == 0 then
|
||||
return "LSP Inactive"
|
||||
end
|
||||
return msg
|
||||
-- return msg
|
||||
table.insert(buf_client_names, msg)
|
||||
end
|
||||
-- add client
|
||||
for _, client in pairs(buf_clients) do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue