Skip to content

Commit ce3ee1e

Browse files
committed
Add keybindings to tests commands
1 parent e35def6 commit ce3ee1e

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

lsp-dart-code-lens.el

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,24 @@ NAMES arg is optional and are the group of tests representing a test name."
218218
nil nil nil
219219
(cond
220220
(lsp-dart-test-code-lens-mode
221+
(lsp-dart-define-key "t t" #'lsp-dart-run-test-at-point)
222+
(lsp-dart-define-key "t T" #'lsp-dart-run-test-at-point)
223+
(lsp-dart-define-key "t f" #'lsp-dart-run-test-file)
224+
(lsp-dart-define-key "t l" #'lsp-dart-run-last-test)
225+
(lsp-dart-define-key "t L" #'lsp-dart-debug-last-test)
226+
(lsp-dart-define-key "t a" #'lsp-dart-run-all-tests)
227+
(lsp-dart-define-key "t v" #'lsp-dart-visit-last-test)
221228
(add-hook 'lsp-dart-outline-arrived-hook #'lsp-dart--test-code-lens-check nil t))
222229
(t
223-
(progn
224-
(remove-overlays (point-min) (point-max) 'lsp-dart-test-code-lens t)
225-
(remove-hook 'lsp-dart-outline-arrived-hook #'lsp-dart--test-code-lens-check t)))))
230+
(lsp-dart-define-key "t t" 'ignore)
231+
(lsp-dart-define-key "t T" 'ignore)
232+
(lsp-dart-define-key "t f" 'ignore)
233+
(lsp-dart-define-key "t l" 'ignore)
234+
(lsp-dart-define-key "t L" 'ignore)
235+
(lsp-dart-define-key "t a" 'ignore)
236+
(lsp-dart-define-key "t v" 'ignore)
237+
(remove-overlays (point-min) (point-max) 'lsp-dart-test-code-lens t)
238+
(remove-hook 'lsp-dart-outline-arrived-hook #'lsp-dart--test-code-lens-check t))))
226239

227240
(provide 'lsp-dart-code-lens)
228241
;;; lsp-dart-code-lens.el ends here

lsp-dart-utils.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ FLUTTER_ROOT environment variable."
145145
,@body)
146146
(error "Project not found (pubspec.yaml not found)"))))
147147

148+
149+
;; keymap
150+
151+
(defun lsp-dart-define-key (key action)
152+
"Define KEY with ACTION."
153+
(define-key lsp-mode-map (kbd (concat "D " key)) action))
154+
148155

149156
;; Log
150157

0 commit comments

Comments
 (0)