File tree 2 files changed +44
-7
lines changed 2 files changed +44
-7
lines changed Original file line number Diff line number Diff line change @@ -2662,13 +2662,12 @@ lists up."
2662
2662
(clojure--find-ns-in-direction 'backward )
2663
2663
(let ((rgx (concat " :as +" current-alias))
2664
2664
(bound (save-excursion (forward-list 1 ) (point ))))
2665
- (when (save-excursion (search-forward-regexp rgx bound t ))
2666
- (save-excursion
2667
- (while (re-search-forward rgx bound t )
2668
- (replace-match (concat " :as " new-alias))))
2665
+ (when (search-forward-regexp rgx bound t )
2666
+ (replace-match (concat " :as " new-alias))
2669
2667
(save-excursion
2670
2668
(while (re-search-forward (concat current-alias " /" ) nil t )
2671
- (replace-match (concat new-alias " /" ))))
2669
+ (when (not (eq 'font-lock-string-face (get-text-property (point ) 'face )))
2670
+ (replace-match (concat new-alias " /" )))))
2672
2671
(save-excursion
2673
2672
(while (re-search-forward (concat " #::" current-alias " {" ) nil t )
2674
2673
(replace-match (concat " #::" new-alias " {" ))))
Original file line number Diff line number Diff line change 55
55
56
56
(+ (lib/a 1) (b 2))"
57
57
58
- (clojure--rename-ns-alias-internal " foo" " bar" )))
58
+ (clojure--rename-ns-alias-internal " foo" " bar" ))
59
59
60
- (provide 'clojure-mode-refactor-rename-ns-alias-test )
60
+ (when-refactoring-it " should skip strings"
61
+ " (ns cljr.core
62
+ (:require [my.lib :as lib]))
63
+
64
+ (def dirname \" /usr/local/lib/python3.6/site-packages\" )
65
+
66
+ (+ (lib/a 1) (b 2))"
67
+
68
+ " (ns cljr.core
69
+ (:require [my.lib :as foo]))
70
+
71
+ (def dirname \" /usr/local/lib/python3.6/site-packages\" )
72
+
73
+ (+ (foo/a 1) (b 2))"
74
+
75
+ (font-lock-fontify-buffer )
76
+ (clojure--rename-ns-alias-internal " lib" " foo" ))
77
+
78
+ (when-refactoring-it " should not skip comments"
79
+ " (ns cljr.core
80
+ (:require [my.lib :as lib]))
81
+
82
+ (def dirname \" /usr/local/lib/python3.6/site-packages\" )
83
+
84
+ ;; TODO refactor using lib/foo
85
+ (+ (lib/a 1) (b 2))"
86
+
87
+ " (ns cljr.core
88
+ (:require [my.lib :as new-lib]))
89
+
90
+ (def dirname \" /usr/local/lib/python3.6/site-packages\" )
91
+
92
+ ;; TODO refactor using new-lib/foo
93
+ (+ (new-lib/a 1) (b 2))"
94
+
95
+ (font-lock-fontify-buffer )
96
+ (clojure--rename-ns-alias-internal " lib" " new-lib" )))
97
+
98
+ (provide 'clojure-mode-refactor-rename-ns-alias-test )
61
99
62
100
; ;; clojure-mode-refactor-rename-ns-alias-test.el ends here
You can’t perform that action at this time.
0 commit comments