vim/neovim配置json类型关联为jsonc
cov-json默认的json类型是不支持注释的,需要将json关联到jsonc
vim和neovim的方法如下
autocmd BufRead,BufNewFile *.json set filetype=jsonc
lua配置
-- 设置 autocmd 以识别 JSON 文件并将其视为 JSONC
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
pattern = {"*.json"},
command = "set filetype=jsonc"
})
配置好后,coc-json就可以支持注释了