Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upper case fields aren't colorized in C# #2709

Open
darthdeus opened this issue Feb 18, 2024 · 3 comments
Open

Upper case fields aren't colorized in C# #2709

darthdeus opened this issue Feb 18, 2024 · 3 comments
Labels
bug? language specific this feature/issue only effect on specific languages Rider specific Features/bugs about the Rider IDE

Comments

@darthdeus
Copy link

Have you checked the issues and discussions to ensure there are no duplicates?

Yes

Your programming languages

C#

Free or paid?

On trial

Expected Behavior

All fields should be colorized no matter how they're named. Unfortunately the way it works right now doesn't work with the coding convention that public fields should be named Uppercase.

Current Behavior

Only fields named with lowercase or _underscore are colorized, but Uppercase are not, as in this example

image

It also seems to affect local variables, but since those are generally not named with Uppercase that's probably not a big issue. For fields however this is very inconvenient. I love the plugin otherwise, but many of the codebases I work on use an uppercase convention.

Code snippet for reproduce

class Test {
    readonly float foo = 5;
    readonly float _bar = 6;
    readonly float Baz = 7;

    void F() {
        int hello = 1;
        int _world = 2;
        int Uppercase = 3;

        Console.WriteLine($"{foo} {_bar} {Baz} {hello} {_world} {Uppercase}");
    }
}

Your Environment

JetBrains Rider 2023.3.3
Build #RD-233.14015.60, built on January 18, 2024
Runtime version: 17.0.9+7-b1087.11 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
.NET Core v7.0.10 x64 (Server GC)
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 32
Registry:
editor.config.csharp.support=true
ide.experimental.ui=true
Non-Bundled Plugins:
com.intellij.javafx (1.0.4)
avalonia-rider (1.3.0)
com.intellij.ml.llm (233.14015.147)
com.github.copilot (1.4.14.4554)
izhangzhihao.rainbow.brackets (2024.2.1)

@darthdeus darthdeus added the bug? label Feb 18, 2024
@izhangzhihao izhangzhihao added language specific this feature/issue only effect on specific languages Rider specific Features/bugs about the Rider IDE labels Feb 18, 2024
@izhangzhihao
Copy link
Owner

izhangzhihao commented Feb 18, 2024

Due to incomplete syntax support in the IDE, it is challenging to determine whether it's a variable or a type based solely on the syntax count. The current implementation roughly considers uniformly capitalizing the initial letter as a type and ignores highlighting. As this is rule-based and lacks further IDE syntax tree support, alternative approaches are needed for this issue. But I still don't have a good way to do this.

@darthdeus
Copy link
Author

Hmm that's quite unfortunate, do you know if there's any kind of open issue on Jetbrains' issue tracker (https://youtrack.jetbrains.com/) that they could implement this so Rainbow Brackets could distinguish variables? It may be a long shot, but they do sometimes listen to feature requests :)

@izhangzhihao
Copy link
Owner

Ah, The Rider team already opened a ticket here: https://youtrack.jetbrains.com/issue/RIDER-12931/Semantic-Highlighting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug? language specific this feature/issue only effect on specific languages Rider specific Features/bugs about the Rider IDE
Projects
None yet
Development

No branches or pull requests

2 participants