Skip to content

Commit 42e515d

Browse files
committed
test: Make DebugprintKeymapOptions fields optional
And remove diagnostic warning disabling annotations as they don't appear to be needed.
1 parent 99c150c commit 42e515d

File tree

3 files changed

+2
-17
lines changed

3 files changed

+2
-17
lines changed

lua/debugprint/setup.lua

-10
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,27 @@ end
2525
M.map_keys_and_commands = function(global_opts)
2626
map_key("n", global_opts.keymaps.normal.plain_below, {
2727
callback = function()
28-
---@diagnostic disable-next-line: missing-fields
2928
feedkeys(debugprint.debugprint({}))
3029
end,
3130
desc = "Plain debug below current line",
3231
})
3332

3433
map_key("n", global_opts.keymaps.normal.plain_above, {
3534
callback = function()
36-
---@diagnostic disable-next-line: missing-fields
3735
feedkeys(debugprint.debugprint({ above = true }))
3836
end,
3937
desc = "Plain debug above current line",
4038
})
4139

4240
map_key("n", global_opts.keymaps.normal.variable_below, {
4341
callback = function()
44-
---@diagnostic disable-next-line: missing-fields
4542
feedkeys(debugprint.debugprint({ variable = true }))
4643
end,
4744
desc = "Variable debug below current line",
4845
})
4946

5047
map_key("n", global_opts.keymaps.normal.variable_above, {
5148
callback = function()
52-
---@diagnostic disable-next-line: missing-fields
5349
feedkeys(debugprint.debugprint({
5450
above = true,
5551
variable = true,
@@ -60,7 +56,6 @@ M.map_keys_and_commands = function(global_opts)
6056

6157
map_key("n", global_opts.keymaps.normal.variable_below_alwaysprompt, {
6258
callback = function()
63-
---@diagnostic disable-next-line: missing-fields
6459
feedkeys(debugprint.debugprint({
6560
variable = true,
6661
ignore_treesitter = true,
@@ -71,7 +66,6 @@ M.map_keys_and_commands = function(global_opts)
7166

7267
map_key("n", global_opts.keymaps.normal.variable_above_alwaysprompt, {
7368
callback = function()
74-
---@diagnostic disable-next-line: missing-fields
7569
feedkeys(debugprint.debugprint({
7670
above = true,
7771
variable = true,
@@ -83,7 +77,6 @@ M.map_keys_and_commands = function(global_opts)
8377

8478
map_key("n", global_opts.keymaps.normal.textobj_below, {
8579
callback = function()
86-
---@diagnostic disable-next-line: missing-fields
8780
return debugprint.debugprint({ motion = true })
8881
end,
8982
expr = true,
@@ -92,7 +85,6 @@ M.map_keys_and_commands = function(global_opts)
9285

9386
map_key("n", global_opts.keymaps.normal.textobj_above, {
9487
callback = function()
95-
---@diagnostic disable-next-line: missing-fields
9688
return debugprint.debugprint({
9789
motion = true,
9890
above = true,
@@ -104,15 +96,13 @@ M.map_keys_and_commands = function(global_opts)
10496

10597
map_key("x", global_opts.keymaps.visual.variable_below, {
10698
callback = function()
107-
---@diagnostic disable-next-line: missing-fields
10899
feedkeys(debugprint.debugprint({ variable = true }))
109100
end,
110101
desc = "Variable debug below current line",
111102
})
112103

113104
map_key("x", global_opts.keymaps.visual.variable_above, {
114105
callback = function()
115-
---@diagnostic disable-next-line: missing-fields
116106
feedkeys(debugprint.debugprint({
117107
above = true,
118108
variable = true,

lua/debugprint/types.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
---@field ignore_treesitter? boolean
2525

2626
---@class DebugprintKeymapOptions
27-
---@field normal DebugprintKeymapNormalOptions
28-
---@field visual DebugprintKeymapVisualOptions
27+
---@field normal? DebugprintKeymapNormalOptions
28+
---@field visual? DebugprintKeymapVisualOptions
2929

3030
---@class DebugprintKeymapNormalOptions
3131
---@field plain_below? string

tests/debugprint.lua

-5
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ end)
171171
describe("can do basic debug statement insertion (custom keys)", function()
172172
before_each(function()
173173
debugprint.setup({
174-
---@diagnostic disable-next-line: missing-fields
175174
keymaps = {
176175
normal = { plain_below = "zdp" },
177176
},
@@ -976,7 +975,6 @@ describe("can handle treesitter identifiers", function()
976975

977976
it("always prompt below", function()
978977
debugprint.setup({
979-
---@diagnostic disable-next-line: missing-fields
980978
keymaps = {
981979
normal = { variable_below_alwaysprompt = "zxa" },
982980
},
@@ -1004,7 +1002,6 @@ describe("can handle treesitter identifiers", function()
10041002

10051003
it("always prompt above", function()
10061004
debugprint.setup({
1007-
---@diagnostic disable-next-line: missing-fields
10081005
keymaps = { normal = { variable_above_alwaysprompt = "zxb" } },
10091006
})
10101007

@@ -1608,7 +1605,6 @@ describe("delete lines command", function()
16081605

16091606
it("basic - with key binding", function()
16101607
debugprint.setup({
1611-
---@diagnostic disable-next-line: missing-fields
16121608
keymaps = { normal = { delete_debug_prints = "g?x" } },
16131609
})
16141610

@@ -1924,7 +1920,6 @@ describe("comment toggle", function()
19241920

19251921
it("basic with keymaps", function()
19261922
debugprint.setup({
1927-
---@diagnostic disable-next-line: missing-fields
19281923
keymaps = { normal = { toggle_comment_debug_prints = "g?x" } },
19291924
})
19301925
assert.equals(notify_message, nil)

0 commit comments

Comments
 (0)