I am providing my own custom json formatter with provideDocumentFormattingEdits. However, when I use it, the default json formatter is still active and so my formatting gets overridden. Can I set my formatter as the only formatter somehow?
provideDocumentFormattingEdits(model: Monaco.editor.ITextModel, options: Monaco.languages.FormattingOptions, token: Monaco.CancellationToken): Monaco.languages.TextEdit[] {
return [
{
range: model.getFullModelRange(),
text: stringify(JSON.parse(model.getValue())),
},
];
},
cc @aeschli from https://github.com/Microsoft/monaco-json
That's currently not possible. We would need a new setting json.format.enable to the json monaco api. If you want to make a PR, that would be awesome.
I see. What's the suggested way to get JSON syntax highlighting and completion but a custom formatter until that flag is added?
FYI: I'm going to try with extending monaco api with json.format.enable
@nesterone Has this issue been resolved?
Most helpful comment
@nesterone Has this issue been resolved?