[Feature Request] #3910
-
Context
DescriptionHow can I change the language of the editor? Monaco Editor Playground LinkNo response Monaco Editor Playground CodeNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The editor does not have an associated language, only models have since there could be multiple models that all have different languages associated with them. The language property on the editor creation function is just a shorthand that sets the language of the model the editor automatically creates for you. So to change a language you need to get the model and then call |
Beta Was this translation helpful? Give feedback.
The editor does not have an associated language, only models have since there could be multiple models that all have different languages associated with them. The language property on the editor creation function is just a shorthand that sets the language of the model the editor automatically creates for you. So to change a language you need to get the model and then call
monaco.editor.setModelLanguage
:https://microsoft.github.io/monaco-editor/playground.html?source=v0.37.1#XQAAAALOAQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw0BRoNohO0pA3UnSQetsfyL9Rw59E2COVxnxnvCRAg0kwCdQb8ogwu-POzKkkdtD5T7ftMOciItf5sNfdz3glkVyhab3fb-vdOYqBGSKPB_xWM4Wo2Qm9A…