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

template literals in js-mode #72

Closed
11111000000 opened this issue Jul 16, 2020 · 2 comments
Closed

template literals in js-mode #72

11111000000 opened this issue Jul 16, 2020 · 2 comments

Comments

@11111000000
Copy link

11111000000 commented Jul 16, 2020

currently:
2020-07-17_617x422

i.e. we need highlight of drawerOpened and setDrawerOpened too

@Hi-Angel
Copy link
Collaborator

Hello, could you please drop the code as text. I might look at it depending on resources. My thought offhand why it's not getting highlighted is the mode might be overwriting the highlight. Another one (just from looking at the screenshot): the mode might be using font-lock-comment-face for the paragraph in question, and we ignore passages of such text.

@Hi-Angel
Copy link
Collaborator

Hi-Angel commented Feb 12, 2025

I took another look at it: "template literals" are multiline strings, which allow to refer to variables with $(var_name). To make var_name highlighted a major mode just needs to unhighlight such "non-string" range. Which the built-in treesitter tsx-ts-mode does, screenshot:

Image

I didn't test js-ts-mode because I didn't have the grammar installed, but I bet it behaves the same. So it's just a question of js-mode not doing that.

Color-identifiers-mode could add a workaround for this, but this seems wrong given the problem is on js-mode side, and I also imagine if js-mode ever fix this, the color-identifiers-mode heuristic may break (depending on how it's implemented).

So all in all, please either report this to js-mode or just use js-ts-mode where this works (or both 😊). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants