Skip to content

Commit

Permalink
Fix bad reference to table.unpack
Browse files Browse the repository at this point in the history
  • Loading branch information
chipsenkbeil committed Sep 13, 2023
1 parent 17bcd37 commit 998724f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lua/distant-core/utils.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
--- @class distant.core.Utils
local M = {}

local unpack = unpack or table.unpack

local PLUGIN_NAME = 'distant.nvim'

--- @return string
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions lua/distant-core/version.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
local unpack = unpack or table.unpack

--- Represents a structured version.
--- @class distant.core.Version
--- @field major integer
--- @field minor? integer
--- @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[]}
Expand Down
6 changes: 4 additions & 2 deletions lua/distant/commands/distant_spawn.lua
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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

Expand Down
2 changes: 2 additions & 0 deletions lua/distant/editor/open.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lua/distant/ui/windows/main/view/content/help.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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}[]
Expand Down
2 changes: 2 additions & 0 deletions lua/distant/ui/windows/main/view/header.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 998724f

Please sign in to comment.