+after tags to lazy load OmniSharp testing
Unless I need to test something right now, I won't load OmniSharp straight away. As a result, I'll just leave it as a 'on load' option: I intentionally have to turn on OmniSharp-mode myself before I get these testing features.
This commit is contained in:
@@ -211,32 +211,33 @@ My docsets are stored in .docsets for ease of use
|
|||||||
** C#
|
** C#
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
(after! csharp-mode
|
(after! csharp-mode
|
||||||
(defun oreodave/csharp/get-unit-test-in-project ()
|
(after! omnisharp
|
||||||
(interactive)
|
(after! counsel-etags
|
||||||
(let* ((tags-file (counsel-etags-locate-tags-file))
|
(defun oreodave/csharp/get-unit-test-in-project ()
|
||||||
(cands (counsel-etags-collect-cands "void.*Test" t buffer-file-name))) ; void.*Test assumes your tests are using something like XUnit and end with Test
|
(interactive)
|
||||||
(ivy-read "Choose test: "
|
(let* ((tags-file (counsel-etags-locate-tags-file))
|
||||||
cands
|
(cands (counsel-etags-collect-cands "void.*Test" t buffer-file-name))) ; void.*Test assumes your tests are using something like XUnit and end with Test
|
||||||
:action
|
(ivy-read "Choose test: "
|
||||||
(lambda (item)
|
cands
|
||||||
;; From the counsel-etags file-open-api function
|
:action
|
||||||
(when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" item)
|
(lambda (item)
|
||||||
(let* ((file (match-string-no-properties 1 item))
|
;; From the counsel-etags file-open-api function
|
||||||
(linenum (match-string-no-properties 2 item))
|
(when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" item)
|
||||||
;; always calculate path relative to TAGS
|
(let* ((file (match-string-no-properties 1 item))
|
||||||
(default-directory (counsel-etags-tags-file-directory)))
|
(linenum (match-string-no-properties 2 item))
|
||||||
|
;; always calculate path relative to TAGS
|
||||||
|
(default-directory (counsel-etags-tags-file-directory)))
|
||||||
|
|
||||||
(when counsel-etags-debug
|
(when counsel-etags-debug
|
||||||
(message "counsel-etags-open-file-api called => dir=%s, linenum=%s, file=%s" dir linenum file))
|
(message "counsel-etags-open-file-api called => dir=%s, linenum=%s, file=%s" dir linenum file))
|
||||||
|
|
||||||
(counsel-etags-push-marker-stack (point-marker))
|
(counsel-etags-push-marker-stack (point-marker))
|
||||||
(find-file file)
|
(find-file file)
|
||||||
(counsel-etags-forward-line linenum)
|
(counsel-etags-forward-line linenum)
|
||||||
(omnisharp-unit-test-at-point))
|
(omnisharp-unit-test-at-point))
|
||||||
))
|
))
|
||||||
:caller 'oreodave/csharp/get-unit-tests-in-project)))
|
:caller 'oreodave/csharp/get-unit-tests-in-project))))
|
||||||
|
(setq omnisharp-server-executable-path "~/bin/omnisharp/run"))
|
||||||
(setq omnisharp-server-executable-path "~/bin/omnisharp/run")
|
|
||||||
|
|
||||||
(add-hook 'csharp-mode-hook '(lambda()
|
(add-hook 'csharp-mode-hook '(lambda()
|
||||||
(setq c-basic-offset 4)
|
(setq c-basic-offset 4)
|
||||||
|
|||||||
Reference in New Issue
Block a user