Skip to content

Commit

Permalink
style: fix luacheck and stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
jedrzejboczar committed Jun 10, 2024
1 parent b980820 commit 1172444
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lua/possession/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ vim.api.nvim_create_autocmd('CmdlineLeave', {
group = vim.api.nvim_create_augroup('possession.commands.complete', { clear = true }),
callback = function()
cached_names = nil
end
end,
})

local function get_session_names()
Expand Down
2 changes: 0 additions & 2 deletions lua/possession/migrate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ local M = {}

local Path = require('plenary.path')
local session = require('possession.session')
local paths = require('possession.paths')
local utils = require('possession.utils')

--- Migrate mksession-based file to JSON format by loading and saving the session
Expand All @@ -17,7 +16,6 @@ function M.migrate(vimscript_path, opts)
local name = assert(opts.name and opts.name or vim.fn.fnamemodify(Path:new(vimscript_path):absolute(), ':t:r'))
local vimscript = Path:new(vimscript_path):read()


-- Try to retrieve cwd from vimscript, fall back to getcwd
local cwd
for _, line in ipairs(utils.split_lines(vimscript)) do
Expand Down
9 changes: 7 additions & 2 deletions lua/possession/session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ local function save_global_options()
end

local function restore_global_options(options)
-- luacheck thinks vim.o.? is read-only
-- luacheck: push ignore 122
local restore = function()
for opt, value in pairs(options) do
vim.o[opt] = value
Expand All @@ -226,6 +228,7 @@ local function restore_global_options(options)
utils.try(restore, nil, function()
vim.o.eventignore = eventignore
end)()
-- luacheck: pop
end

--- Load session by name (or from raw data)
Expand Down Expand Up @@ -400,9 +403,11 @@ function M.list(opts)
-- Check for name duplicates
for name, files in pairs(files_by_name) do
if #files > 1 then
utils.warn('Session name "%s" found in multiple session files, please remove one of them:\n%s',
utils.warn(
'Session name "%s" found in multiple session files, please remove one of them:\n%s',
name,
table.concat(files, '\n'))
table.concat(files, '\n')
)
end
end

Expand Down

0 comments on commit 1172444

Please sign in to comment.