Autocompletion: Don't add parenthesis if Callable is expected

This commit is contained in:
HolonProduction 2024-08-31 12:12:19 +02:00
parent af2c713971
commit e7487263ad
16 changed files with 260 additions and 89 deletions

View file

@ -1310,6 +1310,11 @@ public:
COMPLETION_TYPE_NAME_OR_VOID, // Same as TYPE_NAME, but allows void (in function return type).
};
struct CompletionCall {
Node *call = nullptr;
int argument = -1;
};
struct CompletionContext {
CompletionType type = COMPLETION_NONE;
ClassNode *current_class = nullptr;
@ -1321,11 +1326,7 @@ public:
Node *node = nullptr;
Object *base = nullptr;
GDScriptParser *parser = nullptr;
};
struct CompletionCall {
Node *call = nullptr;
int argument = -1;
CompletionCall call;
};
private:
@ -1372,9 +1373,7 @@ private:
SuiteNode *current_suite = nullptr;
CompletionContext completion_context;
CompletionCall completion_call;
List<CompletionCall> completion_call_stack;
bool passed_cursor = false;
bool in_lambda = false;
bool lambda_ended = false; // Marker for when a lambda ends, to apply an end of statement if needed.
@ -1586,7 +1585,6 @@ public:
static Variant::Type get_builtin_type(const StringName &p_type); // Excluding `Variant::NIL` and `Variant::OBJECT`.
CompletionContext get_completion_context() const { return completion_context; }
CompletionCall get_completion_call() const { return completion_call; }
void get_annotation_list(List<MethodInfo> *r_annotations) const;
bool annotation_exists(const String &p_annotation_name) const;