eirikpre / VSCode-SystemVerilog

SystemVerilog support in VS Code
MIT License
126 stars 50 forks source link

Brackets in language configuration #169

Open hankhsu1996 opened 2 years ago

hankhsu1996 commented 2 years ago

When I wrote assert property like this:

assert property (!(Read && Write));

The property is recognized as the start of a parenthesis pair, which is defined in language-configuration.json. Therefore, it is highlighted with red color to indicate a non-closed parenthesis pair.

The thing is some of the start bracket may exist alone, which is not usually the case in (), [], {} but in keyword pairs. I'm thinking maybe it's better not add keyword pairs to the bracket list. The bracket is used for bracket highlighting, go to bracket and select to bracket.

For bracket highlighting, because the keyword pairs do not have a contiguous property, it's not a big problem. In contrast, there might be complex structures of ()[]{} such as {(A+(B+C))'(d*(e[x[y]]+f))} so you need the bracket highlighting.

For go to bracket and select to bracket, because the keyword pair usually lies in different lines of the code, and in the fact that people usually use indentation to tell the scope, it is also not a big problem.

So I'm suggesting that we can remove keyword pairs in bracket in language-configuration.json.

Zekfoo commented 2 years ago

Seconded. assert property ();, with no closing endproperty, is a common SVA syntax. In the case of assert property (); statements with "editor.bracketPairColorization.enabled": true, the property's detection as an opening bracket also affects the coloring of all following bracket pairs in the file.

Please adjust this behavior so that property only receives bracket highlighting if a matching endproperty is present.