From 998724f62386c8022a4e6c885f4509cf9477451a Mon Sep 17 00:00:00 2001 From: Chip Senkbeil Date: Wed, 13 Sep 2023 12:06:20 -0500 Subject: [PATCH] Fix bad reference to table.unpack --- lua/distant-core/utils.lua | 6 ++++-- lua/distant-core/version.lua | 6 ++++-- lua/distant/commands/distant_spawn.lua | 6 ++++-- lua/distant/editor/open.lua | 2 ++ lua/distant/ui/windows/main/view/content/help.lua | 2 ++ lua/distant/ui/windows/main/view/header.lua | 2 ++ 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lua/distant-core/utils.lua b/lua/distant-core/utils.lua index 265e7ec..0b88797 100644 --- a/lua/distant-core/utils.lua +++ b/lua/distant-core/utils.lua @@ -1,6 +1,8 @@ --- @class distant.core.Utils local M = {} +local unpack = unpack or table.unpack + local PLUGIN_NAME = 'distant.nvim' --- @return string @@ -38,7 +40,7 @@ M.cache_path = function(path) vim.fn.stdpath('cache') .. M.seperator() .. M.plugin_name() - ) + ) if type(path) == 'table' and vim.tbl_islist(path) then for _, component in ipairs(path) do @@ -59,7 +61,7 @@ M.data_path = function(path) vim.fn.stdpath('data') .. M.seperator() .. M.plugin_name() - ) + ) if type(path) == 'table' and vim.tbl_islist(path) then for _, component in ipairs(path) do diff --git a/lua/distant-core/version.lua b/lua/distant-core/version.lua index 148ae3f..40cd405 100644 --- a/lua/distant-core/version.lua +++ b/lua/distant-core/version.lua @@ -1,3 +1,5 @@ +local unpack = unpack or table.unpack + --- Represents a structured version. --- @class distant.core.Version --- @field major integer @@ -5,8 +7,8 @@ --- @field patch? integer --- @field prerelease? string[] --- @field build? string[] -local M = {} -M.__index = M +local M = {} +M.__index = M --- Creates a new version. --- @param opts {major:integer, minor?:integer, patch?:integer, prerelease?:string[], build?:string[]} diff --git a/lua/distant/commands/distant_spawn.lua b/lua/distant/commands/distant_spawn.lua index 24b189b..c541629 100644 --- a/lua/distant/commands/distant_spawn.lua +++ b/lua/distant/commands/distant_spawn.lua @@ -1,6 +1,8 @@ local plugin = require('distant') local utils = require('distant.commands.utils') +local unpack = unpack or table.unpack + --- DistantSpawn cmd [arg1 arg2 ...] --- @param cmd NvimCommand local function command(cmd) @@ -23,11 +25,11 @@ local function command(cmd) assert(res, 'Missing results of process execution') if #res.stdout > 0 then - print(string.char(table.unpack(res.stdout))) + print(string.char(unpack(res.stdout))) end if #res.stderr > 0 then - vim.api.nvim_err_writeln(string.char(table.unpack(res.stderr))) + vim.api.nvim_err_writeln(string.char(unpack(res.stderr))) end end diff --git a/lua/distant/editor/open.lua b/lua/distant/editor/open.lua index a464d87..ed21ba5 100644 --- a/lua/distant/editor/open.lua +++ b/lua/distant/editor/open.lua @@ -7,6 +7,8 @@ local configurator = require('distant.editor.open.configurator') local loader = require('distant.editor.open.loader') local qflist = require('distant.editor.open.qflist') +local unpack = unpack or table.unpack + --- @class distant.editor.OpenOpts --- @field path string #Path to file or directory --- @field bufnr? number #If not -1 and number, will use this buffer number instead of looking for a buffer diff --git a/lua/distant/ui/windows/main/view/content/help.lua b/lua/distant/ui/windows/main/view/content/help.lua index 2694f5e..04c00b9 100644 --- a/lua/distant/ui/windows/main/view/content/help.lua +++ b/lua/distant/ui/windows/main/view/content/help.lua @@ -5,6 +5,8 @@ local p = require('distant.ui.palette') local plugin = require('distant') local ui = require('distant-core.ui') +local unpack = unpack or table.unpack + ---@param state distant.plugin.ui.windows.main.State return function(state) --- @type {[1]: string, [2]: distant.plugin.settings.Keymap}[] diff --git a/lua/distant/ui/windows/main/view/header.lua b/lua/distant/ui/windows/main/view/header.lua index 54facf0..cb8180d 100644 --- a/lua/distant/ui/windows/main/view/header.lua +++ b/lua/distant/ui/windows/main/view/header.lua @@ -3,6 +3,8 @@ local p = require('distant.ui.palette') local plugin = require('distant') local ui = require('distant-core.ui') +local unpack = unpack or table.unpack + --- @return distant.core.ui.Span local function version_span() local is_prerelease = plugin.version.plugin:has_prerelease()