vscode-theme-onedark icon indicating copy to clipboard operation
vscode-theme-onedark copied to clipboard

Color inconsistency when declaring variables with "const" in Javascript

Open zl-kolev opened this issue 7 years ago • 4 comments

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

  • VSCode version: 1.20.0
  • Theme version: 2.1.0

Extra information

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

zl-kolev avatar Feb 13 '18 09:02 zl-kolev

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 avatar Feb 13 '18 12:02 akamud

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 avatar Feb 13 '18 12:02 akamud

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

akamud avatar Feb 13 '18 12:02 akamud

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

akamud avatar Mar 10 '20 00:03 akamud