porcupine
porcupine copied to clipboard
Indentation for commenting plugin deviates from standard
In most editors, for example VS Code, the comment prefix is placed on the indentation level of the outermost line in the selected text block, and a tab is added between the comment prefix and the code.
Example:
def foo():
if True:
# if True:
# if True:
# print("foo")
# print("bar")
# print("baz")
Currently in Porcupine, the comment syntax is always placed in column 0.
Example:
def foo():
if True:
# if True:
# if True:
# print("foo")
# print("bar")
# print("baz")
I've heard arguments both for and against this behavior.
For:
- "The current behavior isn't great for blacking, but it has the advantage of being super simple."
Originally posted by @Akuli in https://github.com/Akuli/porcupine/issues/1360#issuecomment-1634867507
Against:
- Black changes the format of the column 0 comments:
$ cat t.py
def foo():
# bar = 8
# bar += 2
# assert bar == 10
...
$ black t.py
reformatted t.py
All done! ✨ 🍰 ✨
1 file reformatted.
$ cat t.py
def foo():
# bar = 8
# bar += 2
# assert bar == 10
...
Originally posted by @rdbende in https://github.com/Akuli/porcupine/pull/1360#discussion_r1262873323
Personally, I would prefer if Porcupine followed the standard behavior, similar to VS Code. Would love to hear input from you guys!