Closed ctron closed 1 year ago
I am running into the same issue with other types as well, like LanguageConfiguration
and CommentRule
, to name a few.
They seem to "extend" on Object
, but not allow to create an empty/default instance.
Maybe you can point me into the right direction, I might be able to come up with a PR.
I think I found a workaround:
let comments: CommentRule = js_sys::Object::new().unchecked_into();
comments.set_line_comment(Some("//"));
That's the correct way to do it, yes. I just added a convenience constructor for the various types I could think of. See: https://github.com/siku2/rust-monaco/blob/794a4cc7819f9ed7eb06559e24f75a41e23cf22a/src/sys/editor.rs#L28-L52
Also the reason there isn't just a blanket implementation for all types is that for some types the empty object isn't valid or there are other invariants to uphold.
I guess this can be closed now.
I am trying to set markers. To my understanding I need to create an
IMarkerData
instance. However, I can't see any constructor method, likenew
.