dotnet / dotnet/vblang

New coding style option

Open
#465 4 comments 4 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

Please add a coding style option to disable leading zeros from being removed in binary literals. It affects its readability. For example, when Pretty listing is enabled, you will not be allowed to write:
```vbnet
' Intended look
Select Case foo And &B00111111
Case &B00000100 :
Case &B00010000 :
Case &B00100001 :
End Select

' Actual
Select Case foo And &B111111
Case &B100 :
Case &B10000 :
Case &B100001 :
End Select
```
The only "hack" available right now is to use an underscore character, but that is not a very pretty looking syntax.
```vbnet
Select Case foo And &B_00111111
Case &B_00000100 :
Case &B_00010000 :
Case &B_00100001 :
End Select
```

The function responsible for this formatting is called [GetIntegerLiteralValueString](http://source.roslyn.io/#Microsoft.CodeAnalysis.VisualBasic.Workspaces/CodeCleanup/Providers/ReduceTokensCodeCleanupProvider.vb).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.