From 8008d16951ab1213cb3e09c12994e758a5694fa9 Mon Sep 17 00:00:00 2001 From: ray-x Date: Mon, 20 May 2024 14:28:12 +1000 Subject: [PATCH] unbreak-breakingchanges #459 get_active_clients deprecated --- lua/go/lsp.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lua/go/lsp.lua b/lua/go/lsp.lua index a4eb939..7c9032c 100644 --- a/lua/go/lsp.lua +++ b/lua/go/lsp.lua @@ -179,10 +179,18 @@ end local M = {} function M.client() - local clients = vim.lsp.get_active_clients({ + local f = { bufnr = vim.api.nvim_get_current_buf(), name = 'gopls', - }) or {} + } + + local has0_11 = vim.fn.has('nvim-0.11') == 1 + local clients + if has0_11 then + clients = vim.lsp.get_clients(f) or {} + else + clients = vim.lsp.get_active_clients(f) or {} + end return clients[1] end