PowerShell / EditorSyntax

PowerShell syntax highlighting for editors (VS Code, Atom, SublimeText, TextMate, etc.) and GitHub!
MIT License
133 stars 45 forks source link

numeric file size modifier scope #111

Open keith-hall opened 6 years ago

keith-hall commented 6 years ago

Environment

Issue Description

Number modifiers are given a keyword.other scope, rather than something more appropriate.

Screenshots

image

Expected Behavior

the file size units modifier of the number is not a keyword, so it should receive a scope like storage.modifier.numeric.file-size instead of keyword.other, to be more consistent with other syntaxes

Code Samples

$file_size = 1024mb
msftrncs commented 5 years ago

@keith-hall, I am not sure that storage.type is a great scope. Numbers already support a storage type modifier, so that would clash.

1Dkb
1.Dkb
1.E12kb
1.1Dkb
1.1E12kb
.1E+12Dkb
1Lkb
1.5Lpb
1.E12Lkb
1.14E12Lkb
.14Ltb
1E12Lkb

(note some of these fail to scope correctly in the current grammar)

In the current grammar, the D (for [decimal]) and the L (for [long]) are not separated from the number, but they are technically the storage type modifier. In PR #156 I have assigned them storage.modifier and have assigned the byte scale as constant.langauge

In a modified VS Code Monokai Dimmed this gives: (with keyword and constant comparison)

image

I suppose a possibility is that the byte scale could be a form of operator (its providing multiplication), but in a lot of themes, keyword.other and keyword.operator are the same.

keith-hall commented 5 years ago

good point about color schemes, your solution works for me, thanks @msftrncs :)