I want to write a chrome extension, so I need to write manifest.json
, unfortunately, the IDE will not recognize the comments.
The documentation said:
It is a JSON-formatted file, with one exception: it is allowed to contain "//"-style comments.
So I am pretty sure added a comment for it is OK.
Is there any way to make the editor recognize the comments of manifest.json
?
You can use the way as below,
{
"//1": "comment 1",
"//2": "comment 2",
"id": "123"
}
👆 see: https://stackoverflow.com/a/44700108/9935654
But I think the best way is to change the Recognized File Types
to the json5
If using neovim, simply set
:set filetype=json5.
You can also consider using an autocommand to automatically set files with specific names to the json5 format.
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = "manifest.json",
callback = function()
vim.bo.filetype = "json5"
end,
})