-
Notifications
You must be signed in to change notification settings - Fork 23
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
js2-mode: Comments are colorized #40
Comments
it's colorized after |
I think js2-mode sometimes removes the face from comments briefly, causing The right fix is to have two modes for scanning identifiers, one for identifier discovery and another for actually coloring. In the discovery mode, only candidates already fontified with with font-lock-variable-name-face or js2-function-param should be considered. In the coloring mode, unfontified text should also be considered. |
This is caused by mooz/js2-mode#450 |
Oh, sorry, the report was opened by @FrancisMurillo. So, anyway, please see if the PR fixes the problem, it's really just a two line change which can even be stored in |
I tried to dig why the difference compared to the default `color-identifiers:scan-identifiers`, but it already took a lot of time due to having to figure out the algorithms and cases where one or the other is called *(so e.g. `color-identifiers:scan-identifiers` is called always even if the cc-mode is set, just from other places)*. I have a guess about roots of the problem, but fixing that would require more time, so let's have this easy fix for now instead. Fixes: ankurdave#40
So, yeah, just to be clear: to test it you can simply paste the two added lines into your |
Huh, actually, the commit Now that I think of that, the reason is probably that when buffer has no font-locks, the |
Nvm, I dropped the change from that commit for now. I don't fully understand why |
`scan-identifiers` isn't the best scan-fn (see also ankurdave#94) as it moves not just through changed properties. Let's use the cc-mode one, which goes exclusively through face changes while searching for declared identifiers. Fixes: ankurdave#40
It isn't actually specific to cc-mode, and works in a way similar to the previous default `scan-identifiers`, except that because it only goes through places with properties set, it is: 1. more performant due to less motion 2. less likely to introduce wrong coloring as in ankurdave#40 or ankurdave#62 We also rename the function to remove infix `cc-mode` as it isn't (and never really have been) specific to c-mode. Fixes: ankurdave#94
It isn't actually specific to cc-mode, and works in a way similar to the previous default `scan-identifiers`, except that because it only goes through places with properties set, it is: 1. more performant due to less motion 2. less likely to introduce wrong coloring as in ankurdave#40 or ankurdave#62 We also rename the function to remove infix `cc-mode` as it isn't (and never really have been) specific to c-mode. Fixes: ankurdave#94
It isn't actually specific to cc-mode, and works in a way similar to the previous default `scan-identifiers`, except that because it only goes through places with properties set, it is: 1. more performant due to less motion 2. less likely to introduce wrong coloring as in ankurdave#40 or ankurdave#62 We also rename the function to remove infix `cc-mode` as it isn't (and never really have been) specific to c-mode. Fixes: ankurdave#94
It isn't actually specific to cc-mode, and works in a way similar to the previous default `scan-identifiers`, except that because it only goes through places with properties set, it is: 1. more performant due to less motion 2. less likely to introduce wrong coloring as in #40 or #62 We also rename the function to remove infix `cc-mode` as it isn't (and never really have been) specific to c-mode. Fixes: #94
Is it correct that comments are also colorized?
Great package by the way, helps me see the variables better.
The text was updated successfully, but these errors were encountered: