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

Hi, thank you for the hint, but I can't see a method for changing language in **EditorUpdateOptions**. #78

Closed wmchuang closed 1 year ago

wmchuang commented 1 year ago
          Hi, thank you for the hint, but I can't see a method for changing language in **EditorUpdateOptions**.

Can you send me an example? Thank you David

Originally posted by @pcsolutioncz in https://github.com/serdarciplak/BlazorMonaco/issues/77#issuecomment-1432555305

serdarciplak commented 1 year ago

Hi. You can use the BlazorMonaco.Global.SetModelLanguage() method with the model instance of your editor.

Global.SetModelLanguage(editor.GetModel(), "javascript");

BTW, as BlazorMonaco is just a wrapper for the Monaco Editor JS library, you can use its documentation for reference.

gregsdennis commented 1 year ago

This is horribly unintuitive.

serdarciplak commented 1 year ago

@gregsdennis I agree with you but that's how Microsoft has decided to implement it. BlazorMonaco just follows the original Monaco Editor's interface.