forked from qt-creator/qt-creator
Copilot: add copilot suggestion tooltips
These tooltips allow to switch the currently visible suggestion as well as applying it using the mouse. Change-Id: I30b9a76ae57c66887f4e1b1311e1a7248ed0f194 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "copilothoverhandler.h"
|
||||
#include "requests/checkstatus.h"
|
||||
#include "requests/getcompletions.h"
|
||||
#include "requests/signinconfirm.h"
|
||||
@@ -18,12 +19,11 @@
|
||||
|
||||
namespace Copilot::Internal {
|
||||
|
||||
class DocumentWatcher;
|
||||
|
||||
class CopilotClient : public LanguageClient::Client
|
||||
{
|
||||
public:
|
||||
explicit CopilotClient(const Utils::FilePath &nodePath, const Utils::FilePath &distPath);
|
||||
CopilotClient(const Utils::FilePath &nodePath, const Utils::FilePath &distPath);
|
||||
~CopilotClient() override;
|
||||
|
||||
void openDocument(TextEditor::TextDocument *document) override;
|
||||
|
||||
@@ -46,6 +46,8 @@ public:
|
||||
const QString &userCode,
|
||||
std::function<void(const SignInConfirmRequest::Response &response)> callback);
|
||||
|
||||
GetCompletionResponse lastCompletion(TextEditor::TextEditorWidget *editor) const;
|
||||
|
||||
private:
|
||||
QMap<TextEditor::TextEditorWidget *, GetCompletionRequest> m_runningRequests;
|
||||
struct ScheduleData
|
||||
@@ -54,6 +56,8 @@ private:
|
||||
QTimer *timer = nullptr;
|
||||
};
|
||||
QMap<TextEditor::TextEditorWidget *, ScheduleData> m_scheduledRequests;
|
||||
CopilotHoverHandler m_hoverHandler;
|
||||
QHash<TextEditor::TextEditorWidget *, GetCompletionResponse> m_lastCompletions;
|
||||
};
|
||||
|
||||
} // namespace Copilot::Internal
|
||||
|
||||
Reference in New Issue
Block a user