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

Some character literals are not highlighted #183

Open
emlautarom1 opened this issue Mar 8, 2021 · 5 comments
Open

Some character literals are not highlighted #183

emlautarom1 opened this issue Mar 8, 2021 · 5 comments

Comments

@emlautarom1
Copy link

Most character literals are highlighted properly, but some - like vowels with tildes - are not.

See the following example:

Screenshot from 2021-03-08 16-23-53

Using Horizon theme, but can reproduce with any theme.

Example characters are as follow (GitHub doesn't highlight characters):

x = ['a', '`', '~', '!', '@']
y = ['¹', 'á', '', '«', '»', '¿']
@JustusAdam
Copy link
Owner

If you or anyone else wants to submit a PR for this go ahead. This should be a reasonably easy fix augmenting the character regex?

@emlautarom1
Copy link
Author

Any hints on where the regexes are defined? I've never worked on syntax highlighting.

@JustusAdam
Copy link
Owner

JustusAdam commented Apr 6, 2021

You can try looking at the scopes it is being assigned to. Each rule assigns a, usually descriptively named, "scope" to the thing it matches. For instance a literal 1 will be constant.numeric.floating.decimal.haskell or -> is keyword.operator.arrow.haskell. So if you search for character or char or constant you should find the scope for character literals and it will have a rule attached that contains the regex used for matching. Be careful though, it may be that it is used in multiple places (probably not though).

Maybe one last hint, the tmLanguage file is in the plist format, which basically means its JSON, but in XML format and I'm sure you'll figure out how that works when you look at it 😉

@JustusAdam
Copy link
Owner

And if you need help with the regex syntax, this is where you can find information (also about how to specify character classes and such) https://macromates.com/manual/en/regular_expressions

@BiscuitCookies
Copy link

Wanted to add that the characters § and £ aren't highlighted as well

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

3 participants