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

Variable names ending with apostrophe (') are not highlighted correctly when variable name is also a keyword #32

Closed
allansson opened this issue Jun 27, 2017 · 4 comments

Comments

@allansson
Copy link

Some code I am working in is using a function called module', but this severely messes up the syntax highlighting.

image

The reason is that all keywords in the grammar file is using \b to detect whole words. As I gather it, the \b will match any \w up until \W, where \w is a shorthand for [a-zA-Z0-9_] and \W is anything but \w. This is in conflict with Haskell's syntax, which actually allows any variable definition to end with '. I did a quick hack where I replaced the ending \b for the module-keyword with the following non-capturing group and it fixed the issue: (?:[^a-zA-Z0-9_'])

image

This problem is certainly affecting all keywords, and I was considering doing a pull request but my textmate grammar skills aren't that great so it is hard for me to know what the impact would be.

@JustusAdam
Copy link
Owner

This is a duplicate of #31

To avoid more people opening this issue as well I will publish version 2.2.2 right now which contains this fix and more.

@JustusAdam
Copy link
Owner

The new version should fix it for all keywords such as instance, module, class, let, where etc.
If you notice one that is still not correct please tell me, perhaps I forgot one.

@allansson
Copy link
Author

@JustusAdam Thank you! I did a search, but only among open issues. Sorry for the trouble. I will try the new version and comment in #31 if I find any errors. Great work on this extension!

@JustusAdam
Copy link
Owner

JustusAdam commented Jun 28, 2017

I understand. You assumed that if it was a closed issue it would have been fixed in the extension as well. I was going to publish the change soon anyways. It just was an unfortunate timing.

Thanks. I think this must be the only really actively maintained Haskell highlighting grammar 😆 .

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