emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 34/46: Add imenu support for the Sencha framework


From: Dmitry Gutov
Subject: [elpa] 34/46: Add imenu support for the Sencha framework
Date: Sat, 15 Nov 2014 20:58:09 +0000

dgutov pushed a commit to branch master
in repository elpa.

commit 852ed2e7109742af04edbad342753d14767eefea
Author: Lele Gaifax <address@hidden>
Date:   Sat Nov 1 20:34:15 2014 +0100

    Add imenu support for the Sencha framework
    
    This implements issue #172.
---
 js2-imenu-extras.el |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/js2-imenu-extras.el b/js2-imenu-extras.el
index fc6b005..e3a2c97 100644
--- a/js2-imenu-extras.el
+++ b/js2-imenu-extras.el
@@ -60,7 +60,11 @@
 
     (:framework react
      :call-re "\\_<React\\.createClass\\s-*("
-     :recorder js2-imenu-record-react-class))
+     :recorder js2-imenu-record-react-class)
+
+    (:framework sencha
+     :call-re "^\\s-*Ext\\.define\\s-*("
+     :recorder js2-imenu-record-sencha-class))
   "List of JavaScript class definition or extension styles.
 
 :framework is a valid value in `js2-imenu-enabled-frameworks'.
@@ -206,6 +210,19 @@ Currently used for jQuery widgets, Dojo and Enyo 
declarations."
                                        (list name-value))
                                      (js2-node-abs-pos options)))))))
 
+(defun js2-imenu-record-sencha-class ()
+  (let* ((node (js2-node-at-point (1- (point))))
+         (args (js2-call-node-args node))
+         (name (first args))
+         (methods (second args)))
+    (when (and (js2-string-node-p name) (js2-object-node-p methods))
+      (let ((name-value (js2-string-node-value name)))
+        (js2-record-object-literal methods
+                                   (if js2-imenu-split-string-identifiers
+                                       (split-string name-value "\\." t)
+                                     (list name-value))
+                                   (js2-node-abs-pos methods))))))
+
 (defun js2-imenu-walk-ast ()
   (js2-visit-ast
    js2-mode-ast



reply via email to

[Prev in Thread] Current Thread [Next in Thread]