34 lines
779 B
Lua
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
|