Skip to content
Snippets Groups Projects
Commit d89b7ecb authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Changed hovering to use the new interpreter & binding code.

Done-with: Roberto Raggi
parent a104d187
No related branches found
No related tags found
No related merge requests found
......@@ -202,7 +202,7 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
Interpreter::ObjectValue *scope = bind(declaringMember);
Check check(&interp);
const Interpreter::Value *value = check(expression, scope);
m_toolTip = interp.typeId(value);
m_toolTip = prettyPrint(value, &interp);
#if 0
QmlLookupContext context(expressionUnderCursor.expressionScopes(), doc, m_modelManager->snapshot(), typeSystem);
......@@ -241,3 +241,22 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
m_toolTip = QString(QLatin1String("<nobr>No help available for \"%1\"")).arg(symbolName);
}
}
QString QmlHoverHandler::prettyPrint(const QmlJS::Interpreter::Value *value, QmlJS::Interpreter::Engine *interp) const
{
if (!value)
return QString();
if (const Interpreter::ObjectValue *objectValue = value->asObjectValue()) {
QString className = objectValue->className();
while (objectValue && objectValue->prototype() && className.isEmpty()) {
objectValue = objectValue->prototype();
className = objectValue->className();
}
return className;
}
return interp->typeId(value);
}
......@@ -43,6 +43,13 @@ namespace Core {
class IEditor;
}
namespace QmlJS {
namespace Interpreter {
class Engine;
class Value;
}
}
namespace TextEditor {
class ITextEditor;
}
......@@ -66,6 +73,7 @@ private slots:
private:
void updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos);
QString prettyPrint(const QmlJS::Interpreter::Value *value, QmlJS::Interpreter::Engine *interp) const;
private:
QmlModelManagerInterface *m_modelManager;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment