1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-14 13:41:12 +00:00

Add keyword completion to shader editor

This commit is contained in:
Yuri Roubinsky
2022-04-27 14:18:32 +03:00
parent cbdc33bcf7
commit 15032e01e6
2 changed files with 495 additions and 109 deletions

View File

@@ -756,6 +756,7 @@ public:
static bool is_token_interpolation(TokenType p_type);
static DataInterpolation get_token_interpolation(TokenType p_type);
static bool is_token_precision(TokenType p_type);
static bool is_token_arg_qual(TokenType p_type);
static DataPrecision get_token_precision(TokenType p_type);
static String get_precision_name(DataPrecision p_type);
static String get_datatype_name(DataType p_type);
@@ -870,6 +871,9 @@ private:
struct KeyWord {
TokenType token;
const char *text;
uint32_t flags;
const Vector<String> excluded_shader_types;
const Vector<String> functions;
};
static const KeyWord keyword_list[];
@@ -920,6 +924,7 @@ private:
int char_idx;
int tk_line;
StringName shader_type_identifier;
StringName current_function;
bool last_const = false;
StringName last_name;
@@ -972,6 +977,7 @@ private:
Token _make_token(TokenType p_type, const StringName &p_text = StringName());
Token _get_token();
bool _lookup_next(Token &r_tk);
ShaderNode *shader = nullptr;
@@ -1029,6 +1035,10 @@ private:
StringName completion_struct;
int completion_argument;
#ifdef DEBUG_ENABLED
uint32_t keyword_completion_context;
#endif // DEBUG_ENABLED
const Map<StringName, FunctionInfo> *stages = nullptr;
bool _get_completable_identifier(BlockNode *p_block, CompletionType p_type, StringName &identifier);