mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-11-22 02:22:44 -05:00
chore: Remove extra comments
This commit is contained in:
@ -24,37 +24,15 @@
|
||||
|
||||
namespace QodeAssist {
|
||||
|
||||
/**
|
||||
* @brief Persistent refactoring suggestion that displays code changes inline
|
||||
*
|
||||
* Unlike LLMSuggestion which supports partial acceptance (word/line),
|
||||
* RefactorSuggestion is designed to show complete refactoring results
|
||||
* that must be either fully accepted or rejected by the user.
|
||||
*/
|
||||
class RefactorSuggestion : public TextEditor::TextSuggestion
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs a refactoring suggestion
|
||||
* @param suggestion Suggestion data (range, position, text)
|
||||
* @param sourceDocument The document where suggestion will be displayed
|
||||
*/
|
||||
RefactorSuggestion(const Data &suggestion, QTextDocument *sourceDocument);
|
||||
|
||||
/**
|
||||
* @brief Applies the full refactoring suggestion with smart overlapping
|
||||
* @return true if suggestion was applied successfully
|
||||
*/
|
||||
bool apply() override;
|
||||
|
||||
/**
|
||||
* @brief Disabled: Word-by-word acceptance not supported for refactoring
|
||||
*/
|
||||
bool applyWord(TextEditor::TextEditorWidget *widget) override;
|
||||
|
||||
/**
|
||||
* @brief Disabled: Line-by-line acceptance not supported for refactoring
|
||||
*/
|
||||
bool applyLine(TextEditor::TextEditorWidget *widget) override;
|
||||
|
||||
private:
|
||||
|
||||
@ -58,15 +58,10 @@ void RefactorSuggestionHoverHandler::identifyMatch(
|
||||
int pos,
|
||||
ReportPriority report)
|
||||
{
|
||||
LOG_MESSAGE(QString("RefactorSuggestionHoverHandler::identifyMatch pos=%1, hasSuggestion=%2, suggestionVisible=%3")
|
||||
.arg(pos)
|
||||
.arg(m_hasSuggestion)
|
||||
.arg(editorWidget->suggestionVisible()));
|
||||
|
||||
QScopeGuard cleanup([&] { report(Priority_None); });
|
||||
|
||||
if (!editorWidget->suggestionVisible()) {
|
||||
LOG_MESSAGE("RefactorSuggestionHoverHandler: No suggestion visible");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -74,7 +69,6 @@ void RefactorSuggestionHoverHandler::identifyMatch(
|
||||
cursor.setPosition(pos);
|
||||
m_block = cursor.block();
|
||||
|
||||
// Check if this block has a suggestion
|
||||
#if QODEASSIST_QT_CREATOR_VERSION_MAJOR >= 17
|
||||
auto *suggestion = dynamic_cast<RefactorSuggestion *>(
|
||||
TextEditor::TextBlockUserData::suggestion(m_block));
|
||||
@ -89,11 +83,9 @@ void RefactorSuggestionHoverHandler::identifyMatch(
|
||||
#endif
|
||||
|
||||
if (!suggestion) {
|
||||
LOG_MESSAGE("RefactorSuggestionHoverHandler: No RefactorSuggestion in block");
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_MESSAGE("RefactorSuggestionHoverHandler: Found RefactorSuggestion, reporting Priority_Suggestion");
|
||||
cleanup.dismiss();
|
||||
report(Priority_Suggestion);
|
||||
}
|
||||
@ -118,19 +110,14 @@ void RefactorSuggestionHoverHandler::operateTooltip(
|
||||
#endif
|
||||
|
||||
if (!suggestion) {
|
||||
LOG_MESSAGE("RefactorSuggestionHoverHandler::operateTooltip: No suggestion in block");
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_MESSAGE("RefactorSuggestionHoverHandler::operateTooltip: Creating tooltip widget");
|
||||
|
||||
// Create compact widget with buttons
|
||||
auto *widget = new QWidget();
|
||||
auto *layout = new QHBoxLayout(widget);
|
||||
layout->setContentsMargins(4, 3, 4, 3);
|
||||
layout->setSpacing(6);
|
||||
|
||||
// Get theme colors
|
||||
const QColor normalBg = Utils::creatorColor(Utils::Theme::BackgroundColorNormal);
|
||||
const QColor hoverBg = Utils::creatorColor(Utils::Theme::BackgroundColorHover);
|
||||
const QColor selectedBg = Utils::creatorColor(Utils::Theme::BackgroundColorSelected);
|
||||
@ -211,15 +198,11 @@ void RefactorSuggestionHoverHandler::operateTooltip(
|
||||
layout->addWidget(applyButton);
|
||||
layout->addWidget(dismissButton);
|
||||
|
||||
// Position tooltip above cursor, like standard Qt Creator suggestions
|
||||
const QRect cursorRect = editorWidget->cursorRect(editorWidget->textCursor());
|
||||
QPoint pos = editorWidget->viewport()->mapToGlobal(cursorRect.topLeft())
|
||||
- Utils::ToolTip::offsetFromPosition();
|
||||
pos.ry() -= widget->sizeHint().height();
|
||||
|
||||
LOG_MESSAGE(QString("RefactorSuggestionHoverHandler::operateTooltip: Showing tooltip at (%1, %2)")
|
||||
.arg(pos.x()).arg(pos.y()));
|
||||
|
||||
Utils::ToolTip::show(pos, widget, editorWidget);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user