Godot 4 is automatically creating tabs in my script template. How to fix that?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By PIZZA_ALERT

I have a script template that I use for all my scripts. It worked perfectly in prior versions, though after switching to Godot 4 it has started converting my groups of spaces into tabs. I cannot find a way to disable this “feature.” The problem is occurring around my comment format; I like to add a bunch of spaces and have comments appear at the far-right of my usable code, rather than stacking additional lines above/below my usable code. When I create/edit this template in Notepad, I’m able to verify that it is indeed just normal spaces. Why is this happening and how do I fix it?

Please see images:

How it is appearing automatically on template load
https://imgur.com/gallery/FDRgi3J

How it should look (and did in Godot 3.5), with spaces, on template load

That first image link returns a 404.

jgodfrey | 2023-06-24 19:31

thanks for pointing that out. No matter what I try, it keeps happening. I’m not sure what to do. imgur keeps removing it or something. I may need a suggestion on how to show this image another way lol.

basically, instead of a bunch of spaces between my code and the comment, I get indents, shown by greater-than symbols:
code > > > > > > > > > > > > # comment

rather than what I’d like (just spaces, not underscores):
code_ _ _ _ _ _ _ _ _ _ _ _ _ _ # comment

PIZZA_ALERT | 2023-06-24 21:10

Hmmm… I’m not sure what (in Godot) would cause this either. Is it possible to upload the original script somewhere and provide a link for inspection?

jgodfrey | 2023-06-24 21:38

Also, regarding the image. After you reuploaded, I was able to see the image. But, now it’s 404’ing again… Weird…

jgodfrey | 2023-06-24 21:40

Sure! The template file can be found here: Template1.gd - Google Drive

In my local files I have it at this path:

C:\Program Files (x86)\Steam\steamapps\common\Godot Engine\editor_data\script_templates\Object\Template1.gd

not sure how to put that with the underscores without it making things italics lol

PIZZA_ALERT | 2023-06-24 21:44

(edited the above comment to fix the italics issue. Just wrap that kind of thing in backticks…)

jgodfrey | 2023-06-24 22:12

Yeah, I see the same results you reported above. Really, it feels like a bug to me but, as I don’t use script templates, I’m really not sure. I’d guess it’s code designed to fix the indention of the template that’s processing more than was intended, but really that’s just a guess…

jgodfrey | 2023-06-24 22:24

I would agree. Thanks for your time and taking a look. I see you have a lot of privileges on this site, are you a Godot engine contributor? Do you know how to raise this issue and perhaps have an option generated to not convert spaces into tabs?

PIZZA_ALERT | 2023-06-24 22:58

Sorry, I’m “out” ATM and don’t have good Internet access, but you can look at existing issues (and report new ones) here:

Issues · godotengine/godot · GitHub

jgodfrey | 2023-06-24 23:34

Okay great! I made an issue here: Groups of spaces in scripts automatically changing into tabs/indentation · Issue #78657 · godotengine/godot · GitHub

Thanks Mr. Godfrey

PIZZA_ALERT | 2023-06-25 00:04

You’re welcome - happy to help.

jgodfrey | 2023-06-25 01:11

@jgodfrey It’s been a hot minute since I’ve worked on my projects but I’m happy to see that this has been resolved! Thanks for your help, again.

Unfortunately with the new forum site, all my posts/comments/activity unlinked from my account. Did that happen to everyone? I had to run a search just to find this topic.