neovim: update jsx commentstring
This commit is contained in:
@@ -5,10 +5,17 @@ local ctype_to_commentstring = {
|
|||||||
[U.ctype.blockwise] = "__multiline",
|
[U.ctype.blockwise] = "__multiline",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local jsx_filetypes = {
|
||||||
|
"javascript",
|
||||||
|
"javascriptreact",
|
||||||
|
"typescript",
|
||||||
|
"typescriptreact",
|
||||||
|
}
|
||||||
|
|
||||||
require("Comment").setup({
|
require("Comment").setup({
|
||||||
pre_hook = function(ctx)
|
pre_hook = function(ctx)
|
||||||
-- Only calculate commentstring for tsx filetypes
|
-- Only calculate commentstring for tsx filetypes
|
||||||
if vim.bo.filetype == "typescriptreact" or vim.bo.filetype == "javascriptreact" then
|
if vim.list_contains(jsx_filetypes, vim.bo.filetype) then
|
||||||
-- Detemine whether to use linewise or blockwise commentstring
|
-- Detemine whether to use linewise or blockwise commentstring
|
||||||
local type = ctype_to_commentstring[ctx.ctype]
|
local type = ctype_to_commentstring[ctx.ctype]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user