-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Convert clipboard indentation on paste to match editor settings #3525
Comments
I'd just like to say that there is much pain in copying clipboard data from the Godot site and other places into Godot due to tab/space conflict in the same block. To fix almost all these issues, why not simply change the default 'type' to be SPACES and not TABS (editor settings/indent)? Using SPACES as the option still lets you tab and shift-tab, automatically converting tabs to 4 spaces and shift-tab to go back 4 spaces. This will fix almost all website copy/paste issues (like Godot tutorials.). I cannot think of a single drawback. |
@chucklepie As stated in OP:
Sorry, but we've settled on tabs in GDScript; this isn't subject to change. |
This will not fix the issue if what you're pasting is tab-indented code instead of 4 spaces-indented code. It might be a bit less frequent, since the official docs use 4 spaces for indentation, but you would still get the same issue further down the road when you copy paste code from another source using tabs for indentation. |
And for those who missed it, there's a pending PR to fix this issue already: godotengine/godot#28561. |
Note: Old issue transferred from the main engine repo, so OP doesn't follow the proposals template. |
Godot currently lets you define your indentation preferences via the editor settings:
When you paste code from projects using different conventions (e.g. the official docs where code blocks are indented with 4-spaces to match the usual Sphinx convention), you can easily introduce indentation mismatch and syntax errors in your code.
Most IDEs have an option to convert indentation of the code in the clipboard when you paste it in the script editor. We currently have such an option to convert indentation of the whole file on save, but not of the pasted code on paste. This should be added.
The feature should respect both:
This conversion step can be done as a complex operation after the paste, so that Undo still lets you go back to the un-converted paste if need be.
Note: This issue is not to discuss what the default indentation settings should be, it's strictly about implementing this basic feature most IDEs have to convert indentation on paste to match what the user wants to have.
The text was updated successfully, but these errors were encountered: