2023-01-15 00:17:41 +07:00
|
|
|
local status_ok, comment = pcall(require, "Comment")
|
|
|
|
if not status_ok then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
comment.setup({
|
|
|
|
pre_hook = function(ctx)
|
|
|
|
local U = require("Comment.utils")
|
2023-12-01 21:56:39 +07:00
|
|
|
--
|
|
|
|
-- local status_utils_ok, utils = pcall(require, "ts_context_commentstring.utils")
|
|
|
|
-- if not status_utils_ok then
|
|
|
|
-- return
|
|
|
|
-- end
|
2023-01-15 00:17:41 +07:00
|
|
|
|
2023-12-01 21:56:39 +07:00
|
|
|
-- local location = nil
|
|
|
|
-- if ctx.ctype == U.ctype.block then
|
|
|
|
-- location = utils.get_cursor_location()
|
|
|
|
-- elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
|
|
|
|
-- location = utils.get_visual_start_location()
|
|
|
|
-- end
|
2023-01-15 00:17:41 +07:00
|
|
|
|
2023-12-01 21:56:39 +07:00
|
|
|
-- local status_internals_ok, internals = pcall(require, "ts_context_commentstring.internals")
|
|
|
|
-- if not status_internals_ok then
|
|
|
|
-- return
|
|
|
|
-- end
|
2023-01-15 00:17:41 +07:00
|
|
|
|
2023-12-01 21:56:39 +07:00
|
|
|
-- return internals.calculate_commentstring({
|
|
|
|
-- key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
|
|
|
|
-- location = location,
|
|
|
|
-- })
|
2023-01-15 00:17:41 +07:00
|
|
|
end,
|
|
|
|
})
|