Closed tylerlaprade closed 7 months ago
Could you send me an example code?
Exclamation mark at start of line:
if (
foo(
x
)
!= bar
):
return
Comment at start of line:
# foo
Is it python?
You must provide a full example.
In your case, it should have any irregular block comments before them cause this issues.
Is it python?
Yes.
irregular block comments
I do have a docstring beforehand. I wouldn't consider it "irregular" since it follows standard guidelines.
def generate_foo(self):
"""Does a thing.
And another thing
"""
if (
foo(
x
)
!= bar
):
return
Okay, I experimented a bit and found that both the green comments and the red exclamation line are happening when they occur anywhere between two different docstrings - which, in a file with many functions, is going to be essentially every single comment. The logic for determining "is this a comment?" must be looking for anything between two """
pairs, even though each one should only be considered active until its closing pair.
In your example, it wont cause the problem.
The only way to cause this problem should be something like below:
I'm trying to avoid this wrong match, but it will makes the judgment very complicated and seems completely meaningless.
I have a working repro of the above where the top and bottom are both valid docstrings. One happens to be on the containing function, the other is on another class. I can't paste the full thing because it's proprietary code, hence my attempts at anonymized examples.
I have a working repro of the above where the top and bottom are both valid docstrings. One happens to be on the containing function, the other is on another class. I can't paste the full thing because it's proprietary code, hence my attempts at anonymized examples.
So, give me an example pls.
Both examples are fixed for me now, thanks @edwinhuish!
Last night's release seems to have introduced multiple undesirable behavior changes. All Python comments are now neon green and bolded. Also, there seem to be some cases (not all) where a non-comment line starting with
!
is red, which I think was previously fixed.