fear: Add hint-trigger for call code completion (#266)

This commit is contained in:
Petr Mironychev
2025-11-17 22:24:04 +01:00
committed by GitHub
parent 86c6930c5f
commit bcdec96d92
13 changed files with 565 additions and 54 deletions

View File

@ -32,6 +32,7 @@
#include "RefactorSuggestionHoverHandler.hpp"
#include "widgets/CompletionProgressHandler.hpp"
#include "widgets/CompletionErrorHandler.hpp"
#include "widgets/CompletionHintHandler.hpp"
#include "widgets/EditorChatButtonHandler.hpp"
#include <languageclient/client.h>
#include <llmcore/IPromptProvider.hpp>
@ -52,6 +53,9 @@ public:
void requestCompletions(TextEditor::TextEditorWidget *editor);
void requestQuickRefactor(
TextEditor::TextEditorWidget *editor, const QString &instructions = QString());
bool isHintVisible() const;
void hideHintAndRequestCompletion(TextEditor::TextEditorWidget *editor);
protected:
bool eventFilter(QObject *watched, QEvent *event) override;
@ -67,6 +71,9 @@ private:
void cleanupConnections();
void handleRefactoringResult(const RefactorResult &result);
void handleAutoRequestTrigger(TextEditor::TextEditorWidget *widget, int charsAdded, bool isSpaceOrTab);
void handleHintBasedTrigger(TextEditor::TextEditorWidget *widget, int charsAdded, bool isSpaceOrTab, QTextCursor &cursor);
QHash<TextEditor::TextEditorWidget *, GetCompletionRequest> m_runningRequests;
QHash<TextEditor::TextEditorWidget *, QTimer *> m_scheduledRequests;
QMetaObject::Connection m_documentOpenedConnection;
@ -74,8 +81,10 @@ private:
QElapsedTimer m_typingTimer;
int m_recentCharCount;
QTimer m_hintHideTimer;
CompletionProgressHandler m_progressHandler;
CompletionErrorHandler m_errorHandler;
CompletionHintHandler m_hintHandler;
EditorChatButtonHandler m_chatButtonHandler;
QuickRefactorHandler *m_refactorHandler{nullptr};
RefactorSuggestionHoverHandler *m_refactorHoverHandler{nullptr};