izhangzhihao / intellij-rainbow-brackets

🌈Rainbow Brackets for IntelliJ based IDEs/Android Studio/HUAWEI DevEco Studio/Fleet
https://plugins.jetbrains.com/plugin/10080-rainbow-brackets
GNU General Public License v3.0
4.45k stars 213 forks source link

[C#] Rainbow variables does not work as intended #2626

Closed jansviland closed 1 year ago

jansviland commented 1 year ago
  1. First issue is that fromTime, toTime, body, response and deserialize is more or less the same color? If there is a difference, I can not tell.
  2. Second issue is that the body request does not work as intented, it is two different colors. When it should be one.

bilde

Here is my config

bilde

Please check

This has been reported before, and fixed, but then it seems like the bug is back again?

Your programming languages

C#

JetBrains Rider 2023.1.1
Build #RD-231.8770.54, built on April 25, 2023
Licensed to ....
You have a perpetual fallback license for this version.
Subscription is active until May 24, 2024.
Runtime version: 17.0.6+10-b829.9 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
.NET 7.0.2 (Server GC)
GC: G1 Young Generation, G1 Old Generation
Memory: 1500M
Cores: 12
Registry:
    ide.lookup.shrink=true
    ide.experimental.ui=true
    vcs.empty.toolwindow.show=false
    rdclient.asyncActions=false
    ide.new.project.model.index.case.sensitivity=true
    database.show.search.tab=false

Non-Bundled Plugins:
    com.intellij.javafx (1.0.4)
    Batch Scripts Support (1.0.13)
    com.intellij.resharper.HeapAllocationsViewer (2023.1.0)
    IdeaVIM (2.2.0)
    org.intellij.plugins.hcl (231.8109.91)
    com.github.copilot (1.2.5.2507)
    avalonia-rider (1.0.3)
    com.markskelton.one-dark-theme (5.7.4)
    fr.socolin.application-insights-debug-log-viewer (1.8.0)
    krasa.CpuUsageIndicator (1.15)
    com.intellij.resharper.StructuredLogging (2023.1.0.296)
    com.samdark.intellij-visual-studio-code-dark-plus (2.6)
    me.seclerp.rider.plugins.efcore (231.1.2)
    com.intellij.resharper.azure (3.50.0.1595-2023.1)
    izhangzhihao.rainbow.brackets (2023.2.7)
open-collective-bot[bot] commented 1 year ago

Hey @jansviland :wave:,

Thank you for opening an issue/feature request. We will get back to you as soon as we can.

Please consider support us by buying a license here or donating from OpenCollective https://opencollective.com/intellij-rainbow-brackets.

And we have a special plan for paid users, if you are a paid user, your issue or feature request will have a higher priority.

If you are creating a issue, please make sure you already read the latest change log here.

jansviland commented 1 year ago

I submitted a very similar issue here: https://github.com/izhangzhihao/intellij-rainbow-brackets/issues/2612

And it was fixed, but I guess it's back again?

izhangzhihao commented 1 year ago

please provide your code sample, I will try find why this happens.

jansviland commented 1 year ago

I was able to reproduce it with this code, just a simple console app:

// See https://aka.ms/new-console-template for more information

Console.WriteLine("Hello, World!");

// arrange
const string fromTime = $"2018-01-01";
const string toTime = $"2023-01-01";

var body = new TimeSeriesFilter()
{
    Selections = new List<TimeSeriesFilterSelection>()
    {
        new()
        {
            StationIds = new[] { "456" },
            ComponentIds = new[] { "123" },
            QualityLevel = new[] { QualityLevelEnum.BestAvailable }
        }
    },
    Period = PeriodTypeEnum.Hour
};

var request = CreatePostRequest($"/portal/timeseries/{fromTime}/{toTime}/names", body);

object CreatePostRequest(string s, TimeSeriesFilter timeSeriesFilter)
{
    throw new NotImplementedException();
}

public enum QualityLevelEnum
{
    BestAvailable,
    RawData,
    ValidData
}

public enum PeriodTypeEnum
{
    Minute,
    TenMinutes,
    Hour,
    Day,
    Month,
    Year,
    Unknown
}

public class TimeSeriesFilter
{
    public List<TimeSeriesFilterSelection> Selections { get; init; } = new();
    public PeriodTypeEnum Period { get; init; }
}

public class TimeSeriesFilterSelection
{
    public string[] StationIds { get; init; }
    public string[] ComponentIds { get; init; }
    public QualityLevelEnum[] QualityLevel { get; init; }
}
jansviland commented 1 year ago

Here is how it looks

bilde

jansviland commented 1 year ago

also, if I add a couple of variables here, you can see that the colors are almost or identical.

bilde

jansviland commented 1 year ago
image

Looks better now 👍

jansviland commented 1 year ago

I was unfortunately able to reproduce the issue again:

Screenshot 2023-05-22 at 16 19 17

First has the wrong colour.

And the colours selected for first, second and remainder are very similar.

jansviland commented 1 year ago
Screenshot 2023-05-23 at 10 43 12

Another strange behaviour I have discovered recently, sometimes the parameter, in this case just the customers string url, is treated as a variable. And also gets another colour. I does not always happen. Like here it happens the first time, but not the second time, even when it's the same method.

jansviland commented 1 year ago
Screenshot 2023-05-23 at 10 50 41

Another example, here the int value 1, gets a colour. This should not happen

izhangzhihao commented 1 year ago

please post a full example code, so I could reproduce this case easily

jansviland commented 1 year ago

Sure, you can find the examples above here:

https://github.com/jansviland/testing-workshop-ndcoslo-2023/blob/bug/1.UnitTesting/5.MutationTesting/src/AwesomeCalculator/Calculator.cs

https://github.com/jansviland/testing-workshop-ndcoslo-2023/blob/bug/2.IntegrationTesting/1.ApiTesting/tests/Customers.Api.Tests.Integration/CustomerEndpointsTests.cs

izhangzhihao commented 1 year ago

It seems fixed in the latest Rider EAP(version 2023.2 EAP 6).

image image
JetBrains Rider 2023.2 EAP 6
Build #RD-232.8296.16, built on June 26, 2023
Licensed to JetBrains Rider EAP user: Zhang Zhihao
Expiration date: July 26, 2023
Runtime version: 17.0.7+7-b1000.2 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.6.3
.NET Core v7.0.7 x64 (Server GC)
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Metal Rendering is ON
Registry:
    ide.plugins.snapshot.on.unload.fail=true
    ide.experimental.ui=true
    database.show.search.tab=false
    vcs.empty.toolwindow.show=false
    ide.new.project.model.index.case.sensitivity=true

Non-Bundled Plugins:
    PsiViewer (232.2)
    PythonCore (232.8296.17)
    izhangzhihao.rainbow.brackets (2023.2.11)
izhangzhihao commented 1 year ago

Please rise a new issue if there are still some cases that don't work well.