diff options
| author | Eike Ziller <eike.ziller@qt.io> | 2017-12-20 09:28:29 +0100 |
|---|---|---|
| committer | Eike Ziller <eike.ziller@qt.io> | 2018-01-05 15:08:20 +0000 |
| commit | f73e91128adeaca803e53b0f7af79075bf6ee4b1 (patch) | |
| tree | cb65f02a369cd1a344d6da686179c059645b6ba9 /plugins/haskell/haskellhoverhandler.cpp | |
| parent | 1d8b12047ae4a175303b827e6d682189edb2391c (diff) | |
Propagate ghc-mod errors up
Mostly an enabler for providing more useful information to the user in
follow-up patches.
Change-Id: Ia457f0f92175340fe93754df6215693d3a93dd3a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'plugins/haskell/haskellhoverhandler.cpp')
| -rw-r--r-- | plugins/haskell/haskellhoverhandler.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/plugins/haskell/haskellhoverhandler.cpp b/plugins/haskell/haskellhoverhandler.cpp index f418170..bb8472b 100644 --- a/plugins/haskell/haskellhoverhandler.cpp +++ b/plugins/haskell/haskellhoverhandler.cpp @@ -87,17 +87,19 @@ void HaskellHoverHandler::identifyMatch(TextEditor::TextEditorWidget *editorWidg } static void tryShowToolTip(const QPointer<QWidget> &widget, const QPoint &point, - QFuture<Utils::optional<QString>> typeFuture, - QFuture<Utils::optional<SymbolInfo>> symbolFuture) + QFuture<QStringOrError> typeFuture, + QFuture<SymbolInfoOrError> symbolFuture) { if (Utils::ToolTip::isVisible() && widget && symbolFuture.isResultReadyAt(0) && typeFuture.isResultReadyAt(0)) { - const Utils::optional<QString> type = typeFuture.result(); - const Utils::optional<SymbolInfo> info = symbolFuture.result(); - const QString typeString = !type || type.value().isEmpty() + const QStringOrError typeOrError = typeFuture.result(); + const SymbolInfoOrError infoOrError = symbolFuture.result(); + const QString *type = Utils::get_if<QString>(&typeOrError); + const SymbolInfo *info = Utils::get_if<SymbolInfo>(&infoOrError); + const QString typeString = !type || type->isEmpty() ? QString() - : toCode(":: " + type.value()); - const QString infoString = info ? symbolToHtml(info.value()) : QString(); + : toCode(":: " + *type); + const QString infoString = info ? symbolToHtml(*info) : QString(); const QString tip = typeString + infoString; Utils::ToolTip::show(point, tip, widget); } @@ -123,13 +125,13 @@ void HaskellHoverHandler::operateTooltip(TextEditor::TextEditorWidget *editorWid Utils::onResultReady(m_typeFuture, [typeFuture = m_typeFuture, symbolFuture = m_symbolFuture, ghcmod, widget, point] // hold shared ghcmod pointer - (const Utils::optional<QString> &) { + (const QStringOrError &) { tryShowToolTip(widget, point, typeFuture, symbolFuture); }); Utils::onResultReady(m_symbolFuture, [typeFuture = m_typeFuture, symbolFuture = m_symbolFuture, ghcmod, widget, point] // hold shared ghcmod pointer - (const Utils::optional<SymbolInfo> &) { + (const SymbolInfoOrError &) { tryShowToolTip(widget, point, typeFuture, symbolFuture); }); } |
