Skip to content

Commit 99341c2

Browse files
committed
Add python-ts-mode support
1 parent c006a5f commit 99341c2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pyimport.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ return 'from foo import y as z'."
173173
(when matching-aliases
174174
(format "import %s" (nth 0 matching-aliases))))))))
175175

176-
(defun pyimport--buffers-in-mode (mode)
177-
"Return a list of all the buffers with major mode MODE."
176+
(defun pyimport--buffers-in-mode (modes)
177+
"Return a list of all the buffers with major modes MODES."
178178
(--filter (with-current-buffer it
179-
(eq major-mode mode))
179+
(member major-mode modes))
180180
(buffer-list)))
181181

182182
(defun pyimport--syntax-highlight (str)
@@ -204,7 +204,7 @@ This is a simple heuristic: we just look for imports in all open Python buffers.
204204
(user-error "No symbol at point"))
205205
(setq symbol (substring-no-properties symbol))
206206
;; Find all the import lines in all Python buffers
207-
(dolist (buffer (pyimport--buffers-in-mode 'python-mode))
207+
(dolist (buffer (pyimport--buffers-in-mode '(python-mode python-ts-mode)))
208208
(dolist (line (pyimport--import-lines buffer))
209209
(-if-let (import (pyimport--extract-simple-import line symbol))
210210
(push import matching-lines))))

0 commit comments

Comments
 (0)