-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.0dev] GDScript - Mixed tabs and spaces not allowed in multiline declarations #49171
Comments
Workaround (tldr: only use spaces): P.S.: I just realised how to set the text editor to achieve what I was suggesting. |
@fcole90 The above report uses tabs for indentation but spaces for alignemnt. This is a common pattern to format code in programming. (You can see it with the indentation icons on the left which represent tabs, not spaces.) The GDScript style guide uses tabs, so tabs will remain the default. Personally, I only use tabs ever (including for alignment), since I consider it to be less effort. However, some people like to use spaces to "complete" their alignment so that things are perfectly aligned. |
@Calinou I know tabs take less effort, and that's why I was looking for a solution that achieves exactly that level of comfort. With my workaround, pressing TAB inserts 4 spaces, so you can just press TAB as you used to do, but 4 spaces will appear, hence keeping the same effect as proper tabs. I too use spaces to complete alignment, especially with dictionaries, lists or functions with many parameters, and this workaround really helped me into that. I have no tabs at all in my Python code but I achieve the same effect. I think, indeed, that Python forbids entirely mixing tabs and spaces in the same file (except for docstrings). I would recommend revising the GDScript style guide then, as using just spaces in such a way could really improve everything. Python3 indentation guidelines: https://docs.python.org/3/reference/lexical_analysis.html#indentation P.S. I created a proposal to change the guidelines: godotengine/godot-proposals#2800 |
But many people will want to use tabs, and have actual tab characters show up in their source files and. Removing the ability to use actual tabs would be annoying. It's not just about tabs being easier to type or something. |
Yes, my suggestion here is just a workaround, I never suggested tabs being removed from the language. At most I suggested spaces being the default 😉 |
Just downloaded new 4.0 and see this is still an issue but appears to no longer have an explicit timeline for addressing it. Is the discussion tag for deciding if this is still considered a regression? (I'm encountering it again when migrating projects) Edit: This also affects comment lines |
I don't think this needs more discussion. It is a bug since the contents of a multiline expression should not consider indentation and it's a regression because it worked in 3.x. Regarding the time to fix, there's only so much we can do in a certain time frame, some fixes will have to be postponed. I didn't even notice it was assigned to me until now TBH. |
Changing the |
@MystMagus feel free to open a PR with your change BTW. |
Hope that's correct, have not contributed before. |
Godot version:
364ea7f
OS/device including version:
Windows 10 (20H2) x64
Issue description:
This issue is similar to the issue in #30937, except it might not be considered a regression as the language has had some fundamental changes between 3.x and 4.x. Multiline declarations such as arrays and dicts do not support the same multiline syntax as in 3.x, popping up an error about mixed tabs and spaces when writing these declarations in a way to align them to a user's screen. See example in next section, and the related issue for examples which still produce the issue in the new version of GDScript.
Steps to reproduce:
The text was updated successfully, but these errors were encountered: