monaco-react icon indicating copy to clipboard operation
monaco-react copied to clipboard

How formatting code

Open yangzai316 opened this issue 3 years ago • 4 comments

Hi , Have a Button and want to click it to formatting editor code . How should I do ?

yangzai316 avatar May 07 '22 06:05 yangzai316

How to format automatically

siyi98 avatar May 12 '22 07:05 siyi98

manaco-editor does not support code-formatting functionality out-of-the-box. It is something you have to implement yourself. I've implemented a Python formatter using Black, but it required a manual implementation. 🤠

image

subwaymatch avatar May 29 '22 11:05 subwaymatch

hi, depends on the language. For example to edit the json code in react you can use JSON.stringify("JsonObject", null, 4). Ref to Mozilla Developer

lcfr-dev avatar Mar 13 '23 22:03 lcfr-dev

Prettier can be loaded and used in your project to do the code formatting, right?

mikkelking avatar Dec 25 '23 11:12 mikkelking