diff options
author | oreodave <aryadevchavali1@gmail.com> | 2019-08-27 17:26:14 +0100 |
---|---|---|
committer | oreodave <aryadevchavali1@gmail.com> | 2019-08-27 17:26:14 +0100 |
commit | f0c6ede1418dd0c55b816eab8c4352b761b90fb8 (patch) | |
tree | b24ef2dede3c139579df89c3264708397635d7db | |
parent | fc86026dcd00cf035bf5344f6175eb43917771cb (diff) | |
download | dotfiles-f0c6ede1418dd0c55b816eab8c4352b761b90fb8.tar.gz dotfiles-f0c6ede1418dd0c55b816eab8c4352b761b90fb8.tar.bz2 dotfiles-f0c6ede1418dd0c55b816eab8c4352b761b90fb8.zip |
~csharp/get-unit-test-in-project to use omnisharp
Now uses omnisharp-unit-test-at-point to test the unit test. Instead
goes to the file in tag and runs test at that point. Allows you to
traverse test as well!
-rw-r--r-- | doom.d/config.org | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/doom.d/config.org b/doom.d/config.org index b9fe3ca..8fd49a8 100644 --- a/doom.d/config.org +++ b/doom.d/config.org @@ -224,27 +224,32 @@ My docsets are stored in .docsets for ease of use 'font-lock-face '(:foreground "green" :weight bold))) ) nil) + + (defun oreodave/csharp/get-unit-test-in-project () (interactive) - (omnisharp--cs-inspect-buffer - (lambda (elements) - (let* ((test-methods (omnisharp--cs-filter-resursively - 'omnisharp--cs-unit-test-method-p - elements))) ;; Get set of elements through omnisharp + (let* ((tags-file (counsel-etags-locate-tags-file)) + (cands (counsel-etags-collect-cands "void.*Test" t buffer-file-name))) + (ivy-read "Choose test: " + cands + :action + (lambda (item) + ;; From the counsel-etags file-open-api function + (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" item) + (let* ((file (match-string-no-properties 1 item)) + (linenum (match-string-no-properties 2 item)) + ;; always calculate path relative to TAGS + (default-directory (counsel-etags-tags-file-directory))) + + (when counsel-etags-debug + (message "counsel-etags-open-file-api called => dir=%s, linenum=%s, file=%s" dir linenum file)) + + (counsel-etags-push-marker-stack (point-marker)) + (find-file file) + (counsel-etags-forward-line linenum) + (omnisharp-unit-test-at-point) + ))) + :caller 'oreodave/csharp/get-unit-tests-in-project))) - (ivy-read "Choose test: " ;; Start ivy to get nice menu - (mapcar (lambda (els) (cdr (nth 1 els))) test-methods) ;; Get names of any unit test methods - :require-match t - :keymap counsel-describe-map - :sort t - :unwind (lambda () - (counsel-delete-process) - (swiper--cleanup)) - :action (lambda (x) - (set-process-sentinel - (start-process-shell-command "csharp-unit-testing" "*csharp-test-output*" (format "dotnet test --logger \"console;verbosity=detailed\" --filter FullyQualifiedName~%S" x)) - (lambda (process _event) - (when (memq (process-status process) '(exit stop)) - (message "Unit test finished :\)")))))))))) (setq omnisharp-server-executable-path "~/bin/omnisharp/run") (add-hook 'csharp-mode-hook '(lambda() (setq c-basic-offset 4))) ; Hook for csharp setting variables |