Addnig a fidget for metals messages

This commit is contained in:
Zoe Roux
2022-04-13 10:26:50 +02:00
parent 1dac572aad
commit f9804e97e9
+23 -1
View File
@@ -13,13 +13,35 @@ vim.cmd [[
augroup end
]]
local function metals_status_handler(_, status, ctx)
-- https://github.com/scalameta/nvim-metals/blob/main/lua/metals/status.lua#L36-L50
local val = {}
if status.hide then
val = {kind = "end"}
elseif status.show then
val = {kind = "begin", title = " "} -- status.text title is ignored else messages are duplicated
elseif status.text then
val = {kind = "report", message = status.text}
else
return
end
local info = {client_id = ctx.client_id}
local msg = {token = "metals", value = val}
-- call fidget progress handler
vim.lsp.handlers["$/progress"](nil, msg, info)
end
metals_config = metals.bare_config()
metals_config.settings = {
showImplicitArguments = true,
showInferredType = true,
showImplicitConversionsAndClasses = true,
}
-- metals_config.init_options.statusBarProvider = "on"
metals_config.init_options.statusBarProvider = "on"
metals_config.handlers = {
['metals/status'] = metals_status_handler,
}
metals_config.on_attach = function(client, bufnr)
metals.setup_dap()