better-cpp-syntax
better-cpp-syntax copied to clipboard
Suggestion: add textmate scope info to distinguish between integers and reals
Originally requested here: https://github.com/microsoft/vscode-cpptools/issues/6700.
I suggest adding scopes to disambiguate between integers and reals, such as (in vscode, at least):
- constant.numeric.decimal.cpp.integer
- constant.numeric.decimal.cpp.real
Allowing different highlighting for integers and reals can help to avoid type-mismatch issues.
Could you give some code examples of the difference? I don't think integers will have the decimal tag
I'm not very familiar with these issues - I'm new to VSCode - so you may need to interpret my intent.
Using the VSCode command "Developer: Inspect Editor Tokens and Scopes" I get "constant.numeric.decimal.cpp" as the first entry for both "10" and "10.5" (although the decimal point gets "constant.numeric.decimal.point.cpp".
I think the decimal tag is for disambiguating the radix - decimal vs hexidecimal etc. At least, "0x10" gets "constant.numeric.hexadecimal.cpp".
So I guess you'd need versions for every combination of base and integer-vs-floating. Being able to distinguish exponent-containing floats would also be a nice-to-have although not very important.