Skip to content

Commit 57b4613

Browse files
committed
Revert "fix!: Deprecation warning calling debugprint() directly - closes #99"
This reverts commit 48505a2. We want to deprecate, but we don't want to point towards the DSL method yet - since it looks like we might want to switch away again to a `<Plug>` method: see #156
1 parent e27267b commit 57b4613

File tree

4 files changed

+10
-60
lines changed

4 files changed

+10
-60
lines changed

README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,12 @@ they are used to convert sections to ROT-13, which most folks don't use.
181181

182182
> [!WARNING]
183183
> *Note*: as of version 2.0.0, the old mechanism of configuring keymaps/commands
184-
> which specifically allowed for creating your own keymaps using
185-
> `vim.keymap.set()` directly to
184+
> which specifically allowed for mapping directly to
186185
> `require('debugprint').debugprint(...)` is no longer officially supported or
187186
> documented. This is primarily because of [confusion](https://github.com/andrewferrier/debugprint.nvim/issues/44#issuecomment-1896405231) which arose over how to do
188-
> this mapping. Existing mappings performed this way may continue to work but
189-
> will produce a deprecation warning.
190-
> You should migrate to the new configuration-based method outlined
191-
> [above](https://github.com/andrewferrier/debugprint.nvim?tab=readme-ov-file#keymappings-and-commands). If this doesn't give you the flexibility to map how you wish for some
187+
> this mapping. Existing mappings performed this way are likely to continue to
188+
> work for some time. You should, however, migrate over to the new method outlined
189+
> above. If this doesn't give you the flexibility to map how you wish for some
192190
> reason, please open an
193191
> [issue](https://github.com/andrewferrier/debugprint.nvim/issues/new).
194192

lua/debugprint/options.lua

-9
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,6 @@ M.get_and_validate_function_opts = function(opts)
209209
assert(not (func_opts.motion and func_opts.insert))
210210
assert(not (func_opts.motion and func_opts.variable))
211211

212-
if not func_opts._skip_warning then
213-
vim.notify_once(
214-
"debugprint.nvim: mapping directly to the debugprint() function is deprecated and no longer supported."
215-
.. "You are *STRONGLY RECOMMENDED* to use the inbuilt mapping approach: "
216-
.. "https://github.com/andrewferrier/debugprint.nvim?tab=readme-ov-file#mapping-deprecation",
217-
vim.log.levels.WARN
218-
)
219-
end
220-
221212
return func_opts
222213
end
223214

lua/debugprint/setup.lua

+6-15
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,28 @@ end
2727
M.map_keys_and_commands = function(global_opts)
2828
map_key("n", global_opts.keymaps.normal.plain_below, {
2929
callback = function()
30-
debugprint.debugprint({ _skip_warning = true })
30+
debugprint.debugprint({})
3131
end,
3232
desc = "Plain debug below current line",
3333
})
3434

3535
map_key("n", global_opts.keymaps.normal.plain_above, {
3636
callback = function()
37-
debugprint.debugprint({ _skip_warning = true, above = true })
37+
debugprint.debugprint({ above = true })
3838
end,
3939
desc = "Plain debug above current line",
4040
})
4141

4242
map_key("n", global_opts.keymaps.normal.variable_below, {
4343
callback = function()
44-
debugprint.debugprint({ _skip_warning = true, variable = true })
44+
debugprint.debugprint({ variable = true })
4545
end,
4646
desc = "Variable debug below current line",
4747
})
4848

4949
map_key("n", global_opts.keymaps.normal.variable_above, {
5050
callback = function()
5151
debugprint.debugprint({
52-
_skip_warning = true,
5352
above = true,
5453
variable = true,
5554
})
@@ -60,7 +59,6 @@ M.map_keys_and_commands = function(global_opts)
6059
map_key("n", global_opts.keymaps.normal.variable_below_alwaysprompt, {
6160
callback = function()
6261
debugprint.debugprint({
63-
_skip_warning = true,
6462
variable = true,
6563
ignore_treesitter = true,
6664
})
@@ -71,7 +69,6 @@ M.map_keys_and_commands = function(global_opts)
7169
map_key("n", global_opts.keymaps.normal.variable_above_alwaysprompt, {
7270
callback = function()
7371
debugprint.debugprint({
74-
_skip_warning = true,
7572
above = true,
7673
variable = true,
7774
ignore_treesitter = true,
@@ -82,10 +79,7 @@ M.map_keys_and_commands = function(global_opts)
8279

8380
map_key("n", global_opts.keymaps.normal.textobj_below, {
8481
callback = function()
85-
return debugprint.debugprint({
86-
_skip_warning = true,
87-
motion = true,
88-
})
82+
return debugprint.debugprint({ motion = true })
8983
end,
9084
expr = true,
9185
desc = "Text-obj-selected variable debug below current line",
@@ -94,7 +88,6 @@ M.map_keys_and_commands = function(global_opts)
9488
map_key("n", global_opts.keymaps.normal.textobj_above, {
9589
callback = function()
9690
return debugprint.debugprint({
97-
_skip_warning = true,
9891
motion = true,
9992
above = true,
10093
})
@@ -105,15 +98,14 @@ M.map_keys_and_commands = function(global_opts)
10598

10699
map_key("i", global_opts.keymaps.insert.plain, {
107100
callback = function()
108-
debugprint.debugprint({ _skip_warning = true, insert = true })
101+
debugprint.debugprint({ insert = true })
109102
end,
110103
desc = "Plain debug in-place",
111104
})
112105

113106
map_key("i", global_opts.keymaps.insert.variable, {
114107
callback = function()
115108
debugprint.debugprint({
116-
_skip_warning = true,
117109
insert = true,
118110
variable = true,
119111
ignore_treesitter = true,
@@ -124,15 +116,14 @@ M.map_keys_and_commands = function(global_opts)
124116

125117
map_key("x", global_opts.keymaps.visual.variable_below, {
126118
callback = function()
127-
debugprint.debugprint({ _skip_warning = true, variable = true })
119+
debugprint.debugprint({ variable = true })
128120
end,
129121
desc = "Variable debug below current line",
130122
})
131123

132124
map_key("x", global_opts.keymaps.visual.variable_above, {
133125
callback = function()
134126
debugprint.debugprint({
135-
_skip_warning = true,
136127
above = true,
137128
variable = true,
138129
})

tests/debugprint.lua

-30
Original file line numberDiff line numberDiff line change
@@ -2170,36 +2170,6 @@ describe("handle deprecated options, create_keymaps=true", function()
21702170
end)
21712171
end)
21722172

2173-
describe("handle deprecated options, direct mapping", function()
2174-
before_each(function()
2175-
debugprint.setup()
2176-
2177-
vim.keymap.set("n", "g?t", function()
2178-
debugprint.debugprint({})
2179-
end)
2180-
end)
2181-
2182-
after_each(teardown)
2183-
2184-
it("basic", function()
2185-
local filename = init_file({
2186-
"foo",
2187-
"bar",
2188-
}, "lua", 1, 0)
2189-
2190-
feedkeys("g?t")
2191-
2192-
check_lines({
2193-
"foo",
2194-
"print('DEBUGPRINT[1]: " .. filename .. ":1 (after foo)')",
2195-
"bar",
2196-
})
2197-
2198-
assert.True(notify_message:find("mapping directly") > 0)
2199-
assert.True(notify_message:find("is deprecated") > 0)
2200-
end)
2201-
end)
2202-
22032173
describe("unmodifiable buffer", function()
22042174
before_each(function()
22052175
debugprint.setup()

0 commit comments

Comments
 (0)