@@ -8,15 +8,9 @@ function M.setup(userConfig) require("various-textobjs.config.config").setup(use
88setmetatable (M , {
99 __index = function (_ , key )
1010 return function (...)
11- local linewiseObjs = vim .tbl_keys (require (" various-textobjs.textobjs.linewise" ))
12-
13- local module = " charwise"
14- if vim .tbl_contains (linewiseObjs , key ) then module = " linewise" end
15- if key == " column" then module = " blockwise" end
16- if key == " diagnostic" then module = " diagnostic" end
17- if key == " subword" then module = " subword" end
18- if key == " emoji" then module = " emoji" end
11+ local warn = require (" various-textobjs.utils" ).warn
1912
13+ -- DEPRECATION (2025-04-24)
2014 if key == " pyTripleQuotes" then
2115 local msg = " The `pyTripleQuotes` textobj is deprecated. "
2216 .. " Please use `nvim-treesitter-teextobjects`, create a file "
@@ -27,11 +21,28 @@ setmetatable(M, {
2721 .. " (expression_statement (string (string_content) @docstring.inner) @docstring.outer)\n "
2822 .. " ```\n "
2923 .. " Call the textobject via `:TSTextobjectSelect @docstring.outer`"
30- require ( " various-textobjs.utils " ). warn (msg )
24+ warn (msg )
3125 return function () end -- empty function to prevent error
3226 end
3327
34- require (" various-textobjs.textobjs." .. module )[key ](... )
28+ local linewiseObjs = vim .tbl_keys (require (" various-textobjs.textobjs.linewise" ))
29+ local charwiseObjs = vim .tbl_keys (require (" various-textobjs.textobjs.charwise" ))
30+
31+ local module
32+ if vim .tbl_contains (linewiseObjs , key ) then module = " linewise" end
33+ if vim .tbl_contains (charwiseObjs , key ) then module = " charwise" end
34+ if key == " column" then module = " blockwise" end
35+ if key == " diagnostic" then module = " diagnostic" end
36+ if key == " subword" then module = " subword" end
37+ if key == " emoji" then module = " emoji" end
38+
39+ if module then
40+ require (" various-textobjs.textobjs." .. module )[key ](... )
41+ else
42+ local msg = (" There is no text object called `%s`.\n\n " ):format (key )
43+ .. " Make sure it exists in the list of text objects, and that you haven't misspelled it."
44+ warn (msg )
45+ end
3546 end
3647 end ,
3748})
0 commit comments