Skip to content

Add syntax highlighting for JS/TS template string interpolation (Monokai built-in theme)#17841

Merged
aeschli merged 3 commits intomicrosoft:masterfrom
soncodi:colorize-template-variable
Feb 21, 2017
Merged

Add syntax highlighting for JS/TS template string interpolation (Monokai built-in theme)#17841
aeschli merged 3 commits intomicrosoft:masterfrom
soncodi:colorize-template-variable

Conversation

@soncodi
Copy link
Contributor

@soncodi soncodi commented Dec 27, 2016

The built-in Monokai theme makes interpolated template strings difficult to read. This PR adds highlighting to improve accessibility.

before:
before

after:
after

@msftclas
Copy link

Hi @soncodi, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@dbaeumer dbaeumer added the themes Color theme issues label Dec 27, 2016
@soncodi
Copy link
Contributor Author

soncodi commented Dec 27, 2016

I've signed the CLA.

@soncodi soncodi changed the title Add syntax highlighting for JS/TS template string interpolation. Add syntax highlighting for JS/TS template string interpolation (Monokai built-in theme) Dec 27, 2016
@aeschli
Copy link
Contributor

aeschli commented Dec 30, 2016

Our typescript grammar uses scopes
punctuation.definition.template-expression.begin.ts
and
punctuation.definition.template-expression.end.ts
for the interpolation in strings.
The PR should use that.

@soncodi
Copy link
Contributor Author

soncodi commented Dec 30, 2016

@aeschli Thanks. I adjusted the selectors, also including .js

@aeschli
Copy link
Contributor

aeschli commented Dec 31, 2016

I'd suggest to just have the common prefix: punctuation.definition.template-expression.
The inner part might also get colored, but this will be fixed by #3008 in the January build

@soncodi
Copy link
Contributor Author

soncodi commented Dec 31, 2016

@aeschli Selectors updated.

@soncodi
Copy link
Contributor Author

soncodi commented Feb 2, 2017

@aeschli Any update on this PR?

@aeschli
Copy link
Contributor

aeschli commented Feb 3, 2017

I think you can remove the template.variable rule. It's not a scope that is produced by the TypeScript grammar. This used to match before because we matched colors rules against a flattened list of all scopes on the stack. Now with the work for #3008, we match only if a coloring rule is a prefix of a scope on the stack.
In the January build you can examine the scope stack with a new command Developer: Inspect TM Scopes:

@aeschli aeschli merged commit 8182537 into microsoft:master Feb 21, 2017
@aeschli aeschli added this to the February 2017 milestone Feb 21, 2017
@aeschli
Copy link
Contributor

aeschli commented Feb 21, 2017

I'll remove the template.variable rule as discussed.
@soncodi Thanks for the PR!

aeschli added a commit that referenced this pull request Feb 21, 2017
@soncodi
Copy link
Contributor Author

soncodi commented Feb 21, 2017

Thank you @aeschli

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

themes Color theme issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants