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

Improve new constant color #97373

Closed
pedroassis opened this issue May 9, 2020 · 13 comments
Closed

Improve new constant color #97373

pedroassis opened this issue May 9, 2020 · 13 comments
Assignees
Labels
feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@pedroassis
Copy link

pedroassis commented May 9, 2020

  • VSCode Version: 1.45.0 (d69a79b)
  • OS Version: MacOS Catalina 10.15.3

Variable highlighting is all over the place, there seems to be a new type of highlighting for a local variable, but its confusing/annoying.

The shade for it is too close to the unused variable color.

Steps to Reproduce:

  1. Create a new File
  2. Set the language to JS
  3. Paste the snipped
function name(test) {
    const unused = 'unused';
    const { ola } = test;
    const test2 = ola.another;
    return { ola, test2 };
}

image

Does this issue occur when all extensions are disabled?: Yes/No
Yes

EDIT:
And if you access a prop from a shaded variable, the prop is not shaded, as shown in the ola.another.

If you use the variable inside an object it also doesn't get shaded. It looks like a diff variable.

@zerebos
Copy link

zerebos commented May 10, 2020

This seems to be part of the new update https://code.visualstudio.com/updates/v1_45#_new-color-for-constants-in-the-default-dark-theme

However I wish they also provided a way to revert the change in that changelog because it makes it impossible to distinguish for me as well.

@yoohahn
Copy link

yoohahn commented May 11, 2020

Same for TypeScript. Really poor choice of color here from the team.
Would love to disable this change or at least be able to override the color.

@kasvtv
Copy link

kasvtv commented May 11, 2020

Would love to be able to disable this. As it looks now it seems all const variables are unused!

@pedroassis
Copy link
Author

And if you access a prop from a shaded variable, the prop is not shaded, as shown in the ola.another.

If you use the variable inside an object it also doesn't get shaded.

@rauenzi did you find how to disable? I couldn't figure it out.

@kasvtv
Copy link

kasvtv commented May 11, 2020

Got a fix that overrides the consts (and enums, these have the same shade) to their old value in default dark +. Add the following to the settings.json:

  "editor.tokenColorCustomizations": {
    "[Default Dark+]": {
      "textMateRules": [
        {
          "scope": ["variable.other.constant", "variable.other.enummember"],
          "settings": { "foreground": "#9CDCFE" }
        }
      ]
    },
    "[Default Light+]": {
      "textMateRules": [
        {
          "scope": ["variable.other.constant", "variable.other.enummember"],
          "settings": { "foreground": "#001080" }
        }
      ]
    }
  },

Edited based on @aeschli s suggestion, thanks

@tonivj5
Copy link

tonivj5 commented May 11, 2020

Got a fix that overrides the consts (and enums, these have the same shade) to their old value in default dark +. Add the following to the settings.json:

  "editor.tokenColorCustomizations": {
    "textMateRules": [
      {
        "scope": ["variable.other.constant", "variable.other.enummember"],
        "settings": {
          "foreground": "#9CDCFE"
        }
      }
    ]  
  },

It works perfect 👏! The new color looks too dark (it seems unused 😞)

Related: #95346

@aeschli
Copy link
Contributor

aeschli commented May 12, 2020

Please use the following setting if you prefer the previous coloring:

    "editor.tokenColorCustomizations": {
        "[Default Dark+]": {
            "textMateRules": [
                {
                    "scope": ["variable.other.constant", "variable.other.enummember"],
                    "settings": {
                        "foreground": "#9CDCFE"
                    }
                }
            ]
        },
        "[Default Light+]": {
            "textMateRules": [
                {
                    "scope": ["variable.other.constant", "variable.other.enummember"],
                    "settings": {
                        "foreground": "#001080"
                    }
                }
            ]
        }
    }

@aeschli aeschli changed the title Inconsistent Variable Highlighting Improve new constant color May 12, 2020
@aeschli aeschli added this to the Backlog milestone May 12, 2020
@fr3gu
Copy link

fr3gu commented May 18, 2020

This needs to be a setting. As a person with impaired color vision it totally defeats the purpose of dimming unused variables. Side by side I can distinguish them with some efforts, but at a glance I cannot discern if there is a difference.

@miguelsolorio
Copy link
Contributor

Here's a couple of variations that we've been exploring for the Dark theme. The intent is try to stay close to the "blue" color range so as to not be too different. You can test these out by using the instructions above.

Option 1 #8F9DFF

Option 2 #4FC1FF

Option 3 #82DFE8

Option 4 #3CD9E8

Once we've identified a version that works better we'll move to exploring one for the Light theme:

@fr3gu
Copy link

fr3gu commented May 28, 2020

That's great. Personally, I will test option 2 for a while. Thanks!

@aeschli
Copy link
Contributor

aeschli commented May 28, 2020

I also like 2 the most.

@vnestere
Copy link

I think this feature should be optional. I personally don't want to have separate color for constants. It only makes reading code harder, and does not worth it.

@aeschli aeschli modified the milestones: Backlog, May 2020 May 31, 2020
@aeschli aeschli added verification-needed Verification of issue is requested feature-request Request for new features or functionality labels Jun 2, 2020
@aeschli aeschli closed this as completed Jun 4, 2020
@9at8 9at8 added the verified Verification succeeded label Jun 4, 2020
@sashahavia
Copy link

I also do not understand the benefit/need to separate color for constants. It makes no sense and the options above are not great. Why do we need a rainbow of colors? Whoever is doing that obviously doesn't work with VSCode on daily basis. Your last update for constants messed with a lot of people.
Imagine you come in to the office and your office is upside down. This is how I felt when I opened my laptop in the morning to work but instead spend hours debugging VSCode and searching for solution online. Finally asking you for the override to the original colors.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests