-
-
Notifications
You must be signed in to change notification settings - Fork 948
Expand file tree
/
Copy pathts-context-commentstring.lua
More file actions
22 lines (22 loc) · 972 Bytes
/
ts-context-commentstring.lua
File metadata and controls
22 lines (22 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- TODO: Remove when dropping support for Neovim v0.10
return {
"JoosepAlviste/nvim-ts-context-commentstring",
enabled = vim.fn.has "nvim-0.11" ~= 1,
lazy = true,
init = function()
-- HACK: add workaround for native comments: https://github.com/JoosepAlviste/nvim-ts-context-commentstring/issues/109
vim.schedule(function()
local get_option = vim.filetype.get_option
local context_commentstring
vim.filetype.get_option = function(filetype, option)
if option ~= "commentstring" then return get_option(filetype, option) end
if context_commentstring == nil then
local ts_context_avail, ts_context = pcall(require, "ts_context_commentstring.internal")
context_commentstring = ts_context_avail and ts_context
end
return context_commentstring and context_commentstring.calculate_commentstring() or get_option(filetype, option)
end
end)
end,
opts = { enable_autocmd = false },
}