better-cpp-syntax
better-cpp-syntax copied to clipboard
Issue with comments between array declaration
Checklist
- [x] This problem exists even with the setting
"C_Cpp.enhancedColorization": "Disabled" - [ ] This bug exists for C
- [x] This bug exists for C++
- [ ] This bug exists for Objective-C
- [ ] This bug exists for Objective-C++
The code with a problem is:
int main() {
int a // foo
[10]; // bar
}
It looks like:

It should look like:
// bar should be green
Confirmed for C++ with 1.14.12
@jeff-hykin It is treating the [10] as the start of a lambda.
I see three resolutions:
- AFAIK lambdas cannot capture a numbers (i.e.
[10](){};makes no sense). So a lambda capture that starts with a number cannot be a lambda capture. - There could be a range from type to semicolon so that [10] is never considered a lambda (part of #71)
- Disallow lambdas at the beginning of a line in a function context.