diff --git a/addons/symbolviewer/cpp_parser.cpp b/addons/symbolviewer/cpp_parser.cpp --- a/addons/symbolviewer/cpp_parser.cpp +++ b/addons/symbolviewer/cpp_parser.cpp @@ -242,6 +242,7 @@ stripped.replace(0x9, QLatin1String(" ")); if(func_on == true) { + QString strippedWithTypes = stripped; if (m_plugin->typesOn == false) { while (stripped.indexOf(QLatin1Char('(')) >= 0) @@ -278,6 +279,7 @@ if (mclass == 4) node->setIcon(0, QIcon(mtd)); else node->setIcon(0, QIcon(cls)); node->setText(1, QString::number( tmpPos, 10)); + node->setToolTip(0, strippedWithTypes); } stripped.clear(); //retry = 0; diff --git a/addons/symbolviewer/php_parser.cpp b/addons/symbolviewer/php_parser.cpp --- a/addons/symbolviewer/php_parser.cpp +++ b/addons/symbolviewer/php_parser.cpp @@ -87,6 +87,7 @@ QRegExp functionArgsRegExp(QLatin1String("(\\$[\\w_]+)"), Qt::CaseInsensitive); QStringList functionArgsList; QString functionArgs; + QString nameWithTypes; // replace literals by empty strings: “function a($b='nothing', $c="pretty \"cool\" string")” => “function ($b='', $c="")” QRegExp literalRegExp(QLatin1String("([\"'])(?:\\\\.|[^\\\\])*\\1")); @@ -210,17 +211,20 @@ } if (isClass) { - if (m_plugin->typesOn && !classRegExp.cap(1).trimmed().isEmpty() && !classRegExp.cap(4).trimmed().isEmpty()) - { - node->setText(0, classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(1).trimmed()+QLatin1Char(',')+classRegExp.cap(4).trimmed()+QLatin1Char(']')); - } - else if (m_plugin->typesOn && !classRegExp.cap(1).trimmed().isEmpty()) - { - node->setText(0, classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(1).trimmed()+QLatin1Char(']')); - } - else if (m_plugin->typesOn && !classRegExp.cap(4).trimmed().isEmpty()) - { - node->setText(0, classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(4).trimmed()+QLatin1Char(']')); + if (m_plugin->typesOn) { + if (!classRegExp.cap(1).trimmed().isEmpty() && !classRegExp.cap(4).trimmed().isEmpty()) + { + nameWithTypes = classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(1).trimmed()+QLatin1Char(',')+classRegExp.cap(4).trimmed()+QLatin1Char(']'); + } + else if (!classRegExp.cap(1).trimmed().isEmpty()) + { + nameWithTypes = classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(1).trimmed()+QLatin1Char(']'); + } + else if (!classRegExp.cap(4).trimmed().isEmpty()) + { + nameWithTypes = classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(4).trimmed()+QLatin1Char(']'); + } + node->setText(0, nameWithTypes); } else { @@ -231,15 +235,17 @@ { if (m_plugin->typesOn) { - node->setText(0, interfaceRegExp.cap(1) + QLatin1String(" [interface]")); + nameWithTypes = interfaceRegExp.cap(1) + QLatin1String(" [interface]"); + node->setText(0, nameWithTypes); } else { node->setText(0, interfaceRegExp.cap(1)); } } node->setIcon(0, QIcon(classPix)); node->setText(1, QString::number( i, 10)); + node->setToolTip(0, nameWithTypes); inClass = true; inFunction = false; } @@ -295,26 +301,31 @@ node = new QTreeWidgetItem(m_symbols); } + QString functionArgs(functionRegExp.cap(5)); + pos = 0; + while (pos >= 0) { + pos = functionArgsRegExp.indexIn(functionArgs, pos); + if (pos >= 0) { + pos += functionArgsRegExp.matchedLength(); + functionArgsList += functionArgsRegExp.cap(1); + } + } + + nameWithTypes = functionRegExp.cap(4) + QLatin1Char('(') + functionArgsList.join(QLatin1String(", ")) + QLatin1Char(')'); if (m_plugin->typesOn) { - QString functionArgs(functionRegExp.cap(5)); - pos = 0; - while (pos >= 0) { - pos = functionArgsRegExp.indexIn(functionArgs, pos); - if (pos >= 0) { - pos += functionArgsRegExp.matchedLength(); - functionArgsList += functionArgsRegExp.cap(1); - } - } - node->setText(0, functionRegExp.cap(4) + QLatin1Char('(') + functionArgsList.join(QLatin1String(", ")) + QLatin1Char(')')); - functionArgsList.clear(); + node->setText(0, nameWithTypes); } else { node->setText(0, functionRegExp.cap(4)); } + node->setIcon(0, QIcon(functionPix)); node->setText(1, QString::number( i, 10)); + node->setToolTip(0, nameWithTypes); + + functionArgsList.clear(); inFunction = true; } diff --git a/addons/symbolviewer/ruby_parser.cpp b/addons/symbolviewer/ruby_parser.cpp --- a/addons/symbolviewer/ruby_parser.cpp +++ b/addons/symbolviewer/ruby_parser.cpp @@ -60,7 +60,6 @@ if (cl.indexOf( QRegExp(QLatin1String("^class [a-zA-Z0-9]+[^#]")) ) >= 0) { - name = cl.mid(6); if (func_on == true) { if (m_plugin->treeOn) @@ -72,26 +71,28 @@ lastMtdNode = lastClsNode; } else node = new QTreeWidgetItem(m_symbols); - node->setText(0, name); + node->setText(0, cl.mid(6)); node->setIcon(0, QIcon(cls)); node->setText(1, QString::number( i, 10)); } } if (cl.indexOf( QRegExp(QLatin1String("^def [a-zA-Z_]+[^#]")) ) >= 0 ) { - name = cl.mid(4); - if (m_plugin->typesOn == false) - { - name = name.left(name.indexOf(QLatin1Char('('))); - } if (struct_on == true) { if (m_plugin->treeOn) { node = new QTreeWidgetItem(mtdNode, lastMtdNode); lastMtdNode = node; } else node = new QTreeWidgetItem(m_symbols); + + name = cl.mid(4); + node->setToolTip(0, name); + if (m_plugin->typesOn == false) + { + name = name.left(name.indexOf(QLatin1Char('('))); + } node->setText(0, name); node->setIcon(0, QIcon(mtd)); node->setText(1, QString::number( i, 10));