Closed rwols closed 6 years ago
At present the behaviour is as intended. I believe the constant.numeric
scope should be applied to standalone integers and floats only, and not to numbers that appear embedded within alphanumeric strings. If the digits would be interpreted as an integer or float by a command parsing them, then that is when I think they should be highlighted uniquely. Essentially I am applying a distinction similar to a language like Python or C++ (which rigorously defines int
, float
, string
, etc), which I am aware becomes somewhat arbitrary in a shell environment but I would like to try and stick to anyway
I thought everything in fish is a string, and every variable is a list of strings? For context, I found this peculiarity in this file.
In my opinion, the highlighting in this file is perfectly correct, including for the lines where numbers are present in the strings. Would it not appear strange if the 8 in "v8-options" was a different colour? Why should it be? Treating the numbers no different from letters looks better in this file, where each completion is using similar sorts of strings and some just happen to contain numbers because they are allowed to be alphanumeric
Ultimately, since the fish parser itself doesn't distinguish between numbers and letters under any circumstances, there is no satisfactory answer as to how this syntax (which strives to emulate the fish parser) should behave when it encounters numerals. I see three possible approaches:
Obviously the option truest to fish would be the first, but I felt that we could at least try to provide some additional information over fish in places where the user might expect it (for instance, in calls to math
). Thus I prefer the third option, which shows benefits in cases like:
math var1 = 3 \% 2 \; var1
#! ^^^^ meta.string.unquoted
#! ^ constant.numeric
#! ^ constant.numeric
#! ^^^^ meta.string.unquoted
I believe that it would be unhelpful and less instructive to scope the "1" in "var1" as a numeric in cases such as this
Yes, I completely agree that (3) would be most helpful.
It seems you already fixed this, pulling from latest master solved this for me.
Ahh I see. I misunderstood your original question as asking for that scope to be applied, not as wondering why it was (in an older version). Well, I'm glad we are in agreement about the optimum behaviour :)