@@ -28,9 +28,9 @@ function M.bufname_valid(bufname)
28
28
end
29
29
30
30
function M .validate_bufnr (bufnr )
31
- validate {
32
- bufnr = { bufnr , ' n ' },
33
- }
31
+ if nvim_eleven then
32
+ validate ( ' bufnr' , bufnr , ' number ' )
33
+ end
34
34
return bufnr == 0 and api .nvim_get_current_buf () or bufnr
35
35
end
36
36
@@ -174,7 +174,9 @@ M.path = (function()
174
174
end )()
175
175
176
176
function M .search_ancestors (startpath , func )
177
- validate { func = { func , ' f' } }
177
+ if nvim_eleven then
178
+ validate (' func' , func , ' function' )
179
+ end
178
180
if func (startpath ) then
179
181
return startpath
180
182
end
@@ -192,14 +194,6 @@ function M.search_ancestors(startpath, func)
192
194
end
193
195
end
194
196
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
-
203
197
local function escape_wildcards (path )
204
198
return path :gsub (' ([%[%]%?%*])' , ' \\ %1' )
205
199
end
@@ -245,6 +239,7 @@ function M.get_active_clients_list_by_ft(filetype)
245
239
local clients = M .get_lsp_clients ()
246
240
local clients_list = {}
247
241
for _ , client in pairs (clients ) do
242
+ --- @diagnostic disable-next-line : undefined-field
248
243
local filetypes = client .config .filetypes or {}
249
244
for _ , ft in pairs (filetypes ) do
250
245
if ft == filetype then
@@ -326,6 +321,18 @@ function M.strip_archive_subpath(path)
326
321
return path
327
322
end
328
323
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
+
329
336
--- Deprecated functions
330
337
331
338
--- @deprecated use `vim.fn.isdirectory(path) == 1` instead
0 commit comments