Skip to content

Commit f8882e2

Browse files
committed
chore: reformat without no_call_parentheses
1 parent cb8db2b commit f8882e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+596
-598
lines changed

.stylua.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ line_endings = "Unix"
33
indent_type = "Spaces"
44
indent_width = 2
55
quote_style = "AutoPreferDouble"
6-
no_call_parentheses = true

lua/auto-session/autocmds.lua

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
local Lib = require "auto-session.lib"
2-
local Config = require "auto-session.config"
3-
local AutoSession = require "auto-session"
1+
local Lib = require("auto-session.lib")
2+
local Config = require("auto-session.config")
3+
local AutoSession = require("auto-session")
44

55
---@mod auto-session.commands Commands
66
---@brief [[
@@ -48,7 +48,7 @@ local function purge_orphaned_sessions()
4848
end
4949

5050
if Lib.is_empty_table(orphaned_sessions) then
51-
Lib.logger.info "Nothing to purge"
51+
Lib.logger.info("Nothing to purge")
5252
return
5353
end
5454

@@ -63,20 +63,20 @@ end
6363

6464
local function setup_dirchanged_autocmds()
6565
if not Config.cwd_change_handling then
66-
Lib.logger.debug "cwd_change_handling is disabled, skipping setting DirChangedPre and DirChanged autocmd handling"
66+
Lib.logger.debug("cwd_change_handling is disabled, skipping setting DirChangedPre and DirChanged autocmd handling")
6767
return
6868
end
6969

7070
vim.api.nvim_create_autocmd("DirChangedPre", {
7171
callback = function()
72-
Lib.logger.debug "DirChangedPre"
73-
Lib.logger.debug {
72+
Lib.logger.debug("DirChangedPre")
73+
Lib.logger.debug({
7474
cwd = vim.fn.getcwd(-1, -1),
7575
---@diagnostic disable-next-line: undefined-field
7676
target = vim.v.event.directory,
7777
["changed window"] = tostring(vim.v.event.changed_window),
7878
scope = vim.v.event.scope,
79-
}
79+
})
8080

8181
-- Don't want to save session if dir change was triggered
8282
-- by a window change. This will corrupt the session data,
@@ -86,7 +86,7 @@ local function setup_dirchanged_autocmds()
8686
end
8787

8888
if AutoSession.restore_in_progress or vim.g.SessionLoad then
89-
Lib.logger.debug "DirChangedPre: restore_in_progress/vim.g.SessionLoad is true, ignoring this event"
89+
Lib.logger.debug("DirChangedPre: restore_in_progress/vim.g.SessionLoad is true, ignoring this event")
9090
-- NOTE: We don't call the cwd_changed_hook here
9191
-- I think that's probably the right choice because I assume that event is mostly
9292
-- for preparing sessions for save/restoring but we don't want to do that when we're
@@ -95,7 +95,7 @@ local function setup_dirchanged_autocmds()
9595
end
9696

9797
AutoSession.AutoSaveSession()
98-
AutoSession.run_cmds "pre_cwd_changed"
98+
AutoSession.run_cmds("pre_cwd_changed")
9999

100100
-- Clear the current session, fixes #399
101101
vim.v.this_session = ""
@@ -105,7 +105,7 @@ local function setup_dirchanged_autocmds()
105105

106106
vim.api.nvim_create_autocmd("DirChanged", {
107107
callback = function()
108-
Lib.logger.debug "DirChanged"
108+
Lib.logger.debug("DirChanged")
109109
Lib.logger.debug(" cwd: " .. vim.fn.getcwd(-1, -1))
110110
Lib.logger.debug(" changed window: " .. tostring(vim.v.event.changed_window))
111111
Lib.logger.debug(" scope: " .. vim.v.event.scope)
@@ -120,13 +120,13 @@ local function setup_dirchanged_autocmds()
120120
-- I think that's probably the right choice because I assume that event is mostly
121121
-- for preparing sessions for save/restoring but we don't want to do that when we're
122122
-- already restoring a session
123-
Lib.logger.debug "DirChangedPre: restore_in_progress/vim.g.SessionLoad is true, ignoring this event"
123+
Lib.logger.debug("DirChangedPre: restore_in_progress/vim.g.SessionLoad is true, ignoring this event")
124124
return
125125
end
126126

127127
-- all buffers should've been deleted in `DirChangedPre`, something probably went wrong
128128
if Lib.has_open_buffers() then
129-
Lib.logger.debug "Cancelling session restore"
129+
Lib.logger.debug("Cancelling session restore")
130130
return
131131
end
132132

@@ -136,7 +136,7 @@ local function setup_dirchanged_autocmds()
136136
-- the restore for the next run of the event loop
137137
vim.schedule(function()
138138
AutoSession.AutoRestoreSession()
139-
AutoSession.run_cmds "post_cwd_changed"
139+
AutoSession.run_cmds("post_cwd_changed")
140140
end)
141141
end,
142142
pattern = "global",
@@ -200,9 +200,9 @@ function M.setup_autocmds()
200200
})
201201

202202
vim.api.nvim_create_user_command("Autosession", function(args)
203-
if args.args:match "search" then
203+
if args.args:match("search") then
204204
return require("auto-session.pickers").open_session_picker()
205-
elseif args.args:match "delete" then
205+
elseif args.args:match("delete") then
206206
return require("auto-session.pickers.select").open_delete_picker()
207207
end
208208
end, {
@@ -237,8 +237,8 @@ function M.setup_autocmds()
237237
callback = function()
238238
if vim.g.in_pager_mode then
239239
-- Don't auto restore session in pager mode
240-
Lib.logger.debug "In pager mode, skipping auto restore"
241-
AutoSession.run_cmds "no_restore"
240+
Lib.logger.debug("In pager mode, skipping auto restore")
241+
AutoSession.run_cmds("no_restore")
242242
return
243243
end
244244

@@ -258,14 +258,14 @@ function M.setup_autocmds()
258258

259259
if not lazy_view.visible() then
260260
-- Lazy isn't visible, load as usual
261-
Lib.logger.debug "Lazy is loaded, but not visible, will try to restore session"
261+
Lib.logger.debug("Lazy is loaded, but not visible, will try to restore session")
262262
AutoSession.start()
263263
return
264264
end
265265

266266
-- If the Lazy window is visible, hold onto it for later
267267
lazy_view_win = lazy_view.view.win
268-
Lib.logger.debug "Lazy window is still visible, waiting for it to close"
268+
Lib.logger.debug("Lazy window is still visible, waiting for it to close")
269269
end,
270270
})
271271

@@ -294,11 +294,11 @@ function M.setup_autocmds()
294294

295295
if event.match ~= tostring(lazy_view_win) then
296296
-- A window was closed, but it wasn't Lazy's window so keep waiting
297-
Lib.logger.debug "A window was closed but it was not Lazy, keep waiting"
297+
Lib.logger.debug("A window was closed but it was not Lazy, keep waiting")
298298
return
299299
end
300300

301-
Lib.logger.debug "Lazy window was closed, restore the session!"
301+
Lib.logger.debug("Lazy window was closed, restore the session!")
302302

303303
-- Clear lazy_view_win so we stop processing future WinClosed events
304304
lazy_view_win = nil

lua/auto-session/config.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ local defaults = {
120120

121121
-- Misc
122122
log_level = "error", -- Sets the log level of the plugin (debug, info, warn, error).
123-
root_dir = vim.fn.stdpath "data" .. "/sessions/", -- Root dir where sessions will be stored
123+
root_dir = vim.fn.stdpath("data") .. "/sessions/", -- Root dir where sessions will be stored
124124
show_auto_restore_notif = false, -- Whether to show a notification when auto-restoring
125125
restore_error_handler = nil, -- Function called when there's an error restoring. By default, it ignores fold errors otherwise it displays the error and returns false to disable auto_save
126126
continue_restore_on_error = true, -- Keep loading the session even if there's an error
@@ -143,7 +143,7 @@ local defaults = {
143143

144144
---@type SessionControl
145145
session_control = {
146-
control_dir = vim.fn.stdpath "data" .. "/auto_session/", -- Auto session control dir, for control files, like alternating between two sessions with session-lens
146+
control_dir = vim.fn.stdpath("data") .. "/auto_session/", -- Auto session control dir, for control files, like alternating between two sessions with session-lens
147147
control_filename = "session_control.json", -- File name of the session control file
148148
},
149149
},
@@ -303,7 +303,7 @@ function M.check(logger, show_full_message)
303303
.. 'vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"\n'
304304
)
305305
else
306-
logger.warn "vim.o.sessionoptions is missing buffers. \nUse `:checkhealth autosession` for more info."
306+
logger.warn("vim.o.sessionoptions is missing buffers. \nUse `:checkhealth autosession` for more info.")
307307
end
308308
has_issues = true
309309
end
@@ -316,29 +316,29 @@ function M.check(logger, show_full_message)
316316
.. 'vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"\n'
317317
)
318318
else
319-
logger.warn "vim.o.sessionoptions is missing localoptions. \nUse `:checkhealth autosession` for more info."
319+
logger.warn("vim.o.sessionoptions is missing localoptions. \nUse `:checkhealth autosession` for more info.")
320320
end
321321
has_issues = true
322322
end
323323

324-
if M.purge_after_minutes and vim.fn.has "nvim-0.10" ~= 1 then
325-
logger.warn "the purge_after_minutes options requires nvim >= 0.10"
324+
if M.purge_after_minutes and vim.fn.has("nvim-0.10") ~= 1 then
325+
logger.warn("the purge_after_minutes options requires nvim >= 0.10")
326326
has_issues = true
327327
end
328328

329329
if not M.git_use_branch_name and M.git_auto_restore_on_branch_change then
330-
logger.error "git_auto_restore_on_branch_change requires git_use_branch_name = true"
330+
logger.error("git_auto_restore_on_branch_change requires git_use_branch_name = true")
331331
has_issues = true
332332
end
333333

334334
if M.single_session_mode and M.cwd_change_handling then
335-
logger.warn "single_session_mode and cwd_change_handling are conflicting options. Disabling single_session_mode."
335+
logger.warn("single_session_mode and cwd_change_handling are conflicting options. Disabling single_session_mode.")
336336
M.single_session_mode = false
337337
has_issues = true
338338
end
339339

340340
if M.session_lens.load_on_setup and M.session_lens.picker and M.session_lens.picker ~= "telescope" then
341-
logger.warn 'session_lens.load_on_setup is not used with pickers other than "telescope"'
341+
logger.warn('session_lens.load_on_setup is not used with pickers other than "telescope"')
342342
M.session_lens.load_on_setup = false
343343
end
344344

lua/auto-session/git.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
local AutoSession = require "auto-session"
2-
local Config = require "auto-session.config"
3-
local Lib = require "auto-session.lib"
1+
local AutoSession = require("auto-session")
2+
local Config = require("auto-session.config")
3+
local Lib = require("auto-session.lib")
44

55
local uv = vim.uv or vim.loop
66

@@ -63,7 +63,7 @@ end
6363
function M.start_watcher(cwd, towatch)
6464
if M.uv_git_watcher then
6565
M.uv_git_watcher:stop()
66-
Lib.logger.debug "Git: stopped old watcher so we can start a new one"
66+
Lib.logger.debug("Git: stopped old watcher so we can start a new one")
6767
end
6868

6969
M.uv_git_watcher = assert(uv.new_fs_event())
@@ -78,7 +78,7 @@ function M.start_watcher(cwd, towatch)
7878
Lib.debounce(function(err)
7979
if err then
8080
vim.schedule(function()
81-
Lib.logger.err "Error watching for git branch changes"
81+
Lib.logger.err("Error watching for git branch changes")
8282
end)
8383
return
8484
end
@@ -101,7 +101,7 @@ function M.stop_watcher()
101101
end
102102

103103
M.uv_git_watcher:stop()
104-
Lib.logger.debug "Git: stopped watcher"
104+
Lib.logger.debug("Git: stopped watcher")
105105
M.uv_git_watcher = nil
106106
end
107107

lua/auto-session/health.lua

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
local AutoSession = require "auto-session"
2-
local Lib = require "auto-session.lib"
3-
local Config = require "auto-session.config"
1+
local AutoSession = require("auto-session")
2+
local Lib = require("auto-session.lib")
3+
local Config = require("auto-session.config")
44

55
local M = {}
66

@@ -22,7 +22,7 @@ local function check_lazy_settings()
2222
return
2323
end
2424

25-
start "Lazy.nvim settings"
25+
start("Lazy.nvim settings")
2626

2727
if not Config.lazy_support then
2828
warn(
@@ -31,7 +31,7 @@ local function check_lazy_settings()
3131
.. "`lazy_support = true,` to your config (or remove the line that's setting it to false)"
3232
)
3333
else
34-
ok "Lazy.nvim support is enabled"
34+
ok("Lazy.nvim support is enabled")
3535
end
3636

3737
local plugins = lazy.plugins()
@@ -52,7 +52,7 @@ local function check_lazy_settings()
5252
]]
5353
)
5454
else
55-
ok "auto-session is not lazy loaded"
55+
ok("auto-session is not lazy loaded")
5656
end
5757

5858
return
@@ -61,35 +61,35 @@ local function check_lazy_settings()
6161
end
6262

6363
local function check_config()
64-
start "Config"
64+
start("Config")
6565
local loggerObj = {
6666
error = error,
6767
info = info,
6868
warn = warn,
6969
}
7070

7171
if not Config.check(loggerObj, true) then
72-
ok "No config issues detected"
72+
ok("No config issues detected")
7373
end
7474
end
7575

7676
function M.check()
77-
start "Setup"
77+
start("Setup")
7878
if not Config.root_dir or vim.tbl_isempty(Lib.logger) then
7979
error(
8080
"Setup was not called. Auto-session will not work unless you call setup() somewhere, e.g.:\n\n"
8181
.. "require('auto-session').setup({})"
8282
)
8383
return
8484
else
85-
ok "setup() called"
85+
ok("setup() called")
8686
end
8787

8888
check_lazy_settings()
8989

9090
check_config()
9191

92-
start "Current Config"
92+
start("Current Config")
9393
if Config.has_old_config then
9494
info(
9595
"You have old config names. You can update your config to:\n"
@@ -100,7 +100,7 @@ function M.check()
100100
info("\n" .. vim.inspect(Config.options_without_defaults))
101101
end
102102

103-
start "General Info"
103+
start("General Info")
104104
info("Session directory: " .. AutoSession.get_root_dir())
105105
info("Current session: " .. Lib.current_session_name())
106106
info("Current session file: " .. vim.v.this_session)

0 commit comments

Comments
 (0)