Add a new completion API for experimental plugins feature. (#5000)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef CHATTERINO_HAVE_PLUGINS
|
||||
# include <QString>
|
||||
|
||||
# include <vector>
|
||||
|
||||
struct lua_State;
|
||||
namespace chatterino::lua::api {
|
||||
// names in this namespace reflect what's visible inside Lua and follow the lua naming scheme
|
||||
// function names in this namespace reflect what's visible inside Lua and follow the lua naming scheme
|
||||
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
// Following functions are exposed in c2 table.
|
||||
int c2_register_command(lua_State *L);
|
||||
int c2_register_callback(lua_State *L);
|
||||
int c2_send_msg(lua_State *L);
|
||||
int c2_system_msg(lua_State *L);
|
||||
int c2_log(lua_State *L);
|
||||
@@ -23,6 +27,24 @@ int g_import(lua_State *L);
|
||||
// Represents "calls" to qCDebug, qCInfo ...
|
||||
enum class LogLevel { Debug, Info, Warning, Critical };
|
||||
|
||||
// Exposed as c2.EventType
|
||||
// Represents callbacks c2 can do into lua world
|
||||
enum class EventType {
|
||||
CompletionRequested,
|
||||
};
|
||||
|
||||
/**
|
||||
* This is for custom completion, a registered function returns this type
|
||||
* however in Lua array part (value) and object part (hideOthers) are in the same
|
||||
* table.
|
||||
*/
|
||||
struct CompletionList {
|
||||
std::vector<QString> values{};
|
||||
|
||||
// exposed as hide_others
|
||||
bool hideOthers{};
|
||||
};
|
||||
|
||||
} // namespace chatterino::lua::api
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user