Honoring the Indent setting for gdscript
This commit is contained in:
parent
d9eae920a9
commit
924bccdbd1
|
@ -55,11 +55,12 @@ Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const Str
|
||||||
"# var a = 2\n" +
|
"# var a = 2\n" +
|
||||||
"# var b = \"textvar\"\n\n" +
|
"# var b = \"textvar\"\n\n" +
|
||||||
"func _ready():\n" +
|
"func _ready():\n" +
|
||||||
"\t# Called every time the node is added to the scene.\n" +
|
"%TS%# Called every time the node is added to the scene.\n" +
|
||||||
"\t# Initialization here\n" +
|
"%TS%# Initialization here\n" +
|
||||||
"\tpass\n";
|
"%TS%pass\n";
|
||||||
|
|
||||||
_template = _template.replace("%BASE%", p_base_class_name);
|
_template = _template.replace("%BASE%", p_base_class_name);
|
||||||
|
_template = _template.replace("%TS%", _get_indentation());
|
||||||
|
|
||||||
Ref<GDScript> script;
|
Ref<GDScript> script;
|
||||||
script.instance();
|
script.instance();
|
||||||
|
@ -2418,6 +2419,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
|
||||||
|
|
||||||
String GDScriptLanguage::_get_indentation() const {
|
String GDScriptLanguage::_get_indentation() const {
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
|
if (SceneTree::get_singleton()->is_editor_hint()) {
|
||||||
bool use_space_indentation = EDITOR_DEF("text_editor/indent/type", "Tabs") == "Tabs" ? 0 : 1;
|
bool use_space_indentation = EDITOR_DEF("text_editor/indent/type", "Tabs") == "Tabs" ? 0 : 1;
|
||||||
|
|
||||||
if (use_space_indentation) {
|
if (use_space_indentation) {
|
||||||
|
@ -2429,6 +2431,7 @@ String GDScriptLanguage::_get_indentation() const {
|
||||||
}
|
}
|
||||||
return space_indent;
|
return space_indent;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return "\t";
|
return "\t";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue