serdarciplak / BlazorMonaco

Blazor component for Microsoft's Monaco Editor which powers Visual Studio Code.
https://serdarciplak.github.io/BlazorMonaco/
MIT License
441 stars 99 forks source link

how to format the code #38

Closed khaledafify closed 3 years ago

khaledafify commented 3 years ago

how can i trigger the action

` 'editor.action.formatDocument'

to format the code ?

serdarciplak commented 3 years ago

There's nothing like editor.action.formatDocument in Monaco Editor. Can you please explain what you mean?

khaledafify commented 3 years ago

i have initialized MonacoEditor Component in my page and i need to format the code

ref : https://github.com/microsoft/monaco-editor/issues/32

khaledafify commented 3 years ago

@serdarciplak is this action applicable to perform ?

serdarciplak commented 3 years ago

Hi @khaledafify It's suggested to use the editor.trigger() method in the link you've sent. BlazorMonaco already supports that method. So, you may use it to invoke the editor.action.formatDocument action.

khaledafify commented 3 years ago

thank you @serdarciplak I'll try it tomorrow.