Skip to content

Commit

Permalink
Use more lightweight cc-mode scanning function for js2-mode
Browse files Browse the repository at this point in the history
`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
  • Loading branch information
Hi-Angel committed Jan 19, 2023
1 parent 2410db5 commit aa6e24e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions color-identifiers-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ For cc-mode support within color-identifiers-mode."
"\\_<\\([a-zA-Z_$]\\(?:\\s_\\|\\sw\\)*\\)"
(nil font-lock-variable-name-face))))

(color-identifiers:set-declaration-scan-fn
'js2-mode 'color-identifiers:cc-mode-get-declarations)
(add-to-list
'color-identifiers:modes-alist
`(js2-mode . (,color-identifiers:re-not-inside-class-access
Expand Down

0 comments on commit aa6e24e

Please sign in to comment.