@Test public void testOnMonacoLoaded() { final MonacoPropertiesFactory properties = mock(MonacoPropertiesFactory.class); final MonacoLanguages languages = mock(MonacoLanguages.class); final JavaScriptObject language = mock(JavaScriptObject.class); final JavaScriptObject languageDefinition = mock(JavaScriptObject.class); final JavaScriptObject completionItemProvider = mock(JavaScriptObject.class); final JavaScriptObject themeData = mock(JavaScriptObject.class); final JavaScriptObject constructionOptions = mock(JavaScriptObject.class); final MonacoEditor editor = mock(MonacoEditor.class); final Monaco monaco = mock(Monaco.class); monaco.languages = languages; monaco.editor = editor; when(properties.getLanguage()).thenReturn(language); when(properties.getLanguageDefinition()).thenReturn(languageDefinition); when(properties.getCompletionItemProvider(variableSuggestions)).thenReturn(completionItemProvider); when(properties.getThemeData()).thenReturn(themeData); when(properties.getConstructionOptions()).thenReturn(constructionOptions); when(properties.getConstructionOptions()).thenReturn(constructionOptions); doReturn(properties).when(initializer).makeMonacoPropertiesFactory(); initializer.onMonacoLoaded().accept(monaco); verify(languages).register(language); verify(languages).setMonarchTokensProvider(FEEL_LANGUAGE_ID, languageDefinition); verify(languages).registerCompletionItemProvider(FEEL_LANGUAGE_ID, completionItemProvider); verify(languages).register(language); verify(editor).defineTheme(FEEL_THEME_ID, themeData); verify(initializer).setFEELAsInitialized(); }
Consumer<Monaco> onMonacoLoaded() { final MonacoPropertiesFactory properties = makeMonacoPropertiesFactory(); return monaco -> { monaco.languages.register(properties.getLanguage()); monaco.languages.setMonarchTokensProvider(FEEL_LANGUAGE_ID, properties.getLanguageDefinition()); monaco.languages.registerCompletionItemProvider(FEEL_LANGUAGE_ID, properties.getCompletionItemProvider(variableSuggestions)); monaco.editor.defineTheme(FEEL_THEME_ID, properties.getThemeData()); setFEELAsInitialized(); }; }
MonacoFEELInitializer { Consumer<Monaco> onMonacoLoaded() { final MonacoPropertiesFactory properties = makeMonacoPropertiesFactory(); return monaco -> { monaco.languages.register(properties.getLanguage()); monaco.languages.setMonarchTokensProvider(FEEL_LANGUAGE_ID, properties.getLanguageDefinition()); monaco.languages.registerCompletionItemProvider(FEEL_LANGUAGE_ID, properties.getCompletionItemProvider(variableSuggestions)); monaco.editor.defineTheme(FEEL_THEME_ID, properties.getThemeData()); setFEELAsInitialized(); }; } }
MonacoFEELInitializer { Consumer<Monaco> onMonacoLoaded() { final MonacoPropertiesFactory properties = makeMonacoPropertiesFactory(); return monaco -> { monaco.languages.register(properties.getLanguage()); monaco.languages.setMonarchTokensProvider(FEEL_LANGUAGE_ID, properties.getLanguageDefinition()); monaco.languages.registerCompletionItemProvider(FEEL_LANGUAGE_ID, properties.getCompletionItemProvider(variableSuggestions)); monaco.editor.defineTheme(FEEL_THEME_ID, properties.getThemeData()); setFEELAsInitialized(); }; } @Inject  MonacoFEELInitializer(final MonacoFEELVariableSuggestions variableSuggestions); }
MonacoFEELInitializer { Consumer<Monaco> onMonacoLoaded() { final MonacoPropertiesFactory properties = makeMonacoPropertiesFactory(); return monaco -> { monaco.languages.register(properties.getLanguage()); monaco.languages.setMonarchTokensProvider(FEEL_LANGUAGE_ID, properties.getLanguageDefinition()); monaco.languages.registerCompletionItemProvider(FEEL_LANGUAGE_ID, properties.getCompletionItemProvider(variableSuggestions)); monaco.editor.defineTheme(FEEL_THEME_ID, properties.getThemeData()); setFEELAsInitialized(); }; } @Inject  MonacoFEELInitializer(final MonacoFEELVariableSuggestions variableSuggestions); void initializeFEELEditor(); MonacoFEELInitializationStatus getInitializationStatus(); }
MonacoFEELInitializer { Consumer<Monaco> onMonacoLoaded() { final MonacoPropertiesFactory properties = makeMonacoPropertiesFactory(); return monaco -> { monaco.languages.register(properties.getLanguage()); monaco.languages.setMonarchTokensProvider(FEEL_LANGUAGE_ID, properties.getLanguageDefinition()); monaco.languages.registerCompletionItemProvider(FEEL_LANGUAGE_ID, properties.getCompletionItemProvider(variableSuggestions)); monaco.editor.defineTheme(FEEL_THEME_ID, properties.getThemeData()); setFEELAsInitialized(); }; } @Inject  MonacoFEELInitializer(final MonacoFEELVariableSuggestions variableSuggestions); void initializeFEELEditor(); MonacoFEELInitializationStatus getInitializationStatus(); static final ImmutableList<String> FEEL_RESERVED_KEYWORDS; }