config/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua
2023-01-10 09:19:58 +10:30

34 lines
779 B
Lua

local M = {}
function M.disable_deno_formatting(client)
if client.name == "denols" then
require("null-ls").disable({ "prettier" })
end
end
function M.resolve_tsserver_deno(client)
local active_clients = vim.lsp.get_active_clients()
if client.name == "denols" then
for _, client_ in pairs(active_clients) do
-- stop tsserver if denols is already active
if client_.name == "tsserver" then
client_.stop()
end
end
elseif client.name == "tsserver" then
for _, client_ in pairs(active_clients) do
-- prevent tsserver from starting if denols is already active
if client_.name == "denols" then
client.stop()
end
end
end
end
function M.on_attach(client, bufnr)
M.disable_deno_formatting(client)
M.resolve_tsserver_deno(client)
end
return M