@@ -28,9 +28,9 @@ function M.bufname_valid(bufname)
2828end
2929
3030function M .validate_bufnr (bufnr )
31- validate {
32- bufnr = { bufnr , ' n ' },
33- }
31+ if nvim_eleven then
32+ validate ( ' bufnr' , bufnr , ' number ' )
33+ end
3434 return bufnr == 0 and api .nvim_get_current_buf () or bufnr
3535end
3636
@@ -174,7 +174,9 @@ M.path = (function()
174174end )()
175175
176176function M .search_ancestors (startpath , func )
177- validate { func = { func , ' f' } }
177+ if nvim_eleven then
178+ validate (' func' , func , ' function' )
179+ end
178180 if func (startpath ) then
179181 return startpath
180182 end
@@ -192,14 +194,6 @@ function M.search_ancestors(startpath, func)
192194 end
193195end
194196
195- function M .tbl_flatten (t )
196- return nvim_eleven and vim .iter (t ):flatten (math.huge ):totable () or vim .tbl_flatten (t )
197- end
198-
199- function M .get_lsp_clients (filter )
200- return nvim_eleven and lsp .get_clients (filter ) or lsp .get_active_clients (filter )
201- end
202-
203197local function escape_wildcards (path )
204198 return path :gsub (' ([%[%]%?%*])' , ' \\ %1' )
205199end
@@ -245,6 +239,7 @@ function M.get_active_clients_list_by_ft(filetype)
245239 local clients = M .get_lsp_clients ()
246240 local clients_list = {}
247241 for _ , client in pairs (clients ) do
242+ --- @diagnostic disable-next-line : undefined-field
248243 local filetypes = client .config .filetypes or {}
249244 for _ , ft in pairs (filetypes ) do
250245 if ft == filetype then
@@ -326,6 +321,18 @@ function M.strip_archive_subpath(path)
326321 return path
327322end
328323
324+ --- Functions that can be removed once minimum required neovim version is high enough
325+
326+ function M .tbl_flatten (t )
327+ --- @diagnostic disable-next-line : deprecated
328+ return nvim_eleven and vim .iter (t ):flatten (math.huge ):totable () or vim .tbl_flatten (t )
329+ end
330+
331+ function M .get_lsp_clients (filter )
332+ --- @diagnostic disable-next-line : deprecated
333+ return nvim_eleven and lsp .get_clients (filter ) or lsp .get_active_clients (filter )
334+ end
335+
329336--- Deprecated functions
330337
331338--- @deprecated use `vim.fn.isdirectory(path) == 1` instead
0 commit comments