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

Previewers' new tokens should have language specific insides #1698

Open
RunDevelopment opened this issue Jan 10, 2019 · 2 comments
Open

Previewers' new tokens should have language specific insides #1698

RunDevelopment opened this issue Jan 10, 2019 · 2 comments
Labels

Comments

@RunDevelopment
Copy link
Member

I noticed that the new tokens Previewers adds to supported languages have a fixed inside (if any).

This means that the presence of the Previewers plugin can change the way code is highlighted because the Previewers' tokens can match the same (or more) as (than) the tokens of the extended language.
I.e. CSS rgb(0, 0, 0) will be matched as a color token with inside function and punctuation while CSS also matches numbers (with CSS extras) and commas.

@Golmote
Copy link
Contributor

Golmote commented Apr 22, 2019

Couldn't we add a ternary check to either merge with the existing inside or create it?

@RunDevelopment
Copy link
Member Author

@Golmote
I don't quite understand what you propose but I don't think we can. To know which inside from the original language to use we would have to know which tokens intersect with a newly added token.
So we would have to check if the intersection of the languages created by two regexes is empty.

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

No branches or pull requests

2 participants