-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Indentation errors loading space indented project into tab indented editor #35007
Comments
One way of fixing this may be to keep track of the indentation per line, instead of doing a fixed 4 spaces = tab conversion. Thus
becomes (regardless of the number of spaces)
However this may require a more intelligent converter. This would also be more robust because at present the results depend on your 'number of spaces per tab' setting. |
This solution is good, it would also correct indentatinon to a more consistent result. As an example:
converter does this:
output:
It could not be an issue if "we don't care, learn to do this not", it is going to be an issue when many people work at the same project: |
Seems still valid in 3.2.4 beta2 |
Just ran into this bug while testing out variety addons from asset library. As I have a habit of inspecting a few scripts from newly installed addons, indentations on some addon got screwed up when I tried to run. Another, easier way to solve this would be aborting convertion if strange-sized indentation was found. It's not ideal, but at least it won't corrupt scripts like it currently does. |
Godot version:
Godot 3.2 beta 5
OS/device including version:
Linux Mint 18.2
Issue description:
When testing a project from an unrelated issue (#34963) I encountered a parse error when loading the project:
Parser Error: Mixed tabs and spaces in indentation
The author had used the Godot IDE in space indentation mode, and my IDE was set to tabs (with 4 spaces to a tab).
When running the project, my editor auto-converted each group of 4 spaces to tabs, however, this caused problems because the authored file contained 'odd' numbers of spaces.
This means that projects authored as space indented cannot be currently guaranteed to work in tab indented editor. It is also painful to manually fix this problem.
Steps to reproduce:
By trial and error I figured out the problem occurs in the following situation:
This parses and runs fine when using spaces. However when auto converting to tabs, the first line is used as is with spaces, however the second line is converted to a tab, which then triggers the
mixed tabs and spaces in indentation
error.Minimal reproduction project:
TabsSpaces.zip
If you load the minimal project when your editor is set to spaces, it will work. If you load it when the IDE is set to tabs, it will error with the parse error.
The text was updated successfully, but these errors were encountered: