Skip to content

Commit

Permalink
- fix autocomplete not showing up after changing tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-hart committed Dec 19, 2023
1 parent 9e9641d commit b2471b5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions hi_backend/backend/BackendRootWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ class BackendRootWindow : public TopLevelWindowWithOptionalOpenGL,

bool isFullScreenMode() const;

static mcl::TokenCollection::Ptr getJavascriptTokenCollection(Component* any)
{
if(auto brw = GET_BACKEND_ROOT_WINDOW(any))
{
if(brw->javascriptTokens == nullptr)
brw->javascriptTokens = new mcl::TokenCollection(mcl::LanguageIds::HiseScript);

return brw->javascriptTokens;
}

return nullptr;
}

void rebuildTokenProviders(const Identifier& languageId)
{
if(javascriptTokens == nullptr && languageId == mcl::LanguageIds::HiseScript)
Expand Down
6 changes: 5 additions & 1 deletion hi_scripting/scripting/components/ScriptingPanelTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ Component* CodeEditorPanel::createContentComponent(int index)
pe->getEditor()->editor.setScaleFactor(scaleFactor);
#endif

pe->getEditor()->editor.tokenCollection = BackendRootWindow::getJavascriptTokenCollection(this);

pe->addMouseListener(this, true);
getProcessor()->getMainController()->setLastActiveEditor(pe->getEditor(), CodeDocument::Position());
pe->grabKeyboardFocusAsync();
Expand Down Expand Up @@ -112,7 +114,9 @@ Component* CodeEditorPanel::createContentComponent(int index)
if(scaleFactor != -1.0f)
pe->getEditor()->editor.setScaleFactor(scaleFactor);
#endif


pe->getEditor()->editor.tokenCollection = BackendRootWindow::getJavascriptTokenCollection(this);

if(auto ed = pe->getEditor())
getProcessor()->getMainController()->setLastActiveEditor(pe->getEditor(), CodeDocument::Position());

Expand Down

0 comments on commit b2471b5

Please sign in to comment.