better-comments icon indicating copy to clipboard operation
better-comments copied to clipboard

Extension highlights a line that is not a comment when unpacking a list in python

Open diego-pm opened this issue 2 years ago • 2 comments
trafficstars

In python, when calling a function, with all the arguments in a new line, starting with the unpacking of a list, the extension highlights all the line due to using an *, even do it is not a comment.

Example code:

res = foo(
    *[1, 2, 3]
)

diego-pm avatar Nov 28 '22 13:11 diego-pm

I could not reproduce this using your example code unless the file didn't have an extension. The better-comments extension determines the comment character based on the file extension, so you can rename your file with .py Alternatively try adding this in your settings.json(or removing it if already declared):

"better-comments.highlightPlainText": true,

This will turn off comments in plain text files and will likely fix your problem

aarondill avatar Dec 06 '22 05:12 aarondill

The file did have an extension .py. I've tested this again today and it works fine. Maybe it's been solved with an update?

diego-pm avatar Dec 12 '22 08:12 diego-pm