blob: 719016236a2b71703f86477277c618a9c035ada9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "requests/getcompletions.h"
#include <texteditor/textdocumentlayout.h>
#include <texteditor/texteditor.h>
namespace Copilot::Internal {
class CopilotSuggestion final : public TextEditor::TextSuggestion
{
public:
CopilotSuggestion(const QList<Completion> &completions,
QTextDocument *origin,
int currentCompletion = 0);
bool apply() final;
bool applyWord(TextEditor::TextEditorWidget *widget) final;
void reset() final;
int position() final;
const QList<Completion> &completions() const { return m_completions; }
int currentCompletion() const { return m_currentCompletion; }
private:
QList<Completion> m_completions;
int m_currentCompletion = 0;
QTextCursor m_start;
};
} // namespace Copilot::Internal
|