fix: remove gotos because this breaks lua 5.1 (#583)
This commit is contained in:
@@ -725,8 +725,7 @@ internal.autocommands = function(opts)
|
|||||||
local event, group, ft_pat, cmd, source_file, source_lnum
|
local event, group, ft_pat, cmd, source_file, source_lnum
|
||||||
local current_event, current_group, current_ft
|
local current_event, current_group, current_ft
|
||||||
|
|
||||||
local cmd_output = vim.fn.execute("verb autocmd *", "silent")
|
local inner_loop = function(line)
|
||||||
for line in cmd_output:gmatch("[^\r\n]+") do
|
|
||||||
-- capture group and event
|
-- capture group and event
|
||||||
group, event = line:match("^(" .. pattern.GROUP .. ")%s+(" .. pattern.EVENT .. ")")
|
group, event = line:match("^(" .. pattern.GROUP .. ")%s+(" .. pattern.EVENT .. ")")
|
||||||
-- ..or just an event
|
-- ..or just an event
|
||||||
@@ -740,7 +739,7 @@ internal.autocommands = function(opts)
|
|||||||
current_event = event
|
current_event = event
|
||||||
current_group = group
|
current_group = group
|
||||||
end
|
end
|
||||||
goto line_parsed
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- non event/group lines
|
-- non event/group lines
|
||||||
@@ -754,13 +753,13 @@ internal.autocommands = function(opts)
|
|||||||
-- is there a command on the same line?
|
-- is there a command on the same line?
|
||||||
cmd = line:match(pattern.INDENT .. "%S+%s+(.+)")
|
cmd = line:match(pattern.INDENT .. "%S+%s+(.+)")
|
||||||
|
|
||||||
goto line_parsed
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if current_ft and cmd == nil then
|
if current_ft and cmd == nil then
|
||||||
-- trim leading spaces
|
-- trim leading spaces
|
||||||
cmd = line:gsub("^%s+", "")
|
cmd = line:gsub("^%s+", "")
|
||||||
goto line_parsed
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if current_ft and cmd then
|
if current_ft and cmd then
|
||||||
@@ -778,8 +777,11 @@ internal.autocommands = function(opts)
|
|||||||
cmd = nil
|
cmd = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
::line_parsed::
|
local cmd_output = vim.fn.execute("verb autocmd *", "silent")
|
||||||
|
for line in cmd_output:gmatch("[^\r\n]+") do
|
||||||
|
inner_loop(line)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- print(vim.inspect(autocmd_table))
|
-- print(vim.inspect(autocmd_table))
|
||||||
|
|||||||
@@ -190,10 +190,9 @@ local function check_capabilities(feature)
|
|||||||
local supported_client = false
|
local supported_client = false
|
||||||
for _, client in pairs(clients) do
|
for _, client in pairs(clients) do
|
||||||
supported_client = client.resolved_capabilities[feature]
|
supported_client = client.resolved_capabilities[feature]
|
||||||
if supported_client then goto continue end
|
if supported_client then break end
|
||||||
end
|
end
|
||||||
|
|
||||||
::continue::
|
|
||||||
if supported_client then
|
if supported_client then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user