jeff-hykin / better-cpp-syntax

💾 The source of VS Code's C++ syntax highlighting
GNU General Public License v3.0
155 stars 30 forks source link

field index followed by arrow operator #634

Open laurentlb opened 1 year ago

laurentlb commented 1 year ago

Tested on vscode.dev

The code with a problem is:

int main() {
    a_long_variable_name
        [field_index] +=
        some_object->field;

    random_cpp_code(with_bad_highlighting);
}

It looks like:

image Notice that the last line has incorrect highlighting.

It should look like:

Removing a line return fixes the highlighting: image

jeff-hykin commented 1 year ago

once the brackets are on a newline, the syntax is recognizing them as the beginning of a lambda. Sadly because textmate can only look at one line at a time, this is going to be really tough to fully fix.