neoclide / coc-json

Json language extension for coc.nvim
234 stars 21 forks source link

Feature Suggestion: Make trailingComma ignorable by a configuration variable #42

Closed lanza closed 2 years ago

lanza commented 3 years ago

Trailing commas have grown quite popular at this point. This warning could be toggleable.

chemzqm commented 3 years ago

We don't filter diagnostics, needs https://github.com/Microsoft/vscode-json-languageservice support that first.

lf- commented 3 years ago

I believe that that one does support handling trailing commas and comments, but it might require some changes in the schemas.

TonalidadeHidrica commented 3 years ago

Excuse me, I want to disable "trailing comma" diagnostics too. Is there a way to disable it right now, or does it need some extra enhancement to either coc-json or vscode-json-languageservice? In any case, why was this issue closed?

lanza commented 3 years ago

Somebody would have to implement it in vscode-json-languageservice and then import it here.

chemzqm commented 2 years ago

vscode-json-languageservice have support for trailingCommas setting, you can hack the code at https://github.com/microsoft/vscode/blob/main/extensions/json-language-features/server/src/jsonServer.ts#L394

Checkout https://github.com/microsoft/vscode-json-languageservice/issues/115, change the filetype to jsonc or use custom schema with allowTrailingCommas to true.