luochen1990 / rainbow

Rainbow Parentheses Improved, shorter code, no level limit, smooth and fast, powerful configuration.
Apache License 2.0
1.78k stars 95 forks source link

[Bug] C and C++ syntax breaking on > if () is around it #179

Closed TruncatedDinoSour closed 2 years ago

TruncatedDinoSour commented 2 years ago

Describe the bug

C and C++ syntax breaking on < if () is around it

To Reproduce

  1. Open a C or a C++ file
  2. Write anything that has the syntax of for example .. (... > ...)
  3. Profit

File: bug.c, filetype=c

#include <stdio.h>

int main(int argc, char *argv[]) {
    if (argc < 2) {
        puts("No args ew");
        return 1;
    }

    puts(argv[1]);
    return 0;
}

Expected behavior

For it to work

Screenshots

https://imgur.com/a/SeILTUC

Additional context

luochen1990 commented 2 years ago

This code rendered correctly in my environment.

image

Maybe rainbow breaks some other syntax plugin for C.

TruncatedDinoSour commented 2 years ago

This code rendered correctly in my environment.

image

Maybe rainbow breaks some other syntax plugin for C.

Odd, it's broken for me but if I disable it it works... let me try to debug

TruncatedDinoSour commented 2 years ago

No idea what else could it be... removing rainbow though fixes it:

image

<img alt="image" width="223" src="https://user-images.githubusercontent.com/71613062/162203248-fbff7f2a-8950-4716-812a-6f66c529e379.jpg" even just the rainbow plugin does this

Maybe it's my syntax file by any chance? https://pastebin.com/YdugFeYA

image image

oddly these examples are fine

image image

I'm pretty sure it's < that is causing the issues...

image

It's definally <

TruncatedDinoSour commented 2 years ago

@luochen1990 ping

luochen1990 commented 2 years ago

You can disable all other plugins and enable rainbow to check if rainbow works alone. And to find out which plugin cause this compatibility issue, you can enable them one by one (or bisect) and test the result.

TruncatedDinoSour commented 2 years ago

You can disable all other plugins and enable rainbow to check if rainbow works alone. And to find out which plugin cause this compatibility issue, you can enable them one by one (or bisect) and test the result.

I did though... check the images:

https://user-images.githubusercontent.com/71613062/162203248-fbff7f2a-8950-4716-812a-6f66c529e379.jpg

TruncatedDinoSour commented 2 years ago

@luochen1990 ping

TruncatedDinoSour commented 2 years ago

@luochen1990 ping2

luochen1990 commented 2 years ago

Have you read this: https://github.com/luochen1990/rainbow#troubleshooting

Please use the tool to check the syntax name and definitions under the cursor

TruncatedDinoSour commented 2 years ago

Have you read this: https://github.com/luochen1990/rainbow#troubleshooting

Please use the tool to check the syntax name and definitions under the cursor

f1: cParenError f2: hi<cParenError> trans<cParenError> lo<Error> f3: ['cRainbow_lv0_r3', 'cRainbow_lv1_r1', 'cRainbow_lv2_r0', 'cParenError'] f4:

--- Syntax items ---
cParenError    xxx match /[\])]/  display
                   links to cError
TruncatedDinoSour commented 2 years ago

@luochen1990 ping

luochen1990 commented 2 years ago

The information you provided is not enough to find the issue. You have to check them before and after the buggy position, and find out which syntax rule cause the bug yourself ...

TruncatedDinoSour commented 2 years ago

The information you provided is not enough to find the issue. You have to check them before and after the buggy position, and find out which syntax rule cause the bug yourself ...

I'm confused, what do I do...?

luochen1990 commented 2 years ago

@TruncatedDinosour You can probably not solve this issue if you know little about vim syntax highlighting mechanism, maybe read about :h syntax-highlighting will help.

And if your issue is about "how to make < inside parentheses highlighted", then this might help you as a configuration reference.

TruncatedDinoSour commented 2 years ago

@TruncatedDinosour You can probably not solve this issue if you know little about vim syntax highlighting mechanism, maybe read about :h syntax-highlighting will help.

And if your issue is about "how to make < inside parentheses highlighted", then this might help you as a configuration reference.

I'm confused sorry

luochen1990 commented 2 years ago

closing it since I cannot reproduce it. you can reopen it if you find someway to reproduce it on some other environment