ankurdave / color-identifiers-mode

Emacs minor mode to highlight each source code identifier uniquely based on its name
308 stars 23 forks source link

js2-mode: Comments are colorized #40

Closed FrancisMurillo closed 1 year ago

FrancisMurillo commented 8 years ago

Is it correct that comments are also colorized?

Great package by the way, helps me see the variables better.

11111000000 commented 7 years ago

it's colorized after color-identifiers:refresh , but not immediately

ankurdave commented 7 years ago

I think js2-mode sometimes removes the face from comments briefly, causing color-identifiers:scan-identifiers to think the words are valid candidate identifiers.

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.

bennofs commented 5 years ago

This is caused by https://github.com/mooz/js2-mode/issues/450

Hi-Angel commented 1 year ago

@bennofs please give a test to #93. That fixes the problem for me, however as I don't code in JS myself, I can't see offhand if that doesn't cause unwanted side-effects. It should not though, and in my testing everything seem to look okay.

Hi-Angel commented 1 year ago

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 .emacs file.

Hi-Angel commented 1 year ago

So, yeah, just to be clear: to test it you can simply paste the two added lines into your .emacs file, should work just fine.

Hi-Angel commented 1 year ago

Huh, actually, the commit Don't go to (point-min) just to immediately relocate to property-change from this PR fixes that for me as well o.O Who would have thought…

Now that I think of that, the reason is probably that when buffer has no font-locks, the (next-property-change (point)) will return nil, so the complete function is basically skipped.

Hi-Angel commented 1 year ago

Huh, actually, the commit Don't go to (point-min) just to immediately relocate to property-change from this PR fixes that for me as well o.O Who would have thought…

Nvm, I dropped the change from that commit for now. I don't fully understand why (scan-identifiers) works the way it does, so am afraid it might break something. Not gonna touch it for now.