deno icon indicating copy to clipboard operation
deno copied to clipboard

JsonC support with `.json` suffix

Open aprosail opened this issue 1 year ago • 2 comments

Some important files, including .vscode/settings.json ends with .json prefix, but they are exactly JsonC (Json with Comments). Current deno fmt cannot format such json files when there are comments inside, which is really not convenient when using pure Deno and sharing VSCode workspace configurations. Can you enable JsonC support for those *.json files? Or this is designed by propose?

aprosail avatar Oct 28 '24 13:10 aprosail

Current deno fmt cannot format such json files when there are comments inside, which is really not convenient when using pure Deno and sharing VSCode workspace configurations.

Can you show a reproduction? It works fine for me.

dsherret avatar Oct 28 '24 13:10 dsherret

For me it works fine for all files inside the project. But if you open something like user preferences and try to format there, it shows this:

https://github.com/user-attachments/assets/341d4dc4-80c1-4dd2-b128-1ec3882e8350

brc-dd avatar Oct 28 '24 19:10 brc-dd

I finally found out the reason 🥲: It's neither the matter about Deno, nor its VSCode extension, it's just a conflict with other extensions. I was using an AI assist extension like Copilot, which is called Tongyi Lingma (VSCode extension ID: Alibaba-Cloud.tongyi-lingma), that once format on save, such extension will stuck, and prevent all the formatting process. Once disable such extension, both deno fmt command and the VSCode extension works well.

It's exactly not caused by Deno or its VSCode extension, it's completely Tongyi Lingma's fault. Moreover, the Tongyi Lingma extension will also conflict with the Dart/Flutter extension on VSCode. Your code is prefect, their code contain bugs, and I'm really sorry for wasting your time.

aprosail avatar Oct 30 '24 10:10 aprosail