diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2021-03-03 11:51:44 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-03 17:51:44 +0100 |
| commit | 0fef4c3e17f4f41c070e890dc7bee6f348983b5f (patch) | |
| tree | 559ee751db0abacd9b37838bb51f5c864cb29dcf | |
| parent | 20984fc5cdb69497b0c523236ee3f9160e22df30 (diff) | |
fix: remove gotos because this breaks lua 5.1 (#583)
| -rw-r--r-- | lua/telescope/builtin/internal.lua | 14 | ||||
| -rw-r--r-- | lua/telescope/builtin/lsp.lua | 3 |
2 files changed, 9 insertions, 8 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua index f0eabc9..69903ae 100644 --- a/lua/telescope/builtin/internal.lua +++ b/lua/telescope/builtin/internal.lua @@ -725,8 +725,7 @@ internal.autocommands = function(opts) local event, group, ft_pat, cmd, source_file, source_lnum local current_event, current_group, current_ft - local cmd_output = vim.fn.execute("verb autocmd *", "silent") - for line in cmd_output:gmatch("[^\r\n]+") do + local inner_loop = function(line) -- capture group and event group, event = line:match("^(" .. pattern.GROUP .. ")%s+(" .. pattern.EVENT .. ")") -- ..or just an event @@ -740,7 +739,7 @@ internal.autocommands = function(opts) current_event = event current_group = group end - goto line_parsed + return end -- non event/group lines @@ -754,13 +753,13 @@ internal.autocommands = function(opts) -- is there a command on the same line? cmd = line:match(pattern.INDENT .. "%S+%s+(.+)") - goto line_parsed + return end if current_ft and cmd == nil then -- trim leading spaces cmd = line:gsub("^%s+", "") - goto line_parsed + return end if current_ft and cmd then @@ -778,8 +777,11 @@ internal.autocommands = function(opts) cmd = nil 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 -- print(vim.inspect(autocmd_table)) diff --git a/lua/telescope/builtin/lsp.lua b/lua/telescope/builtin/lsp.lua index 28ecf60..49bc698 100644 --- a/lua/telescope/builtin/lsp.lua +++ b/lua/telescope/builtin/lsp.lua @@ -190,10 +190,9 @@ local function check_capabilities(feature) local supported_client = false for _, client in pairs(clients) do supported_client = client.resolved_capabilities[feature] - if supported_client then goto continue end + if supported_client then break end end - ::continue:: if supported_client then return true else |
