Skip to content

Commit c194875

Browse files
committed
Merge branch 'mikavilpas-add-types-for-keymaps'
2 parents bd56fe8 + 42e515d commit c194875

File tree

4 files changed

+37
-7
lines changed

4 files changed

+37
-7
lines changed

lua/debugprint/init.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ M.debugprint_regular = function(opts)
213213
return "g@l"
214214
end
215215

216-
---@param opts DebugprintFunctionOptions
217-
---@return nil
216+
---@param opts? DebugprintFunctionOptions
217+
---@return string | nil
218218
M.debugprint = function(opts)
219219
local func_opts =
220220
require("debugprint.options").get_and_validate_function_opts(opts)

lua/debugprint/options.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ M.get_and_validate_global_opts = function(opts)
162162
return global_opts
163163
end
164164

165-
---@param opts DebugprintFunctionOptions
165+
---@param opts? DebugprintFunctionOptions
166166
---@return DebugprintFunctionOptions
167167
M.get_and_validate_function_opts = function(opts)
168168
local func_opts = vim.tbl_deep_extend(

lua/debugprint/types.lua

+26-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
---@field find_treesitter_variable? function
1111

1212
---@class DebugprintGlobalOptions
13-
---@field keymaps? table
14-
---@field commands? table
13+
---@field keymaps? DebugprintKeymapOptions
14+
---@field commands? DebugprintCommandOptions
1515
---@field display_counter? boolean
1616
---@field display_location? boolean
1717
---@field display_snippet? boolean
@@ -23,6 +23,30 @@
2323
---@field create_commands? boolean
2424
---@field ignore_treesitter? boolean
2525

26+
---@class DebugprintKeymapOptions
27+
---@field normal? DebugprintKeymapNormalOptions
28+
---@field visual? DebugprintKeymapVisualOptions
29+
30+
---@class DebugprintKeymapNormalOptions
31+
---@field plain_below? string
32+
---@field plain_above? string
33+
---@field variable_below? string
34+
---@field variable_above? string
35+
---@field variable_below_alwaysprompt? string
36+
---@field variable_above_alwaysprompt? string
37+
---@field textobj_below? string
38+
---@field textobj_above? string
39+
---@field delete_debug_prints? string
40+
---@field toggle_comment_debug_prints? string
41+
42+
---@class DebugprintKeymapVisualOptions
43+
---@field variable_below? string
44+
---@field variable_above? string
45+
46+
---@class DebugprintCommandOptions
47+
---@field delete_debug_prints? string
48+
---@field toggle_comment_debug_prints? string
49+
2650
---@class DebugprintFunctionOptions
2751
---@field above boolean
2852
---@field variable boolean

tests/debugprint.lua

+8-2
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ end)
170170

171171
describe("can do basic debug statement insertion (custom keys)", function()
172172
before_each(function()
173-
debugprint.setup({ keymaps = { normal = { plain_below = "zdp" } } })
173+
debugprint.setup({
174+
keymaps = {
175+
normal = { plain_below = "zdp" },
176+
},
177+
})
174178
end)
175179

176180
after_each(teardown)
@@ -971,7 +975,9 @@ describe("can handle treesitter identifiers", function()
971975

972976
it("always prompt below", function()
973977
debugprint.setup({
974-
keymaps = { normal = { variable_below_alwaysprompt = "zxa" } },
978+
keymaps = {
979+
normal = { variable_below_alwaysprompt = "zxa" },
980+
},
975981
})
976982

977983
local filename = init_file({

0 commit comments

Comments
 (0)