| 2499 | } |
| 2500 | |
| 2501 | bool DebuggerPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& position, const Uint32& ) { |
| 2502 | if ( !mDebugger || !mListener || !mDebugger->isServerConnected() || |
| 2503 | mDebuggingState != StatusDebuggerController::State::Paused ) { |
| 2504 | return false; |
| 2505 | } |
| 2506 | |
| 2507 | auto localPos( editor->convertToNodeSpace( position.asFloat() ) ); |
| 2508 | if ( localPos.x <= editor->getGutterWidth() ) |
| 2509 | return false; |
| 2510 | |
| 2511 | if ( editor->getTooltip() ) |
| 2512 | editor->getTooltip()->hide(); |
| 2513 | |
| 2514 | editor->debounce( |
| 2515 | [this, editor, position]() { |
| 2516 | if ( !mManager->getSplitter()->editorExists( editor ) ) |
| 2517 | return; |
| 2518 | auto docPos = editor->resolveScreenPosition( position.asFloat() ); |
| 2519 | auto range = editor->getDocument().getWordRangeInPosition( docPos, true ); |
| 2520 | auto expression = editor->getDocument().getWordInPosition( docPos, true ).toUtf8(); |
| 2521 | |
| 2522 | if ( !range.isValid() || expression.empty() || |
| 2523 | LuaPattern::hasMatches( expression, "^[%p%s]+$" ) ) |
| 2524 | return; |
| 2525 | |
| 2526 | if ( !mDebugger ) |
| 2527 | return; |
| 2528 | |
| 2529 | mCurrentHover = range; |
| 2530 | |
| 2531 | mDebugger->evaluate( |
| 2532 | expression, "hover", mListener->getCurrentFrameId(), |
| 2533 | [this, editor, expression]( const std::string&, |
| 2534 | const std::optional<EvaluateInfo>& info ) { |
| 2535 | if ( info && mManager->getSplitter()->editorExists( editor ) && |
| 2536 | !info->result.empty() ) { |
| 2537 | editor->runOnMainThread( |
| 2538 | [this, editor, info = std::move( *info ), expression]() { |
| 2539 | auto mousePos = editor->getInput()->getMousePos(); |
| 2540 | if ( !editor->getScreenRect().contains( mousePos.asFloat() ) ) |
| 2541 | return; |
| 2542 | |
| 2543 | auto docPos = editor->resolveScreenPosition( mousePos.asFloat() ); |
| 2544 | auto range = |
| 2545 | editor->getDocument().getWordRangeInPosition( docPos, true ); |
| 2546 | |
| 2547 | if ( mCurrentHover.contains( range ) ) { |
| 2548 | mCurrentHover = range; |
| 2549 | displayTooltip( editor, expression, info, mousePos.asFloat() ); |
| 2550 | } |
| 2551 | } ); |
| 2552 | } |
| 2553 | } ); |
| 2554 | }, |
| 2555 | mHoverDelay, getMouseMoveHash( editor ) ); |
| 2556 | editor->updateMouseCursor( position.asFloat() ); |
| 2557 | return false; |
| 2558 | } |
nothing calls this directly
no test coverage detected