Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Open
zl-kolev opened this issue Feb 13, 2018 · 4 comments
Open

Comments

@zl-kolev
Copy link

zl-kolev commented Feb 13, 2018

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.

@akamud
Copy link
Owner

akamud commented Feb 13, 2018

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 akamud closed this as completed Feb 13, 2018
@akamud
Copy link
Owner

akamud commented Feb 13, 2018

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
Copy link
Owner

akamud commented Feb 13, 2018

Tracking this issue in TmLanguage (microsoft/TypeScript-TmLanguage#542).

@akamud
Copy link
Owner

akamud commented Mar 10, 2020

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

@akamud akamud reopened this Mar 10, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants