-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [completion] Optimize intelligent completion
as title Log: Optimize intelligent completion
- Loading branch information
Showing
20 changed files
with
351 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#include "abstractinlinecompletionprovider.h" | ||
|
||
AbstractInlineCompletionProvider::AbstractInlineCompletionProvider(QObject *parent) | ||
: QObject(parent) | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef ABSTRACTINLINECOMPLETIONPROVIDER_H | ||
#define ABSTRACTINLINECOMPLETIONPROVIDER_H | ||
|
||
#include <QObject> | ||
|
||
class AbstractInlineCompletionProvider : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
struct Position | ||
{ | ||
int line = -1; | ||
int column = -1; | ||
|
||
bool operator==(const Position &pos) const | ||
{ | ||
return line == pos.line && column == pos.column; | ||
} | ||
|
||
bool operator!=(const Position &pos) const | ||
{ | ||
return !(operator==(pos)); | ||
} | ||
}; | ||
|
||
struct InlineCompletionContext | ||
{ | ||
QString prefix; | ||
QString suffix; | ||
}; | ||
|
||
struct InlineCompletionItem | ||
{ | ||
QString completion; | ||
Position pos; | ||
}; | ||
|
||
explicit AbstractInlineCompletionProvider(QObject *parent = nullptr); | ||
|
||
virtual QString providerName() const = 0; | ||
virtual void provideInlineCompletionItems(const Position &pos, const InlineCompletionContext &contex) = 0; | ||
virtual QList<InlineCompletionItem> inlineCompletionItems() const = 0; | ||
virtual bool inlineCompletionEnabled() const { return false; } | ||
|
||
Q_SIGNALS: | ||
void finished(); | ||
}; | ||
|
||
Q_DECLARE_METATYPE(AbstractInlineCompletionProvider::InlineCompletionItem) | ||
#endif // ABSTRACTINLINECOMPLETIONPROVIDER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.