akamud / vscode-theme-onedark

VSCode Theme based on Atom's One Dark theme
MIT License
285 stars 196 forks source link

Color inconsistency when declaring variables with "const" in Javascript #84

Open zl-kolev opened 6 years ago

zl-kolev commented 6 years ago

This issue regards Javascript. As you can see from the screenshot posted below, it appears that in the original Atom theme when you are declaring a variable using "const", the variable name turns orange, instead of white, as it does when using "var" or "let". VS Code treats all variable declarations with the white color. Can you please make the variable names declared with "const" orange for Javascript in VS Code?

(Please ignore my stupid midnight naming conventions...)

Sample code

function createGetSetDOMElements() {
    const aboutIntro = this.document.getElementById("shortAboutIntro");
    if (aboutIntro) {
        aboutIntro.setAttribute("style", "color: red");
    }
}

Filename and Language selected

I am creating a standard Javascript file with the .js file extension.

VSCode and Atom Original theme Screenshot

VSCode theme Screenshot (left) and Atom Original theme Screenshot (right), focus your attention on the red rectangles I have drawn for your convenience:

atom-vscode-one-dark-theme-const-color-inconsistency-javascript

Versions used

Extra information

I have no other relevant plugins or extensions that are in conflict with the theme.

akamud commented 6 years ago

This has come up before (#76, #57), but VSCode unfortunately doesn't provide any scope that I can use to differentiate it from regular variables declaration.

akamud commented 6 years ago

To be more clear, these three lines:

var aboutIntro = this.document.getElementById("shortAboutIntro");
let aboutIntro = this.document.getElementById("shortAboutIntro");
const aboutIntro = this.document.getElementById("shortAboutIntro");

have the same scopes:

variable.other.readwrite.js
meta.definition.variable.js
meta.var-single-variable.expr.js
meta.var.expr.js
meta.block.js
meta.function.js
source.js

as you can see, there is no "const" scope.

akamud commented 6 years ago

Tracking this issue in TmLanguage (https://github.com/Microsoft/TypeScript-TmLanguage/issues/542).

akamud commented 4 years ago

It looks like this can finally be fixed, I'm reopening the issue so I can fix it on the next release.