File tree 2 files changed +43
-0
lines changed
2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ (require 'indium )
2
+
3
+ (defun lispy--eval-js (str )
4
+ (let ((r nil ))
5
+ (indium-eval
6
+ str (lambda (value ) (setq r (indium-render-remote-object-to-string value))))
7
+ (while (not r)
8
+ (accept-process-output ))
9
+ (substring-no-properties r)))
10
+
11
+ (defun lispy--eval-js-str ()
12
+ (if (region-active-p )
13
+ (lispy--string-dwim)
14
+ (lispy--string-dwim
15
+ (lispy-bounds-python-block))))
16
+
17
+ (defun lispy--js-completion-at-point ()
18
+ (let* ((prefix (buffer-substring-no-properties
19
+ (let ((bol (point-at-bol ))
20
+ (prev-delimiter (1+ (save-excursion
21
+ (re-search-backward " [([:space:]]" nil t )))))
22
+ (if prev-delimiter
23
+ (max bol prev-delimiter)
24
+ bol))
25
+ (point )))
26
+ (expression (if (string-match-p " \\ ." prefix)
27
+ (replace-regexp-in-string " \\ .[^\\ .]*$" " " prefix)
28
+ " this" ))
29
+ (cands nil ))
30
+ (indium-client-get-completion
31
+ expression
32
+ indium-debugger-current-frame
33
+ (lambda (candidates )
34
+ (setq cands candidates)))
35
+ (while (null cands)
36
+ (accept-process-output ))
37
+ (list (- (point ) (length (company-grab-symbol)))
38
+ (point )
39
+ (mapcar #'identity cands))))
40
+
41
+ (provide 'le-js )
Original file line number Diff line number Diff line change @@ -4198,6 +4198,8 @@ SYMBOL is a string."
4198
4198
le-clojure lispy-eval-clojure)
4199
4199
(python-mode
4200
4200
le-python lispy--eval-python lispy-eval-python-str lispy-eval-python-bnd)
4201
+ (js2-mode
4202
+ le-js lispy--eval-js lispy--eval-js-str)
4201
4203
(julia-mode
4202
4204
le-julia lispy-eval-julia lispy-eval-julia-str)
4203
4205
(racket-mode
You can’t perform that action at this time.
0 commit comments