Add a new completion API for experimental plugins feature. (#5000)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL
2023-12-10 14:41:05 +01:00
committed by GitHub
parent e4258160cd
commit fd4cac2c2c
13 changed files with 448 additions and 16 deletions
+21
View File
@@ -19,4 +19,25 @@ declare module c2 {
): boolean;
function send_msg(channel: String, text: String): boolean;
function system_msg(channel: String, text: String): boolean;
class CompletionList {
values: String[];
hide_others: boolean;
}
enum EventType {
RegisterCompletions = "RegisterCompletions",
}
type CbFuncCompletionsRequested = (
query: string,
full_text_content: string,
cursor_position: number,
is_first_word: boolean
) => CompletionList;
type CbFunc<T> = T extends EventType.RegisterCompletions
? CbFuncCompletionsRequested
: never;
function register_callback<T>(type: T, func: CbFunc<T>): void;
}