Skip to content

Commit d66ce9d

Browse files
committed
golangeditor update action dbclick
1 parent f290bb1 commit d66ce9d

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

liteidex/src/plugins/golangedit/golangedit.cpp

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ GolangEdit::GolangEdit(LiteApi::IApplication *app, QObject *parent) :
111111
m_enableUseGuru = true;
112112
m_liteApp->appendLog("GolangEdit",QString("Found guru at %1").arg(m_guruFilePath),false);
113113
} else {
114-
m_liteApp->appendLog("GolangEdit",QString("Not found guru!"),false);
114+
m_liteApp->appendLog("GolangEdit",QString("Not found guru, back to oracle!"),false);
115115
}
116116

117117
connect(m_liteApp->editorManager(),SIGNAL(editorCreated(LiteApi::IEditor*)),this,SLOT(editorCreated(LiteApi::IEditor*)));
@@ -758,23 +758,30 @@ void GolangEdit::sourceQueryFinished(int code, QProcess::ExitStatus /*status*/)
758758
void GolangEdit::dbclickSourceQueryOutput(const QTextCursor &cursor)
759759
{
760760
QTextCursor cur = cursor;
761-
cur.select(QTextCursor::WordUnderCursor);
762-
QStringList actions;
763-
actions << "callees" << "callers" << "callstack" << "definition" << "describe" << "freevars" << "implements" << "peers" << "referrers" << "pointsto" << "whicherrs";
764-
QString text = cur.selectedText();
765-
if (actions.contains(text)) {
766-
runSourceQueryByInfo(text);
767-
return;
768-
}
769761
cur.select(QTextCursor::LineUnderCursor);
770-
text = cur.selectedText();
762+
QString text = cur.selectedText();
771763
if (text.isEmpty()) {
772764
return;
773765
}
766+
767+
bool hasGotoLine = false;
774768
QRegExp reg("((?:[a-zA-Z]:)?[\\w\\d_\\s\\-\\\\/\\.]+):(\\d+)[\\.:]?(\\d+)?\\-?(\\d+)?\\.?(\\d+)?\\b");
775-
if (reg.indexIn(text) < 0) {
769+
if (reg.indexIn(text) >= 0) {
770+
hasGotoLine = true;
771+
}
772+
773+
if (!hasGotoLine) {
774+
QTextCursor cur = cursor;
775+
cur.select(QTextCursor::WordUnderCursor);
776+
QString text = cur.selectedText();
777+
QStringList actions;
778+
actions << "callees" << "callers" << "callstack" << "definition" << "describe" << "freevars" << "implements" << "peers" << "referrers" << "pointsto" << "whicherrs";
779+
if (actions.contains(text)) {
780+
runSourceQueryByInfo(text);
781+
}
776782
return;
777783
}
784+
778785
QStringList capList = reg.capturedTexts();
779786
if (capList.count() < 5) {
780787
return;

0 commit comments

Comments
 (0)