You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-22 15:06:45 +00:00
New Code Completion
-=-=-=-=-=-=-=-=-=- -Massive improvement to code completion -Argument hinting for functions If you manage to out-smart the code-completion in a situation where completion should be possible to guess, let me know. Please enter the commit message for your changes. Lines starting
This commit is contained in:
@@ -84,6 +84,8 @@ public:
|
||||
StringName identifier;
|
||||
StringName setter;
|
||||
StringName getter;
|
||||
int line;
|
||||
Node *expression;
|
||||
};
|
||||
struct Constant {
|
||||
StringName identifier;
|
||||
@@ -96,10 +98,11 @@ public:
|
||||
Vector<FunctionNode*> functions;
|
||||
Vector<FunctionNode*> static_functions;
|
||||
BlockNode *initializer;
|
||||
ClassNode *owner;
|
||||
//Vector<Node*> initializers;
|
||||
int end_line;
|
||||
|
||||
ClassNode() { tool=false; type=TYPE_CLASS; extends_used=false; end_line=-1;}
|
||||
ClassNode() { tool=false; type=TYPE_CLASS; extends_used=false; end_line=-1; owner=NULL;}
|
||||
};
|
||||
|
||||
|
||||
@@ -118,6 +121,8 @@ public:
|
||||
|
||||
struct BlockNode : public Node {
|
||||
|
||||
ClassNode *parent_class=NULL;
|
||||
BlockNode *parent_block=NULL;
|
||||
Map<StringName,int> locals;
|
||||
List<Node*> statements;
|
||||
Vector<StringName> variables;
|
||||
@@ -126,7 +131,7 @@ public:
|
||||
//the following is useful for code completion
|
||||
List<BlockNode*> sub_blocks;
|
||||
int end_line;
|
||||
BlockNode() { type=TYPE_BLOCK; end_line=-1;}
|
||||
BlockNode() { type=TYPE_BLOCK; end_line=-1; parent_block=NULL; parent_class=NULL; }
|
||||
};
|
||||
|
||||
struct TypeNode : public Node {
|
||||
@@ -349,6 +354,18 @@ public:
|
||||
};
|
||||
*/
|
||||
|
||||
enum CompletionType {
|
||||
COMPLETION_NONE,
|
||||
COMPLETION_BUILT_IN_TYPE_CONSTANT,
|
||||
COMPLETION_FUNCTION,
|
||||
COMPLETION_IDENTIFIER,
|
||||
COMPLETION_PARENT_FUNCTION,
|
||||
COMPLETION_METHOD,
|
||||
COMPLETION_CALL_ARGUMENTS,
|
||||
COMPLETION_INDEX,
|
||||
};
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@@ -375,12 +392,31 @@ private:
|
||||
String base_path;
|
||||
String self_path;
|
||||
|
||||
|
||||
ClassNode *current_class;
|
||||
FunctionNode *current_function;
|
||||
BlockNode *current_block;
|
||||
|
||||
bool _get_completable_identifier(CompletionType p_type,StringName& identifier);
|
||||
void _make_completable_call(int p_arg);
|
||||
|
||||
CompletionType completion_type;
|
||||
StringName completion_cursor;
|
||||
bool completion_static;
|
||||
Variant::Type completion_built_in_constant;
|
||||
Node *completion_node;
|
||||
ClassNode *completion_class;
|
||||
FunctionNode *completion_function;
|
||||
BlockNode *completion_block;
|
||||
int completion_line;
|
||||
int completion_argument;
|
||||
|
||||
PropertyInfo current_export;
|
||||
|
||||
void _set_error(const String& p_error, int p_line=-1, int p_column=-1);
|
||||
|
||||
|
||||
bool _parse_arguments(Node* p_parent,Vector<Node*>& p_args,bool p_static);
|
||||
bool _parse_arguments(Node* p_parent, Vector<Node*>& p_args, bool p_static, bool p_can_codecomplete=false);
|
||||
bool _enter_indent_block(BlockNode *p_block=NULL);
|
||||
bool _parse_newline();
|
||||
Node* _parse_expression(Node *p_parent,bool p_static,bool p_allow_assign=false);
|
||||
@@ -404,6 +440,19 @@ public:
|
||||
|
||||
const Node *get_parse_tree() const;
|
||||
|
||||
//completion info
|
||||
|
||||
CompletionType get_completion_type();
|
||||
StringName get_completion_cursor();
|
||||
int get_completion_line();
|
||||
Variant::Type get_completion_built_in_constant();
|
||||
Node *get_completion_node();
|
||||
ClassNode *get_completion_class();
|
||||
BlockNode *get_completion_block();
|
||||
FunctionNode *get_completion_function();
|
||||
int get_completion_argument_index();
|
||||
|
||||
|
||||
void clear();
|
||||
GDParser();
|
||||
~GDParser();
|
||||
|
||||
Reference in New Issue
Block a user