From 462ded6ee3d80e4a84ec890a95b3140ba44aefe6 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 5 Apr 2025 16:36:39 -0700 Subject: refactor: deprecate add_hook_before/after #3695 These are special-purpose functions that should never have been "public". --- lua/lspconfig/util.lua | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'lua/lspconfig/util.lua') diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index 0e4ab120..0935ec40 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -34,30 +34,6 @@ function M.validate_bufnr(bufnr) return bufnr == 0 and api.nvim_get_current_buf() or bufnr end -function M.add_hook_before(func, new_fn) - if func then - return function(...) - -- TODO which result? - new_fn(...) - return func(...) - end - else - return new_fn - end -end - -function M.add_hook_after(func, new_fn) - if func then - return function(...) - -- TODO which result? - func(...) - return new_fn(...) - end - else - return new_fn - end -end - -- Maps lspconfig-style command options to nvim_create_user_command (i.e. |command-attributes|) option names. local opts_aliases = { ['description'] = 'desc', @@ -367,4 +343,30 @@ function M.get_lsp_clients(filter) return nvim_eleven and lsp.get_clients(filter) or lsp.get_active_clients(filter) end +--- @deprecated Will be removed. Do not use. +function M.add_hook_before(func, new_fn) + if func then + return function(...) + -- TODO which result? + new_fn(...) + return func(...) + end + else + return new_fn + end +end + +--- @deprecated Will be removed. Do not use. +function M.add_hook_after(func, new_fn) + if func then + return function(...) + -- TODO which result? + func(...) + return new_fn(...) + end + else + return new_fn + end +end + return M -- cgit v1.2.3-70-g09d2