EditorSyntax icon indicating copy to clipboard operation
EditorSyntax copied to clipboard

numeric file size modifier scope

Open keith-hall opened this issue 7 years ago • 2 comments
trafficstars

Environment

  • Sublime 3176
  • Monokai

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

keith-hall avatar May 31 '18 09:05 keith-hall

@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.

msftrncs avatar May 15 '19 03:05 msftrncs

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

keith-hall avatar May 17 '19 13:05 keith-hall