Skip to content
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

Multiline declarations with mixed tabs and spaces can't be commented out easily #80360

Closed
Tracked by #40488
L4Vo5 opened this issue Aug 7, 2023 · 3 comments
Closed
Tracked by #40488

Comments

@L4Vo5
Copy link
Contributor

L4Vo5 commented Aug 7, 2023

Godot version

v4.2.dev2.official [da81ca6]

System information

N/A

Issue description

After #44557, commenting a multiline declaration (like an array, dictionary, string, maybe others) with mixed tabs and spaces with the "Toggle Comment" shortcut causes the error Mixed use of tabs and spaces for indentation

Steps to reproduce

Have a multiline declaration with mixed tabs and spaces, highlight it, and press Ctrl+K (the toggle comment shortcut)

var test := [
	 2
]
#var test := [
	 #2
#]

image

var test = """
	 a
"""
#var test = """
	 #a
#"""

image

Minimal reproduction project

N/A

@dalexeev
Copy link
Member

dalexeev commented Aug 7, 2023

Thanks for the report nonetheless!

@dalexeev dalexeev closed this as not planned Won't fix, can't repro, duplicate, stale Aug 7, 2023
@L4Vo5
Copy link
Contributor Author

L4Vo5 commented Aug 7, 2023

Hmm, while the error itself is the same, that issue would only be "fixed" by allowing the mixed indentation before comments. My issue could be alternatively fixed by changing the Ctrl+K behaviour again.
For example, the shortcut could put the # after the tabs but before the space:

#var test := [
	# 2
#]

(that causes no errors)
Of course, technically the old behaviour of Ctrl+K could be reverted to fix this issue as well, but I think the above compromise would work better.

#var test := [
#	 2
#]

My issue is relevant when trying to comment out huge swathes of code automatically - I don't actually care if the # is before or after or in the middle of the tabs and spaces, I just want it to not cause errors by default.

@dalexeev
Copy link
Member

dalexeev commented Aug 7, 2023

@L4Vo5 I think #44557 is correct, we should fix #52834 instead. I'll take a look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants