block comments not adapt with python.
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.84.0
- OS Version: windows11 23H2
Steps to Reproduce:
- write down some python code.
- use block comments(alt+shfit+A) on some
fororwithblock code or any indented code. and the'''will on the top of line witch is not correct.
example figure.
Hey @zzdywc , Could you please provide a more detailed example that covers the range of codes you want to comment out, your expected behavior, etc That will help me reproduce this issue, thanks!
code sample as shown:
x = []
for i in range(100):
print(i)
print(i/10)
x.append(i)
if(i == 10):
print("yes")
print("end")
normal comments like:
x = []
for i in range(100):
print(i)
'''
print(i/10)
x.append(i)
'''
if(i == 10):
print("yes")
print("end")
select code:
print(i/10)
x.append(i)
press shift+alt+A, and will add comment symbol like this:
x = []
for i in range(100):
print(i)
"""
print(i/10)
x.append(i)
"""
if(i == 10):
print("yes")
print("end")
This code make if work improperly.
It seems like comment will added one space before the starting position and The last space of the end position of which have been selected. though this logic work fine with orther language like c etc. but not work on language that relies on indentation.
I don't know what logic is the best, but in my opinion, add new line at the bothstart position and end postion of which have been selected, and than add comment symbol ''' at the new line with properly indentation will fix this problem.
Thanks for the issue, I can repro it