From e81873f9a2d2762183ef1e944e9398834ffae205 Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Thu, 19 Jan 2023 05:11:14 +0300 Subject: [PATCH] Use more lightweight cc-mode scanning function for js2-mode `scan-identifiers` isn't the best scan-fn (see also #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: https://github.com/ankurdave/color-identifiers-mode/issues/40 --- color-identifiers-mode.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/color-identifiers-mode.el b/color-identifiers-mode.el index eb160aa..1f821a8 100644 --- a/color-identifiers-mode.el +++ b/color-identifiers-mode.el @@ -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