Skip to content

Commit 5190e7a

Browse files
committed
fix(config): compat hotfix nvim v0.9.2
Remove tbl_isarray() Closes #17
1 parent 48f253c commit 5190e7a

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

lua/lsp-timeout/config.lua

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,15 @@ M.Config.tableOfStrings = function(table)
4747
end
4848

4949
--- Validate config
50-
--- @treturn {M.Config}
50+
--- @treturn M.Config
5151
function M.Config.prototype:validate()
52+
-- v1.2.0
53+
-- NOTE: avoid vim.tbl_isarray() as it is
54+
-- incompatible with older <=0.9.2 nvim versions
55+
-- ref: https://github.com/neovim/neovim/pull/16440
56+
-- ref: https://github.com/hinell/lsp-timeout.nvim/pull/17
5257

53-
-- LuaFormatter of
58+
-- LuaFormatter off
5459
if not ((self.stopTimeout == nil) or type(self.stopTimeout) == "number") then
5560
error("lsp-timeout.config.stopTimeout: number is expected, got "
5661
.. type(self.stopTimeout), 2)
@@ -67,8 +72,9 @@ function M.Config.prototype:validate()
6772
end
6873

6974
if self.filetypes ~= nil then
70-
if (vim.tbl_isarray(self.filetypes) and not vim.tbl_isempty(self.filetypes))
71-
or not self.filetypes.ignore then
75+
if (vim.tbl_islist(self.filetypes)
76+
and (not vim.tbl_isempty(self.filetypes)) or not self.filetypes.ignore)
77+
then
7278
error("lsp-timeout.config.filetypes: { ignore = { .. } } is expected, got "
7379
.. vim.inspect(self.filetypes), 2)
7480
end
@@ -110,6 +116,6 @@ local config = {}
110116
config.filetypes.ignore = {}
111117
-- LuaFormatter on
112118

113-
M.default = M.Config:new(config):validate()
119+
M.default = M.Config:new(config)
114120

115121
return M

0 commit comments

Comments
 (0)