From ebeb79cb5e49f3e371371482fadbe6af1661f9da Mon Sep 17 00:00:00 2001 From: oreodave Date: Sun, 24 Nov 2019 16:41:41 +0000 Subject: ~removed lsp and better docs for oreodave/csharp/get-unit-test --- doom.d/config.org | 74 +++++++++++++++++++++++++++--------------------------- doom.d/init.el | 2 +- doom.d/packages.el | 1 - 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/doom.d/config.org b/doom.d/config.org index 19574b3..a05c38b 100644 --- a/doom.d/config.org +++ b/doom.d/config.org @@ -208,57 +208,57 @@ My docsets are stored in .docsets for ease of use - Books - Weather * Language Config -** C# +** CSharp #+BEGIN_SRC elisp (after! csharp-mode - (after! omnisharp - (after! counsel-etags - (defun oreodave/csharp/get-unit-test-in-project () - (interactive) - (let* ((tags-file (counsel-etags-locate-tags-file)) - (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 - (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)) + (setq omnisharp-server-executable-path "~/bin/omnisharp/run") + (defun oreodave/csharp/get-unit-test-in-project () + (interactive) + (let* ((tags-file (counsel-etags-locate-tags-file)) + (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 + (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))) - (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)))) - (setq omnisharp-server-executable-path "~/bin/omnisharp/run")) + (when counsel-etags-debug + (message "counsel-etags-open-file-api called => dir=%s, linenum=%s, file=%s" dir linenum file)) - (add-hook 'csharp-mode-hook '(lambda() - (setq c-basic-offset 4) - (c-set-style "java"))) ; Hook for csharp setting variables - (after! lsp - (setq lsp-clients-csharp-language-server-path (expand-file-name "~/bin/omnisharp-lsp/artifacts/publish/OmniSharp.Stdio.Driver/mono/OmniSharp.exe"))) + (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))) + (add-hook! 'csharp-mode-hook '(lambda() + (omnisharp-mode) + (setq c-basic-offset 4) + (c-set-style "java"))) ; Hook for csharp setting variables (map! ; CSharp Keybinds :map csharp-mode-map :localleader :desc "Format buffer" "=" 'omnisharp-code-format-entire-file (:prefix "t" - :desc "Select Test in Project" "t" 'oreodave/csharp/get-unit-test-in-project)) - ) + :desc "Select Test in Project" "t" 'oreodave/csharp/get-unit-test-in-project))) #+END_SRC -- I have custom installed the omnisharp roslyn executable, so I'd rather use that -- C# code is better at 4 space indents, but I indent most of my C code at 2 space indents because it looks nicer :) +- I have custom installed the omnisharp roslyn executable, so I'd rather use + that +- C# code is better at 4 space indents, but I indent most of my C code at 2 + space indents because it looks nicer :) - Implemented my own function which piggy backs counsel etags to globally search tags for test specific context, then goes to it and uses an omnisharp test - command to unit test it. Basically global test search in C# projects + command to unit test it. Basically global test search in C# projects. To use + this, just make sure you have tags compiled and that all your tests are + written as some public void *name*\_Test (i.e. they are appended with _Test so + that the pattern can be matched_) ** Python #+BEGIN_SRC elisp (after! python diff --git a/doom.d/init.el b/doom.d/init.el index 2dd018d..9e315c4 100644 --- a/doom.d/init.el +++ b/doom.d/init.el @@ -104,7 +104,7 @@ ;;common-lisp ; if you've seen one lisp, you've seen them all ;;coq ; proofs-as-programs ;;crystal ; ruby at the speed of c - (csharp +lsp) ; unity, .NET, and mono shenanigans + (csharp) ; unity, .NET, and mono shenanigans data ; config/data formats ;;erlang ; an elegant language for a more civilized age ;;elixir ; erlang done right diff --git a/doom.d/packages.el b/doom.d/packages.el index 5f34ce4..d02fb33 100644 --- a/doom.d/packages.el +++ b/doom.d/packages.el @@ -11,7 +11,6 @@ ; Coding (package! counsel-etags) ; tags are cool (package! py-yapf) ; formatting -(package! omnisharp) ; unit testing ; Arduino (package! arduino-mode) ; mandatory, though I might make my own module for this (package! company-arduino) ; intellisense EVERYTHING -- cgit v1.2.3-13-gbd6f