Skip to content

Commit 52ced26

Browse files
committed
fix: Typing issues
1 parent 7aebc40 commit 52ced26

File tree

4 files changed

+34
-30
lines changed

4 files changed

+34
-30
lines changed

lua/debugprint/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ M.debugprint_regular = function(opts)
214214
end
215215

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

lua/debugprint/options.lua

+29-25
Original file line numberDiff line numberDiff line change
@@ -66,32 +66,36 @@ local validate_global_opts = function(o)
6666
local normal = o.keymaps.normal
6767
local visual = o.keymaps.visual
6868

69-
vim.validate({
70-
plain_below = { normal.plain_below, STRING_NIL },
71-
plain_above = { normal.plain_above, STRING_NIL },
72-
variable_below = { normal.variable_below, STRING_NIL },
73-
variable_above = { normal.variable_above, STRING_NIL },
74-
variable_below_alwaysprompt = {
75-
normal.variable_below_alwaysprompt,
76-
STRING_NIL,
77-
},
78-
variable_above_alwaysprompt = {
79-
normal.variable_above_alwaysprompt,
80-
STRING_NIL,
81-
},
82-
textobj_below = { normal.textobj_below, STRING_NIL },
83-
textobj_above = { normal.textobj_above, STRING_NIL },
84-
delete_debug_prints = { normal.delete_debug_prints, STRING_NIL },
85-
toggle_comment_debug_prints = {
86-
normal.toggle_comment_debug_prints,
87-
STRING_NIL,
88-
},
89-
})
69+
if normal ~= nil then
70+
vim.validate({
71+
plain_below = { normal.plain_below, STRING_NIL },
72+
plain_above = { normal.plain_above, STRING_NIL },
73+
variable_below = { normal.variable_below, STRING_NIL },
74+
variable_above = { normal.variable_above, STRING_NIL },
75+
variable_below_alwaysprompt = {
76+
normal.variable_below_alwaysprompt,
77+
STRING_NIL,
78+
},
79+
variable_above_alwaysprompt = {
80+
normal.variable_above_alwaysprompt,
81+
STRING_NIL,
82+
},
83+
textobj_below = { normal.textobj_below, STRING_NIL },
84+
textobj_above = { normal.textobj_above, STRING_NIL },
85+
delete_debug_prints = { normal.delete_debug_prints, STRING_NIL },
86+
toggle_comment_debug_prints = {
87+
normal.toggle_comment_debug_prints,
88+
STRING_NIL,
89+
},
90+
})
91+
end
9092

91-
vim.validate({
92-
variable_below = { visual.variable_below, STRING_NIL },
93-
variable_above = { visual.variable_above, STRING_NIL },
94-
})
93+
if visual ~= nil then
94+
vim.validate({
95+
variable_below = { visual.variable_below, STRING_NIL },
96+
variable_above = { visual.variable_above, STRING_NIL },
97+
})
98+
end
9599
end
96100

97101
local FUNCTION_OPTION_DEFAULTS = {

lua/debugprint/setup.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ local map_key = function(mode, lhs, opts)
1212
end
1313
end
1414

15-
---@param keys string
15+
---@param keys string?
1616
---@return nil
1717
local feedkeys = function(keys)
1818
if keys ~= nil and keys ~= "" then

lua/debugprint/types.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
---@field toggle_comment_debug_prints? string
4949

5050
---@class DebugprintFunctionOptions
51-
---@field above boolean
52-
---@field variable boolean
53-
---@field ignore_treesitter boolean
51+
---@field above? boolean
52+
---@field variable? boolean
53+
---@field ignore_treesitter? boolean
5454

5555
---@class DebugprintFunctionOptionsInternal: DebugprintFunctionOptions
5656
---@field motion? boolean

0 commit comments

Comments
 (0)