Skip to content

Commit 14cc223

Browse files
committed
updated omnisharp-emacs
1 parent a978c44 commit 14cc223

15 files changed

+274
-258
lines changed

elpa/archives/melpa/archive-contents

+1-1
Large diffs are not rendered by default.

elpa/omnisharp-20141219.950/omnisharp-auto-complete-actions.el renamed to elpa/omnisharp-20150627.247/omnisharp-auto-complete-actions.el

+27-26
Original file line numberDiff line numberDiff line change
@@ -263,19 +263,21 @@ triggers a completion immediately"
263263
symbol)
264264
'stop)))
265265

266-
(defun omnisharp-company-flx-score-filter-list (query l cache)
266+
(defun omnisharp-company-flx-score-filter-list (query candidates cache)
267267
(let ((matches nil))
268-
(dolist (elt l)
269-
(let* ((completion-text (omnisharp--get-company-candidate-data elt 'CompletionText))
268+
(dolist (candidate candidates)
269+
(let* ((completion-text (omnisharp--get-company-candidate-data
270+
candidate
271+
'CompletionText))
270272
(flx-val (flx-score completion-text query cache)))
271273
(when (not (null flx-val))
272-
(setq matches (cons (cons elt flx-val) matches)))))
274+
(setq matches (cons (cons candidate flx-val) matches)))))
273275

274276
(if omnisharp-company-match-sort-by-flx-score
275277
(setq matches (sort matches (lambda (el1 el2) (> (nth 1 el1) (nth 1 el2)))))
276278
(setq matches (reverse matches)))
277279

278-
(mapcar (lambda (el1) (car el1)) matches)))
280+
(mapcar 'car matches)))
279281

280282
(defvar omnisharp-company-current-flx-match-list nil)
281283
(defvar omnisharp-company-current-flx-arg-being-matched nil)
@@ -294,10 +296,11 @@ triggers a completion immediately"
294296
(setq omnisharp-company-match-type 'company-match-simple)))
295297

296298
(cl-case command
297-
(prefix (when (and (bound-and-true-p omnisharp-mode) (not (company-in-string-or-comment)))
299+
(prefix (when (and (bound-and-true-p omnisharp-mode)
300+
(not (company-in-string-or-comment)))
298301
(omnisharp-company--prefix)))
299302

300-
(candidates (if (and (fboundp 'flx-score) (eq omnisharp-company-match-type 'company-match-flx))
303+
(candidates (if (eq omnisharp-company-match-type 'company-match-flx)
301304
;;flx matching
302305
(progn
303306
;; If the completion arg is empty, just return what the server sends
@@ -309,15 +312,16 @@ triggers a completion immediately"
309312
(setq omnisharp-company-current-flx-match-list (omnisharp--get-company-candidates arg))
310313
(setq omnisharp-company-current-flx-arg-being-matched arg))
311314

312-
;; Let flex sort the results
315+
;; Let flex filter the results
313316
(omnisharp-company-flx-score-filter-list arg
314317
omnisharp-company-current-flx-match-list
315318
omnisharp-company-flx-cache)))
316319
(omnisharp--get-company-candidates arg)))
317320

318321

319-
;; because "" doesn't return everything
320-
(no-cache (or (equal arg "") (not (eq omnisharp-company-match-type 'company-match-simple))))
322+
;; because "" doesn't return everything, and we don't cache if we're handling the filtering
323+
(no-cache (or (equal arg "")
324+
(not (eq omnisharp-company-match-type 'company-match-simple))))
321325

322326
(match (if (eq omnisharp-company-match-type 'company-match-simple)
323327
nil
@@ -338,10 +342,9 @@ triggers a completion immediately"
338342

339343
(ignore-case omnisharp-company-ignore-case)
340344

341-
(sorted omnisharp-company-sort-results)
342-
;; (sorted (if (eq omnisharp-company-match-type 'company-match-simple)
343-
;; (not omnisharp-company-sort-results)
344-
;; t))
345+
(sorted (if (eq omnisharp-company-match-type 'company-match-simple)
346+
(not omnisharp-company-sort-results)
347+
t))
345348

346349
;; Check to see if we need to do any templating
347350
(post-completion (setq omnisharp-company-current-flx-arg-being-matched nil)
@@ -632,18 +635,14 @@ current buffer."
632635
;;
633636
;; Get the full item so we can then get the
634637
;; RequiredNamespaceImport value from it
635-
(completed-item
636-
(-first (lambda (a)
637-
(equal result-completion-text
638-
(cdr (assoc 'CompletionText a))))
639-
json-result-alist))
638+
(completion-snippet
639+
(get-text-property 0 'Snippet result-completion-text))
640640
(required-namespace-import
641-
(cdr (assoc 'RequiredNamespaceImport
642-
completed-item))))
641+
(get-text-property 0 'RequiredNamespaceImport result-completion-text)))
643642

644-
(omnisharp--replace-symbol-in-buffer-with
645-
(omnisharp--current-word-or-empty-string)
646-
result-completion-text)
643+
(if (and completion-snippet omnisharp-company-template-use-yasnippet (fboundp 'yas/expand-snippet))
644+
(yas/expand-snippet completion-snippet (search-backward (omnisharp--current-word-or-empty-string)))
645+
(omnisharp--replace-symbol-in-buffer-with (omnisharp--current-word-or-empty-string) result-completion-text))
647646

648647
(when required-namespace-import
649648
(omnisharp--insert-namespace-import required-namespace-import)))))
@@ -703,9 +702,11 @@ is a more sophisticated matching framework than what popup.el offers."
703702
(mapcar
704703
(-lambda ((&alist 'DisplayText display-text
705704
'CompletionText completion-text
706-
'Description description))
705+
'Description description
706+
'Snippet snippet
707+
'RequiredNamespaceImport require-ns-import))
707708
(popup-make-item display-text
708-
:value completion-text
709+
:value (propertize completion-text 'Snippet snippet 'RequiredNamespaceImport require-ns-import)
709710
:document description))
710711
json-result-alist))
711712

Binary file not shown.

elpa/omnisharp-20141219.950/omnisharp-autoloads.el renamed to elpa/omnisharp-20150627.247/omnisharp-autoloads.el

+16-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;;; Code:
44
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
55

6-
;;;### (autoloads nil "omnisharp" "omnisharp.el" (21657 17696 0 0))
6+
;;;### (autoloads nil "omnisharp" "omnisharp.el" (21915 10013 0 0))
77
;;; Generated autoloads from omnisharp.el
88

99
(autoload 'omnisharp-mode "omnisharp" "\
@@ -17,10 +17,21 @@ server backend.
1717
1818
\(fn)" t nil)
1919

20+
;;;***
21+
22+
;;;### (autoloads nil "omnisharp-auto-complete-actions" "omnisharp-auto-complete-actions.el"
23+
;;;;;; (21915 10013 0 0))
24+
;;; Generated autoloads from omnisharp-auto-complete-actions.el
25+
26+
(autoload 'company-omnisharp "omnisharp-auto-complete-actions" "\
27+
`company-mode' completion back-end using OmniSharp.
28+
29+
\(fn COMMAND &optional ARG &rest IGNORED)" nil nil)
30+
2031
;;;***
2132

2233
;;;### (autoloads nil "omnisharp-server-actions" "omnisharp-server-actions.el"
23-
;;;;;; (21657 17696 0 0))
34+
;;;;;; (21915 10013 0 0))
2435
;;; Generated autoloads from omnisharp-server-actions.el
2536

2637
(autoload 'omnisharp-start-omnisharp-server "omnisharp-server-actions" "\
@@ -47,9 +58,9 @@ finished loading the solution.
4758

4859
;;;***
4960

50-
;;;### (autoloads nil nil ("example-config-for-evil-mode.el" "omnisharp-auto-complete-actions.el"
51-
;;;;;; "omnisharp-pkg.el" "omnisharp-utils.el") (21657 17696 360498
52-
;;;;;; 0))
61+
;;;### (autoloads nil nil ("example-config-for-evil-mode.el" "omnisharp-pkg.el"
62+
;;;;;; "omnisharp-settings.el" "omnisharp-utils.el") (21915 10013
63+
;;;;;; 182463 0))
5364

5465
;;;***
5566

elpa/omnisharp-20141219.950/omnisharp-pkg.el renamed to elpa/omnisharp-20150627.247/omnisharp-pkg.el

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
(define-package "omnisharp" "20141219.950" "Omnicompletion (intellisense) and more for C#"
1+
(define-package "omnisharp" "20150627.247" "Omnicompletion (intellisense) and more for C#"
22
'((json "1.2")
33
(flycheck "0.21")
44
(dash "20141201.2206")
55
(auto-complete "1.4")
66
(popup "0.5.1")
77
(csharp-mode "0.8.7")
8-
(cl-lib "0.5"))
8+
(cl-lib "0.5")
9+
(s "1.9.0"))
910
:url "https://github.com/sp3ctum/omnisharp-emacs" :keywords
1011
'("csharp" "c#" "ide" "auto-complete" "intellisense"))
1112
;; Local Variables:

elpa/omnisharp-20141219.950/omnisharp-server-actions.el renamed to elpa/omnisharp-20150627.247/omnisharp-server-actions.el

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
;; Path to the server
3-
(defcustom omnisharp-server-executable-path nil
4-
"Path to OmniSharpServer. If its value is nil, search for the server in the exec-path")
3+
(defcustom omnisharp-server-executable-path (executable-find "OmniSharp.exe")
4+
"Path to OmniSharpServer. If its value is nil, search for the server in the exec-path"
5+
:type '(choice (const :tag "Not Set" nil) string))
56

67
(defun omnisharp--find-solution-files ()
78
"Find solution files in parent directories. Returns a list
@@ -42,7 +43,6 @@ solution files were found."
4243
t
4344
filename))))
4445
(setq BufferName "*Omni-Server*")
45-
(omnisharp--find-and-cache-omnisharp-server-executable-path)
4646
(if (equal nil omnisharp-server-executable-path)
4747
(error "Could not find the OmniSharpServer. Please set the variable omnisharp-server-executable-path to a valid path")
4848
(if (omnisharp--valid-solution-path-p path-to-solution)
@@ -62,11 +62,6 @@ solution files were found."
6262
(set-process-filter process (lambda (process string))))))
6363
(error (format "Path does not lead to a solution file: %s" path-to-solution)))))
6464

65-
(defun omnisharp--find-and-cache-omnisharp-server-executable-path ()
66-
"Tries to find OmniSharpServer in exec-path, if omnisharp-server-executable-path is not set"
67-
(when (equal nil omnisharp-server-executable-path)
68-
(setq omnisharp-server-executable-path (executable-find "OmniSharp"))))
69-
7065
;;;###autoload
7166
(defun omnisharp-check-alive-status ()
7267
"Shows a message to the user describing whether the
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
;; this file contains settings that are used throughout the project
2+
3+
(defgroup omnisharp ()
4+
"Omnisharp-emacs is a port of the awesome OmniSharp server to
5+
the Emacs text editor. It provides IDE-like features for editing
6+
files in C# solutions in Emacs, provided by an OmniSharp server
7+
instance that works in the background."
8+
:group 'external
9+
:group 'csharp)
10+
11+
(defcustom omnisharp-host "http://localhost:2000/"
12+
"Currently expected to end with a / character."
13+
:group 'omnisharp
14+
:type 'string)
15+
16+
(defvar omnisharp--find-usages-buffer-name "* OmniSharp : Usages *"
17+
"The name of the temporary buffer that is used to display the
18+
results of a 'find usages' call.")
19+
20+
(defvar omnisharp-debug nil
21+
"When non-nil, omnisharp-emacs will write entries a debug log")
22+
23+
(defvar omnisharp--find-implementations-buffer-name "* OmniSharp : Implementations *"
24+
"The name of the temporary buffer that is used to display the
25+
results of a 'find implementations' call.")
26+
27+
(defvar omnisharp--ambiguous-symbols-buffer-name "* OmniSharp : Ambiguous unresolved symbols *"
28+
"The name of the temporary buffer that is used to display any
29+
ambiguous unresolved symbols of a 'fix usings' call.")
30+
31+
(defvar omnisharp-find-usages-header
32+
(concat "Usages in the current solution:"
33+
"\n\n")
34+
"This is shown at the top of the result buffer when
35+
omnisharp-find-usages is called.")
36+
37+
(defvar omnisharp-find-implementations-header
38+
(concat "Implementations of the current interface / class:"
39+
"\n\n")
40+
"This is shown at the top of the result buffer when
41+
omnisharp-find-implementations is called.")
42+
43+
(defvar omnisharp-ambiguous-results-header
44+
(concat "These results are ambiguous. You can run
45+
(omnisharp-run-code-action-refactoring) when point is on them to see
46+
options for fixing them."
47+
"\n\n")
48+
"This is shown at the top of the result buffer when
49+
there are ambiguous unresolved symbols after running omnisharp-fix-usings")
50+
51+
(defcustom omnisharp-code-format-expand-tab t
52+
"Whether to expand tabs to spaces in code format requests."
53+
:group 'omnisharp
54+
:type '(choice (const :tag "Yes" t)
55+
(const :tag "No" nil)))
56+
57+
(defvar omnisharp-mode-map
58+
(let ((map (make-sparse-keymap)))
59+
;; TODO add good default keys here
60+
;;(define-key map (kbd "C-c f") 'insert-foo)
61+
map)
62+
"Keymap for omnisharp-mode.")
63+
64+
;; Note that emacs seems to internally expect windows paths to have
65+
;; forward slashes.
66+
(eval-after-load 'omnisharp
67+
'(defcustom omnisharp--windows-curl-tmp-file-path
68+
(omnisharp--convert-backslashes-to-forward-slashes
69+
(concat (getenv "USERPROFILE")
70+
"/omnisharp-tmp-file.cs"))
71+
"The full file path where to save temporary stuff that gets sent to
72+
the OmniSharp API. Only used on Windows.
73+
Must be writable by the current user."
74+
:group 'omnisharp
75+
:type 'file))
76+
77+
(defcustom omnisharp--curl-executable-path
78+
"curl"
79+
"The absolute or relative path to the curl executable.")
80+
81+
82+
(provide 'omnisharp-settings)
Binary file not shown.

elpa/omnisharp-20141219.950/omnisharp-utils.el renamed to elpa/omnisharp-20150627.247/omnisharp-utils.el

+7-7
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ the curl program. Depends on the operating system."
175175
single-or-multiline-log-string))
176176
(insert "\n"))))
177177

178-
(defun omnisharp--get-curl-command-executable-string-for-api-name
178+
(defun omnisharp--get-curl-command-arguments-string-for-api-name
179179
(params api-name)
180180
"Returns the full command to call curl with PARAMS for the api API-NAME.
181181
Example: when called with \"getcodeactions\", returns
@@ -185,9 +185,7 @@ with \"stuff\" set to sensible values."
185185
(omnisharp--get-curl-command
186186
(concat (omnisharp-get-host) api-name)
187187
params)))
188-
(cons
189-
(plist-get command-plist :command)
190-
(plist-get command-plist :arguments))))
188+
(plist-get command-plist :arguments)))
191189

192190
(defun omnisharp--get-curl-command-unix (url params)
193191
"Returns a command using plain curl that can be executed to
@@ -214,7 +212,8 @@ api at URL using that file as the parameters."
214212
)))
215213
`(:command ,omnisharp--curl-executable-path
216214
:arguments
217-
("--silent" "-H" "Content-type: application/json"
215+
("--noproxy" "localhost"
216+
"--silent" "-H" "Content-type: application/json"
218217
"--data-binary"
219218
;; @ specifies a file path to curl
220219
,path-with-curl-prefix
@@ -286,8 +285,9 @@ moving point."
286285
"-s"
287286
solution-file-path-arg)))
288287
(cond
289-
((or (equal system-type 'cygwin) ;; No mono needed on cygwin
290-
(equal system-type 'windows-nt))
288+
((or (equal system-type 'cygwin) ;; No mono needed on cygwin or if using omnisharp-roslyn
289+
(equal system-type 'windows-nt)
290+
(not (s-ends-with? ".exe" server-exe-file-path-arg)))
291291
args)
292292
(t ; some kind of unix: linux or osx
293293
(cons "mono" args)))))

0 commit comments

Comments
 (0)