async fn init_monaco_editor(self) -> Result<JsValue, JsValue> {
        let column_names = self.props.session.metadata().get_table_columns();
        let monaco = init_monaco().await.unwrap();
        if let Some(ref theme) = *self.theme.borrow() {
            init_theme(theme.as_str(), &monaco);
        }

        set_global_completion_column_names(column_names.into_jserror()?);
        let args = EditorArgs {
            theme: "exprtk-theme",
            value: "",
            language: "exprtk",
            automatic_layout: true,
            minimap: MinimapArgs { enabled: false },
        };

        let container = self.container.cast::<HtmlElement>().unwrap();
        let editor_args = JsValue::from_serde(&args).unwrap();
        let editor = monaco.create(container, editor_args);
        let cmd = (KeyMod::Shift as u32) | (KeyCode::Enter as u32);
        editor.add_command(cmd, self.on_save.as_ref().as_ref().unchecked_ref());
        let cb = self.on_validate.as_ref().as_ref().unchecked_ref();
        *self.editor.borrow_mut() = Some((monaco, editor.clone()));
        await_animation_frame().await?;
        editor.focus();
        self.props.on_init.emit(());
        let expression = maybe!({
            let alias = self.props.alias.as_ref()?;
            let edit = self.props.session.metadata().get_edit_by_alias(alias);
            edit.or_else(|| {
                self.props.session.metadata().get_expression_by_alias(alias)
            })
        });

        if let Some(expr) = expression.as_ref() {
            editor.set_value(expr);
            drop(self.clone().validate_expr().await?);
        } else {
            self.set_default_content();
        }

        editor.get_model().on_did_change_content(cb);
        Ok(JsValue::UNDEFINED)
    }
/// Initialize the `monaco-editor` for this `<perspective-expression-editor>`.
/// This method should only be called once per element.
Initialize the `monaco-editor` for this ``.
This method should only be called once per element.
Initialize the ` monaco - editor ` for this ` ` . This method should only be called once per element .
async fn init_monaco_editor(self) -> Result<JsValue, JsValue> {
        let column_names = self.props.session.metadata().get_table_columns();
        let monaco = init_monaco().await.unwrap();
        if let Some(ref theme) = *self.theme.borrow() {
            init_theme(theme.as_str(), &monaco);
        }
        set_global_completion_column_names(column_names.into_jserror()?);
        let args = EditorArgs {
            theme: "exprtk-theme",
            value: "",
            language: "exprtk",
            automatic_layout: true,
            minimap: MinimapArgs { enabled: false },
        };
        let container = self.container.cast::<HtmlElement>().unwrap();
        let editor_args = JsValue::from_serde(&args).unwrap();
        let editor = monaco.create(container, editor_args);
        let cmd = (KeyMod::Shift as u32) | (KeyCode::Enter as u32);
        editor.add_command(cmd, self.on_save.as_ref().as_ref().unchecked_ref());
        let cb = self.on_validate.as_ref().as_ref().unchecked_ref();
        *self.editor.borrow_mut() = Some((monaco, editor.clone()));
        await_animation_frame().await?;
        editor.focus();
        self.props.on_init.emit(());
        let expression = maybe!({
            let alias = self.props.alias.as_ref()?;
            let edit = self.props.session.metadata().get_edit_by_alias(alias);
            edit.or_else(|| {
                self.props.session.metadata().get_expression_by_alias(alias)
            })
        });
        if let Some(expr) = expression.as_ref() {
            editor.set_value(expr);
            drop(self.clone().validate_expr().await?);
        } else {
            self.set_default_content();
        }
        editor.get_model().on_did_change_content(cb);
        Ok(JsValue::UNDEFINED)
    }
async fn init_monaco_editor ( self ) -> Result < JsValue , JsValue > { let column_names = self . props . session . metadata ( ) . get_table_columns ( ) ; let monaco = init_monaco ( ) . await . unwrap ( ) ; if let Some ( ref theme ) = * self . theme . borrow ( ) { init_theme ( theme . as_str ( ) , & monaco ) ; } set_global_completion_column_names ( column_names . into_jserror ( ) ? ) ; let args = EditorArgs { theme : " " , value : " " , language : " " , automatic_layout : true , minimap : MinimapArgs { enabled : false } , } ; let container = self . container . cast :: < HtmlElement > ( ) . unwrap ( ) ; let editor_args = JsValue :: from_serde ( & args ) . unwrap ( ) ; let editor = monaco . create ( container , editor_args ) ; let cmd = ( KeyMod :: Shift as u32 ) | ( KeyCode :: Enter as u32 ) ; editor . add_command ( cmd , self . on_save . as_ref ( ) . as_ref ( ) . unchecked_ref ( ) ) ; let cb = self . on_validate . as_ref ( ) . as_ref ( ) . unchecked_ref ( ) ; * self . editor . borrow_mut ( ) = Some ( ( monaco , editor . clone ( ) ) ) ; await_animation_frame ( ) . await ? ; editor . focus ( ) ; self . props . on_init . emit ( ( ) ) ; let expression = maybe ! ( { let alias self props alias as_ref ( ) let edit self props session metadata ( ) get_edit_by_alias ( alias ) edit or_else ( { self props session metadata ( ) get_expression_by_alias ( alias ) } ) } ) ; if let Some ( expr ) = expression . as_ref ( ) { editor . set_value ( expr ) ; drop ( self . clone ( ) . validate_expr ( ) . await ? ) ; } else { self . set_default_content ( ) ; } editor . get_model ( ) . on_did_change_content ( cb ) ; Ok ( JsValue :: UNDEFINED ) }
Initialize the `monaco-editor` for this `<perspective-expression-editor>`.
Initialize the ` monaco - editor ` for this ` <perspective - expression - editor > ` .
self
self