Skip to content

Commit 5dfbd0b

Browse files
committed
update init and init-legacy
1 parent 6f47083 commit 5dfbd0b

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

lua/obsidian/client.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2104,7 +2104,8 @@ Client.find_tasks = function(self)
21042104
return result
21052105
end
21062106

2107-
-- Build the list of task status names sorted by order
2107+
--- Build the list of task status names sorted by order
2108+
---@return string[]
21082109
Client.get_task_status_names = function(self)
21092110
local checkboxes = self.opts.ui.checkboxes
21102111
-- index by status name

lua/obsidian/commands/init-legacy.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,10 @@ M.complete_args_search = function(client, _, cmd_line, _)
129129
return completions
130130
end
131131

132-
M.complete_task_name = function(client, _, _, _)
133-
local status_names = client:get_task_status_names()
134-
return status_names
132+
---@param client obsidian.Client
133+
---@return string[]
134+
M.task_status_name_complete = function(client, _, _, _)
135+
return client:get_task_status_names()
135136
end
136137

137138
M.register("ObsidianCheck", { opts = { nargs = 0, desc = "Check for issues in your vault" } })
@@ -199,7 +200,7 @@ M.register("ObsidianTOC", { opts = { nargs = 0, desc = "Load the table of conten
199200

200201
M.register("ObsidianTasks", {
201202
opts = { nargs = "?", desc = "List all tasks" },
202-
complete = M.complete_task_name,
203+
complete = M.task_status_name_complete,
203204
})
204205

205206
return M

lua/obsidian/commands/init.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,12 @@ M.note_complete = function(client, cmd_arg)
200200
return completions
201201
end
202202

203+
---@param client obsidian.Client
204+
---@return string[]
205+
M.task_status_name_complete = function(client, _, _, _)
206+
return client:get_task_status_names()
207+
end
208+
203209
M.register("check", { nargs = 0 })
204210

205211
M.register("today", { nargs = "?" })
@@ -248,6 +254,6 @@ M.register("debug", { nargs = 0 })
248254

249255
M.register("toc", { nargs = 0 })
250256

251-
M.register("tasks", { nargs = "?", desc = "List all tasks" })
257+
M.register("tasks", { nargs = "?", desc = "List all tasks", complete = M.task_status_name_complete })
252258

253259
return M

0 commit comments

Comments
 (0)