siku2 / rust-monaco

Rust WASM bindings for the Monaco Editor
Apache License 2.0
76 stars 25 forks source link

Failed to run example #34

Open oovm opened 1 year ago

oovm commented 1 year ago
error[E0599]: no method named `with_automatic_layout` found for struct `CodeEditorOptions` in the current scope
  --> yew\src\main.rs:16:10
   |
16 |         .with_automatic_layout(true)
   |          ^^^^^^^^^^^^^^^^^^^^^ method not found in `CodeEditorOptions`

error[E0277]: the trait bound `monaco::yew::CodeEditor: yew::Component` is not satisfied
  --> yew\src\main.rs:32:10
   |
32 |         <CodeEditor classes={"full-height"} options={ get_options().to_sys_options() } model={text_model.clone()} />
   |          ^^^^^^^^^^ the trait `yew::Component` is not implemented for `monaco::yew::CodeEditor`
   |
   = help: the trait `yew::Component` is implemented for `ContextProvider<T>`
   = note: required for `monaco::yew::CodeEditor` to implement `yew::BaseComponent`
   = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the function or associated item `new` exists for struct `VChild<CodeEditor>`, but its trait bounds were not satisfied
  --> yew\src\main.rs:32:10
   |
32 |         <CodeEditor classes={"full-height"} options={ get_options().to_sys_options() } model={text_model.clone()} />
   |          ^^^^^^^^^^ function or associated item cannot be called on `VChild<CodeEditor>` due to unsatisfied trait bounds
   |
  ::: github.com-1ecc6299db9ec823\monaco-0.3.0\src\yew\mod.rs:28:1
   |
28 | pub struct CodeEditor {
   | --------------------- doesn't satisfy `monaco::yew::CodeEditor: yew::BaseComponent`
   |
   = note: the following trait bounds were not satisfied:
           `monaco::yew::CodeEditor: yew::BaseComponent`
   = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info)

with

[dependencies]
wasm-bindgen = "0.2.84"
yew = { version = "0.20.0", features = ["csr"]  }
monaco = { version = "0.3.0", features = ["yew-components"] }
TFILIPS commented 1 year ago

For me it only works when I clone this repo. If I install it with cargo, then I get the same errors.

van-sprundel commented 1 month ago

That's because the main branch implements yew components, but the 0.4.0 release doesn't. I'm changing it to this until they release a new version:

monaco = { git = "https://github.com/siku2/rust-monaco", branch = "main", features = [ "yew-components"] }