From 7de23289467fe7d1d0bffc04aec80006d13c6bcf Mon Sep 17 00:00:00 2001 From: Chris Kipp Date: Tue, 27 Dec 2022 11:33:56 +0100 Subject: [PATCH] refactor: start using get_active_clients --- lua/metals.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/metals.lua b/lua/metals.lua index 4b639ce..f3de615 100644 --- a/lua/metals.lua +++ b/lua/metals.lua @@ -320,11 +320,10 @@ end local function get_metals_and_stop() for _, buf in pairs(fn.getbufinfo({ bufloaded = true })) do if vim.tbl_contains(conf.scala_file_types, api.nvim_buf_get_option(buf.bufnr, "filetype")) then - local clients = lsp.buf_get_clients(buf.bufnr) + local clients = lsp.get_active_clients({ buffer = buf.bufnr, name = "metals" }) for _, client in ipairs(clients) do - if client.config.name == "metals" then - client.stop() - end + vim.notify("Found and stopping") + client.stop() end end end