Editing tsconfig.json file my neovim is a nightmare. All the commented section for this json file is highlighted in red color. Its only for json files.
tsconfig.json
is not JSON. It is actually the poorly specified "JSON with Comments" or "JSONC", a variant of JSON created by Microsoft for their tooling.
Unfortunately, Microsoft uses the .json
extension for its JSONC files so editors where filetype is assigned based on the extension incorrectly assume the file is JSON. Vim actually supports JSONC but only for files with the .jsonc
extension. Bummer.
Options…
Change the filetype manually:
:set filetype=jsonc
Add a :help modeline
to your JSONC files:
// vim: filetype=jsonc
Set up proper filetype detection by putting this file under ~/.vim/ftdetect/
, as per this document.