Open djoffe opened 1 year ago
That's definitely a bug!
I think the only solution is to remove the property
endproperty
pair from the bracket definition here.
I'm not an active SystemVerilog user, so I don't know if doing that is ok.
What do you think? @djoffe @Raamakrishnan
Ya, I feel the same. As @djoffe said, property
can have a closing endproperty
or not, depending on the way it is used. And I don't see a way to make the brackets optional in vscode language definitions.
We have 2 options.
property...endproperty
pair from the bracket definition.
property
<-> endproperty
.I've checked some code on chipsalliance.
Most of the property...endproperty
has less than 10 lines of body.
In my opinion, option 1 is better.
Option 3:
Add a colorizedBracketPairs
tag in systemverilog.configuration.json. Add all the brackets, begin..end
and others, except property...endproperty
.
Bracket colorization will work for all brackets except for property...endproperty
. But you can still jump between property
<-> endproperty
I can't find any docs about this tag in language definition file, but there is a editor.language.colorizedBracketPairs
info here
I tried this tag in language definition file and it works. Do you want me to send a PR?
@Raamakrishnan Sounds good to me. Can you make the PR?
There's no way to specify with a regex or similar that sometimes "brackets" are used for things other than pairs? For example, in Python, consider this example:
a = 1
print(f"These curly braces are start/end brackets: {a}")
print("But this random curly brace { does not mess with the upcoming curly braces.")
print(f"Here's a again, with more curly braces that highlight properly: {a}")
This is still an issue; almost opened a duplicate issue. Here's yet another example:
Describe the bug A fairly recent feature of vscode is bracket pair colorization. It looks like the
property
token counts as an opening bracket that, if used inside anassert
orcover
statement. However, in these cases, there is noendproperty
token to balance the opening token.This leads to disgracefully bracket colorization that looks like a christmas tree 🎄:
Environment (please complete the following information):
Steps to reproduce Steps to reproduce the behavior:
assert property
and some parenthesized expressions, like above screenshot. For example:Expected behavior The brackets on the two similar consecutive lines should have the same color:
Actual behavior The brackets on the two similar consecutive lines have different color: