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

More granular token types #2850

Open
1 of 5 tasks
RunDevelopment opened this issue Apr 6, 2021 · 2 comments
Open
1 of 5 tasks

More granular token types #2850

RunDevelopment opened this issue Apr 6, 2021 · 2 comments

Comments

@RunDevelopment
Copy link
Member

RunDevelopment commented Apr 6, 2021

Motivation
This ties into #2849. There are a few token types that are missing right now and languages usually approximate. I.e. TOML has a date token type and all tokens have a number alias for coloring.

Description
A few new token types, I would like to suggest:

  • time (or date or date-time): A type for dates, times, and other time instances.
    We have a few languages that contain literals for dates and times. Right now, most of them use the number type.
  • character (or char): A type for character literals.
    Some languages support literals for string and characters (e.g. C/C++, C#, Java, Rust, Scheme). Themes should be able to give these literals a different color.
  • ip-address (or ip-addr or ip): A type for IPv4 and IPv6 addresses.
    Some languages support IP address literals.
  • attr-assign: A token used to assign an attribute value to an attribute name.
    Some people what to highlight the assignment operator of attributes differently (example).
  • doc: An alias for different types to indicate that a string or comment is used for documentation (e.g. JavaDoc comments or Python docstrings). E.g. <span class="token comment doc">/** foo */</span>.
@joshgoebel
Copy link

joshgoebel commented Apr 6, 2021

ip-address

I would assume you tag these as number now (as we do)... so if you moved forward with adding this would an IP address become exclusively tagged as ip-address (breaking existing themes) or would it now be a number ip-address or number.ip-address?

I guess the same question applies to char and string... I assume right now all char literals get tagged as strings... is a "char" ALSO a "string" or do themes break at the transition point?

@RunDevelopment
Copy link
Member Author

IP addresses are usually aliased with url right now IIRC. Removing that alias wouldn't be too bad of an idea.

char is intended as an addition to and not a replacement of string.

breaking existing themes

That's true. I will need to think of a solution for that.

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

No branches or pull requests

2 participants