Skip to content

Commit

Permalink
reset gocode
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc committed Apr 21, 2015
1 parent 24c6685 commit 0ef4ded
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion liteidex/src/plugins/golangcode/golangcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,23 @@ void GolangCode::currentEnvChanged(LiteApi::IEnv*)
void GolangCode::currentEditorChanged(LiteApi::IEditor *editor)
{
if (!editor) {
this->setCompleter(0);
return;
}
if (editor->mimeType() != "text/x-gosrc") {

if (editor->mimeType() == "text/x-gosrc") {
LiteApi::ICompleter *completer = LiteApi::findExtensionObject<LiteApi::ICompleter*>(editor,"LiteApi.ICompleter");
this->setCompleter(completer);
} else if (editor->mimeType() == "browser/goplay") {
LiteApi::IEditor* editor = LiteApi::findExtensionObject<LiteApi::IEditor*>(m_liteApp->extension(),"LiteApi.Goplay.IEditor");
if (editor && editor->mimeType() == "text/x-gosrc") {
LiteApi::ICompleter *completer = LiteApi::findExtensionObject<LiteApi::ICompleter*>(editor,"LiteApi.ICompleter");
this->setCompleter(completer);
}
} else {
return;
}

m_editor = LiteApi::getTextEditor(editor);
if (!m_editor) {
return;
Expand Down Expand Up @@ -512,6 +524,8 @@ void GolangCode::finished(int code,QProcess::ExitStatus)
m_breset = false;
m_gocodeProcess->setWorkingDirectory(m_liteApp->applicationPath());
m_gocodeProcess->start(m_gocodeCmd);
m_liteApp->appendLog("GolangCode","reset gocode");
this->currentEditorChanged(m_liteApp->editorManager()->currentEditor());
return;
}

Expand Down
2 changes: 1 addition & 1 deletion liteidex/src/plugins/golangcode/golangcodeplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ bool GolangCodePlugin::load(LiteApi::IApplication *app)

app->optionManager()->addFactory(new GolangCodeOptionFactory(app,this));
connect(app->editorManager(),SIGNAL(editorCreated(LiteApi::IEditor*)),this,SLOT(editorCreated(LiteApi::IEditor*)));
connect(app->editorManager(),SIGNAL(currentEditorChanged(LiteApi::IEditor*)),this,SLOT(currentEditorChanged(LiteApi::IEditor*)));
//connect(app->editorManager(),SIGNAL(currentEditorChanged(LiteApi::IEditor*)),this,SLOT(currentEditorChanged(LiteApi::IEditor*)));
connect(app,SIGNAL(loaded()),this,SLOT(appLoaded()));
return true;
}
Expand Down

0 comments on commit 0ef4ded

Please sign in to comment.