mirror of
https://github.com/godotengine/godot.git
synced 2025-10-28 04:04:24 +00:00
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
This commit is contained in:
parent
03b13e0c69
commit
e956e80c1f
130 changed files with 967 additions and 511 deletions
|
|
@ -658,12 +658,14 @@ uint16_t GDScript::get_rpc_method_id(const StringName &p_method) const {
|
|||
}
|
||||
|
||||
StringName GDScript::get_rpc_method(const uint16_t p_rpc_method_id) const {
|
||||
if (p_rpc_method_id >= rpc_functions.size()) return StringName();
|
||||
if (p_rpc_method_id >= rpc_functions.size())
|
||||
return StringName();
|
||||
return rpc_functions[p_rpc_method_id].name;
|
||||
}
|
||||
|
||||
MultiplayerAPI::RPCMode GDScript::get_rpc_mode_by_id(const uint16_t p_rpc_method_id) const {
|
||||
if (p_rpc_method_id >= rpc_functions.size()) return MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
if (p_rpc_method_id >= rpc_functions.size())
|
||||
return MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
return rpc_functions[p_rpc_method_id].mode;
|
||||
}
|
||||
|
||||
|
|
@ -685,12 +687,14 @@ uint16_t GDScript::get_rset_property_id(const StringName &p_variable) const {
|
|||
}
|
||||
|
||||
StringName GDScript::get_rset_property(const uint16_t p_rset_member_id) const {
|
||||
if (p_rset_member_id >= rpc_variables.size()) return StringName();
|
||||
if (p_rset_member_id >= rpc_variables.size())
|
||||
return StringName();
|
||||
return rpc_variables[p_rset_member_id].name;
|
||||
}
|
||||
|
||||
MultiplayerAPI::RPCMode GDScript::get_rset_mode_by_id(const uint16_t p_rset_member_id) const {
|
||||
if (p_rset_member_id >= rpc_variables.size()) return MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
if (p_rset_member_id >= rpc_variables.size())
|
||||
return MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
return rpc_variables[p_rset_member_id].mode;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -861,71 +861,92 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
|
|||
} break;
|
||||
//unary operators
|
||||
case GDScriptParser::OperatorNode::OP_NEG: {
|
||||
if (!_create_unary_operator(codegen, on, Variant::OP_NEGATE, p_stack_level)) return -1;
|
||||
if (!_create_unary_operator(codegen, on, Variant::OP_NEGATE, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_POS: {
|
||||
if (!_create_unary_operator(codegen, on, Variant::OP_POSITIVE, p_stack_level)) return -1;
|
||||
if (!_create_unary_operator(codegen, on, Variant::OP_POSITIVE, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_NOT: {
|
||||
if (!_create_unary_operator(codegen, on, Variant::OP_NOT, p_stack_level)) return -1;
|
||||
if (!_create_unary_operator(codegen, on, Variant::OP_NOT, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_BIT_INVERT: {
|
||||
if (!_create_unary_operator(codegen, on, Variant::OP_BIT_NEGATE, p_stack_level)) return -1;
|
||||
if (!_create_unary_operator(codegen, on, Variant::OP_BIT_NEGATE, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
//binary operators (in precedence order)
|
||||
case GDScriptParser::OperatorNode::OP_IN: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_IN, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_IN, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_EQUAL: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_EQUAL, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_EQUAL, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_NOT_EQUAL: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_NOT_EQUAL, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_NOT_EQUAL, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_LESS: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_LESS, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_LESS, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_LESS_EQUAL: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_LESS_EQUAL, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_LESS_EQUAL, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_GREATER: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_GREATER, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_GREATER, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_GREATER_EQUAL: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_GREATER_EQUAL, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_GREATER_EQUAL, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_ADD: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_ADD, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_ADD, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_SUB: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_SUBTRACT, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_SUBTRACT, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_MUL: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_MULTIPLY, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_MULTIPLY, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_DIV: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_DIVIDE, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_DIVIDE, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_MOD: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_MODULE, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_MODULE, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
//case GDScriptParser::OperatorNode::OP_SHIFT_LEFT: { if (!_create_binary_operator(codegen,on,Variant::OP_SHIFT_LEFT,p_stack_level)) return -1;} break;
|
||||
//case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT: { if (!_create_binary_operator(codegen,on,Variant::OP_SHIFT_RIGHT,p_stack_level)) return -1;} break;
|
||||
case GDScriptParser::OperatorNode::OP_BIT_AND: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_AND, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_AND, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_BIT_OR: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_OR, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_OR, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_BIT_XOR: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_XOR, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_XOR, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
//shift
|
||||
case GDScriptParser::OperatorNode::OP_SHIFT_LEFT: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_SHIFT_LEFT, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_SHIFT_LEFT, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT: {
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_SHIFT_RIGHT, p_stack_level)) return -1;
|
||||
if (!_create_binary_operator(codegen, on, Variant::OP_SHIFT_RIGHT, p_stack_level))
|
||||
return -1;
|
||||
} break;
|
||||
//assignment operators
|
||||
case GDScriptParser::OperatorNode::OP_ASSIGN_ADD:
|
||||
|
|
|
|||
|
|
@ -123,10 +123,12 @@ class GDScriptCompiler {
|
|||
|
||||
Vector<int> opcodes;
|
||||
void alloc_stack(int p_level) {
|
||||
if (p_level >= stack_max) stack_max = p_level + 1;
|
||||
if (p_level >= stack_max)
|
||||
stack_max = p_level + 1;
|
||||
}
|
||||
void alloc_call(int p_params) {
|
||||
if (p_params >= call_max) call_max = p_params;
|
||||
if (p_params >= call_max)
|
||||
call_max = p_params;
|
||||
}
|
||||
|
||||
int current_line;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ struct GDScriptDataType {
|
|||
Ref<Script> script_type;
|
||||
|
||||
bool is_type(const Variant &p_variant, bool p_allow_implicit_conversion = false) const {
|
||||
if (!has_type) return true; // Can't type check
|
||||
if (!has_type)
|
||||
return true; // Can't type check
|
||||
|
||||
switch (kind) {
|
||||
case UNINITIALIZED:
|
||||
|
|
|
|||
|
|
@ -2047,7 +2047,8 @@ bool GDScriptParser::_reduce_export_var_type(Variant &p_value, int p_line) {
|
|||
if (p_value.get_type() == Variant::ARRAY) {
|
||||
Array arr = p_value;
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
if (!_reduce_export_var_type(arr[i], p_line)) return false;
|
||||
if (!_reduce_export_var_type(arr[i], p_line))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2056,7 +2057,8 @@ bool GDScriptParser::_reduce_export_var_type(Variant &p_value, int p_line) {
|
|||
Dictionary dict = p_value;
|
||||
for (int i = 0; i < dict.size(); i++) {
|
||||
Variant value = dict.get_value_at_index(i);
|
||||
if (!_reduce_export_var_type(value, p_line)) return false;
|
||||
if (!_reduce_export_var_type(value, p_line))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3337,7 +3339,8 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
|
|||
|
||||
_parse_pattern_block(compiled_branches, match_node->branches, p_static);
|
||||
|
||||
if (error_set) return;
|
||||
if (error_set)
|
||||
return;
|
||||
|
||||
ControlFlowNode *match_cf_node = alloc_node<ControlFlowNode>();
|
||||
match_cf_node->cf_type = ControlFlowNode::CF_MATCH;
|
||||
|
|
@ -4934,7 +4937,8 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!_reduce_export_var_type(cn->value, member.line)) return;
|
||||
if (!_reduce_export_var_type(cn->value, member.line))
|
||||
return;
|
||||
|
||||
member._export.type = cn->value.get_type();
|
||||
member._export.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
|
||||
|
|
@ -5451,8 +5455,10 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive
|
|||
}
|
||||
}
|
||||
|
||||
if (base_class) break;
|
||||
if (found) continue;
|
||||
if (base_class)
|
||||
break;
|
||||
if (found)
|
||||
continue;
|
||||
|
||||
if (p->constant_expressions.has(base)) {
|
||||
if (p->constant_expressions[base].expression->type != Node::TYPE_CONSTANT) {
|
||||
|
|
@ -5554,10 +5560,12 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive
|
|||
}
|
||||
|
||||
String GDScriptParser::DataType::to_string() const {
|
||||
if (!has_type) return "var";
|
||||
if (!has_type)
|
||||
return "var";
|
||||
switch (kind) {
|
||||
case BUILTIN: {
|
||||
if (builtin_type == Variant::NIL) return "null";
|
||||
if (builtin_type == Variant::NIL)
|
||||
return "null";
|
||||
return Variant::get_type_name(builtin_type);
|
||||
} break;
|
||||
case NATIVE: {
|
||||
|
|
@ -5721,8 +5729,10 @@ bool GDScriptParser::_parse_type(DataType &r_type, bool p_can_be_void) {
|
|||
}
|
||||
|
||||
GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source, int p_line) {
|
||||
if (!p_source.has_type) return p_source;
|
||||
if (p_source.kind != DataType::UNRESOLVED) return p_source;
|
||||
if (!p_source.has_type)
|
||||
return p_source;
|
||||
if (p_source.kind != DataType::UNRESOLVED)
|
||||
return p_source;
|
||||
|
||||
Vector<String> full_name = p_source.native_type.operator String().split(".", false);
|
||||
int name_part = 0;
|
||||
|
|
@ -6962,7 +6972,8 @@ bool GDScriptParser::_get_function_signature(DataType &p_base_type, const String
|
|||
native = "_" + native.operator String();
|
||||
}
|
||||
if (!ClassDB::class_exists(native)) {
|
||||
if (!check_types) return false;
|
||||
if (!check_types)
|
||||
return false;
|
||||
ERR_FAIL_V_MSG(false, "Parser bug: Class '" + String(native) + "' not found.");
|
||||
}
|
||||
|
||||
|
|
@ -7053,7 +7064,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
|
|||
par_types.write[i - 1] = _reduce_node_type(p_call->arguments[i]);
|
||||
}
|
||||
|
||||
if (error_set) return DataType();
|
||||
if (error_set)
|
||||
return DataType();
|
||||
|
||||
// Special case: check copy constructor. Those are defined implicitly in Variant.
|
||||
if (par_types.size() == 1) {
|
||||
|
|
@ -7121,7 +7133,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
|
|||
err += "' matches the signature '";
|
||||
err += Variant::get_type_name(tn->vtype) + "(";
|
||||
for (int i = 0; i < par_types.size(); i++) {
|
||||
if (i > 0) err += ", ";
|
||||
if (i > 0)
|
||||
err += ", ";
|
||||
err += par_types[i].to_string();
|
||||
}
|
||||
err += ")'.";
|
||||
|
|
@ -7479,7 +7492,8 @@ bool GDScriptParser::_get_member_type(const DataType &p_base_type, const StringN
|
|||
native = "_" + native.operator String();
|
||||
}
|
||||
if (!ClassDB::class_exists(native)) {
|
||||
if (!check_types) return false;
|
||||
if (!check_types)
|
||||
return false;
|
||||
ERR_FAIL_V_MSG(false, "Parser bug: Class \"" + String(native) + "\" not found.");
|
||||
}
|
||||
|
||||
|
|
@ -7776,12 +7790,14 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
|
|||
// Function declarations
|
||||
for (int i = 0; i < p_class->static_functions.size(); i++) {
|
||||
_check_function_types(p_class->static_functions[i]);
|
||||
if (error_set) return;
|
||||
if (error_set)
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < p_class->functions.size(); i++) {
|
||||
_check_function_types(p_class->functions[i]);
|
||||
if (error_set) return;
|
||||
if (error_set)
|
||||
return;
|
||||
}
|
||||
|
||||
// Class variables
|
||||
|
|
@ -7856,7 +7872,8 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
|
|||
}
|
||||
|
||||
// Setter and getter
|
||||
if (v.setter == StringName() && v.getter == StringName()) continue;
|
||||
if (v.setter == StringName() && v.getter == StringName())
|
||||
continue;
|
||||
|
||||
bool found_getter = false;
|
||||
bool found_setter = false;
|
||||
|
|
@ -7899,10 +7916,12 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (found_getter && found_setter) break;
|
||||
if (found_getter && found_setter)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((found_getter || v.getter == StringName()) && (found_setter || v.setter == StringName())) continue;
|
||||
if ((found_getter || v.getter == StringName()) && (found_setter || v.setter == StringName()))
|
||||
continue;
|
||||
|
||||
// Check for static functions
|
||||
for (int j = 0; j < p_class->static_functions.size(); j++) {
|
||||
|
|
@ -7933,7 +7952,8 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
|
|||
for (int i = 0; i < p_class->subclasses.size(); i++) {
|
||||
current_class = p_class->subclasses[i];
|
||||
_check_class_level_types(current_class);
|
||||
if (error_set) return;
|
||||
if (error_set)
|
||||
return;
|
||||
current_class = p_class;
|
||||
}
|
||||
}
|
||||
|
|
@ -8081,7 +8101,8 @@ void GDScriptParser::_check_class_blocks_types(ClassNode *p_class) {
|
|||
_check_block_types(current_block);
|
||||
current_block = nullptr;
|
||||
current_function = nullptr;
|
||||
if (error_set) return;
|
||||
if (error_set)
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < p_class->functions.size(); i++) {
|
||||
|
|
@ -8091,7 +8112,8 @@ void GDScriptParser::_check_class_blocks_types(ClassNode *p_class) {
|
|||
_check_block_types(current_block);
|
||||
current_block = nullptr;
|
||||
current_function = nullptr;
|
||||
if (error_set) return;
|
||||
if (error_set)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
|
@ -8112,7 +8134,8 @@ void GDScriptParser::_check_class_blocks_types(ClassNode *p_class) {
|
|||
for (int i = 0; i < p_class->subclasses.size(); i++) {
|
||||
current_class = p_class->subclasses[i];
|
||||
_check_class_blocks_types(current_class);
|
||||
if (error_set) return;
|
||||
if (error_set)
|
||||
return;
|
||||
current_class = p_class;
|
||||
}
|
||||
}
|
||||
|
|
@ -8375,7 +8398,8 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
|||
_add_warning(GDScriptWarning::RETURN_VALUE_DISCARDED, op->line, func_name);
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
if (error_set) return;
|
||||
if (error_set)
|
||||
return;
|
||||
} break;
|
||||
case OperatorNode::OP_YIELD: {
|
||||
_mark_line_as_safe(op->line);
|
||||
|
|
@ -8410,7 +8434,8 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_type.has_type) break;
|
||||
if (!function_type.has_type)
|
||||
break;
|
||||
|
||||
if (function_type.kind == DataType::BUILTIN && function_type.builtin_type == Variant::NIL) {
|
||||
// Return void, should not have arguments
|
||||
|
|
@ -8470,7 +8495,8 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
|||
current_block = p_block->sub_blocks[i];
|
||||
_check_block_types(current_block);
|
||||
current_block = p_block;
|
||||
if (error_set) return;
|
||||
if (error_set)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
|
@ -8613,7 +8639,8 @@ Error GDScriptParser::_parse(const String &p_base_path) {
|
|||
current_function = nullptr;
|
||||
current_block = nullptr;
|
||||
|
||||
if (for_completion) check_types = false;
|
||||
if (for_completion)
|
||||
check_types = false;
|
||||
|
||||
// Resolve all class-level stuff before getting into function blocks
|
||||
_check_class_level_types(main_class);
|
||||
|
|
|
|||
|
|
@ -648,12 +648,14 @@ private:
|
|||
void _check_block_types(BlockNode *p_block);
|
||||
_FORCE_INLINE_ void _mark_line_as_safe(int p_line) const {
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (safe_lines) safe_lines->insert(p_line);
|
||||
if (safe_lines)
|
||||
safe_lines->insert(p_line);
|
||||
#endif // DEBUG_ENABLED
|
||||
}
|
||||
_FORCE_INLINE_ void _mark_line_as_unsafe(int p_line) const {
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (safe_lines) safe_lines->erase(p_line);
|
||||
if (safe_lines)
|
||||
safe_lines->erase(p_line);
|
||||
#endif // DEBUG_ENABLED
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -385,7 +385,8 @@ String ExtendGDScriptParser::parse_documentation(int p_line, bool p_docs_down) {
|
|||
int start_line = p_docs_down ? p_line : p_line - 1;
|
||||
for (int i = start_line; true; i += step) {
|
||||
|
||||
if (i < 0 || i >= lines.size()) break;
|
||||
if (i < 0 || i >= lines.size())
|
||||
break;
|
||||
|
||||
String line_comment = lines[i].strip_edges(true, false);
|
||||
if (line_comment.begins_with("#")) {
|
||||
|
|
|
|||
|
|
@ -185,7 +185,8 @@ Array GDScriptWorkspace::symbol(const Dictionary &p_params) {
|
|||
}
|
||||
|
||||
Error GDScriptWorkspace::initialize() {
|
||||
if (initialized) return OK;
|
||||
if (initialized)
|
||||
return OK;
|
||||
|
||||
DocData *doc = EditorHelp::get_doc_data();
|
||||
for (Map<String, DocData::ClassDoc>::Element *E = doc->class_list.front(); E; E = E->next()) {
|
||||
|
|
|
|||
|
|
@ -282,7 +282,8 @@ struct Command {
|
|||
Dictionary dict;
|
||||
dict["title"] = title;
|
||||
dict["command"] = command;
|
||||
if (arguments.size()) dict["arguments"] = arguments;
|
||||
if (arguments.size())
|
||||
dict["arguments"] = arguments;
|
||||
return dict;
|
||||
}
|
||||
};
|
||||
|
|
@ -946,16 +947,20 @@ struct CompletionItem {
|
|||
dict["preselect"] = preselect;
|
||||
dict["sortText"] = sortText;
|
||||
dict["filterText"] = filterText;
|
||||
if (commitCharacters.size()) dict["commitCharacters"] = commitCharacters;
|
||||
if (commitCharacters.size())
|
||||
dict["commitCharacters"] = commitCharacters;
|
||||
dict["command"] = command.to_json();
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
|
||||
void load(const Dictionary &p_dict) {
|
||||
if (p_dict.has("label")) label = p_dict["label"];
|
||||
if (p_dict.has("kind")) kind = p_dict["kind"];
|
||||
if (p_dict.has("detail")) detail = p_dict["detail"];
|
||||
if (p_dict.has("label"))
|
||||
label = p_dict["label"];
|
||||
if (p_dict.has("kind"))
|
||||
kind = p_dict["kind"];
|
||||
if (p_dict.has("detail"))
|
||||
detail = p_dict["detail"];
|
||||
if (p_dict.has("documentation")) {
|
||||
Variant doc = p_dict["documentation"];
|
||||
if (doc.get_type() == Variant::STRING) {
|
||||
|
|
@ -965,12 +970,18 @@ struct CompletionItem {
|
|||
documentation.value = v["value"];
|
||||
}
|
||||
}
|
||||
if (p_dict.has("deprecated")) deprecated = p_dict["deprecated"];
|
||||
if (p_dict.has("preselect")) preselect = p_dict["preselect"];
|
||||
if (p_dict.has("sortText")) sortText = p_dict["sortText"];
|
||||
if (p_dict.has("filterText")) filterText = p_dict["filterText"];
|
||||
if (p_dict.has("insertText")) insertText = p_dict["insertText"];
|
||||
if (p_dict.has("data")) data = p_dict["data"];
|
||||
if (p_dict.has("deprecated"))
|
||||
deprecated = p_dict["deprecated"];
|
||||
if (p_dict.has("preselect"))
|
||||
preselect = p_dict["preselect"];
|
||||
if (p_dict.has("sortText"))
|
||||
sortText = p_dict["sortText"];
|
||||
if (p_dict.has("filterText"))
|
||||
filterText = p_dict["filterText"];
|
||||
if (p_dict.has("insertText"))
|
||||
insertText = p_dict["insertText"];
|
||||
if (p_dict.has("data"))
|
||||
data = p_dict["data"];
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue