[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 1c0155f 203/271: Don't color name nodes in their own scope
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 1c0155f 203/271: Don't color name nodes in their own scope. |
Date: |
Thu, 05 Feb 2015 18:31:13 +0000 |
branch: master
commit 1c0155f575ae8733980c3449938102bde2f72fb5
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Don't color name nodes in their own scope.
---
context-coloring.el | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index ac941db..56e3e28 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -250,15 +250,6 @@ END (exclusive) with the face corresponding to LEVEL."
(setq current-scope enclosing-scope))
(puthash scope level
context-coloring-js2-scope-level-hash-table)))))
-(defsubst context-coloring-js2-name-node-level (node)
- (cond ((js2-node-top-level-decl-p node)
- 0)
- (t
- (context-coloring-js2-scope-level
- (js2-get-defining-scope
- (js2-node-get-enclosing-scope node)
- (js2-name-node-name node))))))
-
(defsubst context-coloring-js2-local-name-node-p (node)
"Determines if NODE is a js2-name-node representing a local
variable."
@@ -298,9 +289,18 @@ generated by js2-mode."
node
(context-coloring-js2-scope-level node)))
((context-coloring-js2-local-name-node-p node)
- (context-coloring-js2-colorize-node
- node
- (context-coloring-js2-name-node-level node))))
+ (let* ((enclosing-scope (js2-node-get-enclosing-scope node))
+ (defining-scope (js2-get-defining-scope
+ enclosing-scope
+ (js2-name-node-name node))))
+ ;; The tree seems to be walked lexically, so an entire scope will
+ ;; be colored, including its name nodes, before they are
+ ;; reached. Coloring the nodes defined in that scope would be
+ ;; redundant, so don't do it.
+ (when (not (eq defining-scope enclosing-scope))
+ (context-coloring-js2-colorize-node
+ node
+ (context-coloring-js2-scope-level defining-scope))))))
;; The `t' indicates to search children.
t)))))
- [elpa] master 32aacc9 216/271: Add customization interface., (continued)
- [elpa] master 32aacc9 216/271: Add customization interface., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 0830f53 104/271: Merge branch 'develop', Jackson Ray Hamilton, 2015/02/05
- [elpa] master 1df629d 222/271: Enable rainbow-mode., Jackson Ray Hamilton, 2015/02/05
- [elpa] master dc9644e 271/271: Merge branch 'master' of git://git.sv.gnu.org/emacs/elpa, Jackson Ray Hamilton, 2015/02/05
- [elpa] master 97150a1 256/271: Update .elpaignore., Jackson Ray Hamilton, 2015/02/05
- [elpa] master ae2adc4 259/271: Merge themes into main file., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 5908ce8 232/271: Fix readme., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 27db37a 202/271: Use a hash table as a scope level fast track., Jackson Ray Hamilton, 2015/02/05
- [elpa] master f3ab262 246/271: Merge branch 'develop', Jackson Ray Hamilton, 2015/02/05
- [elpa] master 73c82f9 234/271: Merge branch 'feature/set-colors' into develop, Jackson Ray Hamilton, 2015/02/05
- [elpa] master 1c0155f 203/271: Don't color name nodes in their own scope.,
Jackson Ray Hamilton <=
- [elpa] master b325b91 250/271: Add current directory to load path for compilation., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 6755fdb 194/271: Pass test for key names., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 941070c 257/271: Add `make deps`., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 6ce2b63 184/271: Bump required js2-mode version., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d1cb93b 241/271: Merge branch 'feature/dispatch' into develop, Jackson Ray Hamilton, 2015/02/05
- [elpa] master e05f044 191/271: Update js2-mode., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 04f6f73 185/271: Documentation., Jackson Ray Hamilton, 2015/02/05
- [elpa] master ed2c33d 121/271: Merge branch 'feature/color-schemer' into develop, Jackson Ray Hamilton, 2015/02/05
- [elpa] master 196a6ed 209/271: Whoops., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 887f4c7 215/271: Merge branch 'master' into develop, Jackson Ray Hamilton, 2015/02/05