Open ghost opened 7 months ago
When I disabled the formatter and opened the Astro file, the error message was gone, but this is not how I want to fix this problem.
First off, I wrote that function with Vim in mind. I haven't tested it in Neovim and don't plan to. There may be differences that I don't know/can't do anything about.
Case in point, the function works correctly in Vim (9.0.1544 and 9.1.0), where :help json_decode()
is more tolerant than I would be about trailing commas.
My opinion is that you should format your file correctly.
Hey, thank you for your plugin, really appreciate it.
My opinion is that you should format your file correctly.
I think the issue is that the file is formatted correctly. I remember reading somewhere that tsconfig.json is actually a "jsonc" file (or maybe a JSON5 file), which does support trailing commas...
Any chance you could kindly support it so we don't need to create exceptions in prettier for just one file? Thanks a lot
The core issue is that someone at microsoft decided it would be a good idea to create an underspecified superset of json, jsonc, and keep the .json extension instead of using .jsonc.
The next issue is that Vim's json_decode() seems more relaxed about trailing commas than Neovim's for some reason. This is something that I can't test as I don't use that editor.
The next issue is that there is no jsonc_decode() in vimscript and I'm not aware of an existing implementation. If you can point to such a function somewhere or write it yourself, I'm sure it will be swapped quickly.
FWIW, I'm struggling to get my org to adopt Astro so, despite my interest for it, I actually don't use it at all and I can’t really justify spending the time to write a proper "parser".
Every time I open an astro file in Nvim with this plugin, I get an error below.
I guess something is going wrong on this line, but I have no idea what to do to fix the error without fixing my tsconfig.json file.
That error happens when my tsconfig.json has to trail commas like this.
The reason why I do not want to modify my
tsconfig.json
is that I do not actually want my prettier or eslint to remove those trailing commas; it is my project's style to do those.Do you have any solutions for this?