Skip to content

Commit 9e9d7e8

Browse files
committed
Done version
1 parent 4297052 commit 9e9d7e8

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

eldoc-meta-net.el

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
:group 'tool
4747
:link '(url-link :tag "Repository" "https://github.com/emacs-vs/eldoc-meta-net"))
4848

49+
(defcustom eldoc-meta-net-display-summary nil
50+
"If non-nil, display summary if valid."
51+
:type 'boolean
52+
:group 'eldoc-meta-net)
53+
4954
;; These keywords are grab from `csharp-mode'
5055
(defconst eldoc-meta-net--csharp-keywords
5156
(append
@@ -302,7 +307,6 @@ We use this to eliminate not possible candidates."
302307
index (1+ index)
303308
name (car data) info (cdr data)
304309
match-arg-count 0)
305-
(jcs-print "name" name)
306310
(with-temp-buffer
307311
(insert name)
308312
(goto-char (point-min))
@@ -327,26 +331,28 @@ We use this to eliminate not possible candidates."
327331
(when (= match-arg-count arg-count)
328332
(setq found t)))))
329333

330-
;; Shoud we still display information if we cannot find the matching?
331-
(when found
332-
(with-temp-buffer
333-
(delay-mode-hooks (funcall 'csharp-mode))
334-
(ignore-errors (font-lock-ensure))
335-
(insert name)
336-
(let ((params (ht-get info 'params)) (param-index (1- (length match-bounds)))
337-
param param-name param-summary)
338-
(dolist (bound (reverse match-bounds)) ; we replace from the back
339-
(delete-region (car bound) (cdr bound))
340-
(goto-char (car bound))
341-
(setq param (nth param-index params)
342-
param-name (car param)
343-
param-summary (cdr param))
344-
(when (= param-index arg-index)
345-
(setq param-name (propertize param-name 'face 'eldoc-highlight-function-argument)))
346-
;; Make sure we don't add a space infront of (
347-
(insert (if (= param-index 0) "" " ") param-name)
348-
(setq param-index (1- param-index))))
349-
(buffer-string)))))))
334+
;; Start display buffer
335+
(with-temp-buffer
336+
(delay-mode-hooks (funcall 'csharp-mode))
337+
(ignore-errors (font-lock-ensure))
338+
(insert name)
339+
(let ((params (ht-get info 'params)) (param-index (1- (length match-bounds)))
340+
param param-name param-summary)
341+
(dolist (bound (reverse match-bounds)) ; we replace from the back
342+
(delete-region (car bound) (cdr bound))
343+
(goto-char (car bound))
344+
(setq param (nth param-index params)
345+
param-name (car param))
346+
(when (= param-index arg-index)
347+
(setq param-summary (cdr param) ; later insert target param summary
348+
param-name (propertize param-name 'face 'eldoc-highlight-function-argument)))
349+
;; Make sure we don't add a space infront of (
350+
(insert (if (= param-index 0) "" " ") param-name)
351+
(setq param-index (1- param-index)))
352+
(goto-char (point-max))
353+
(when (and eldoc-meta-net-display-summary param-summary)
354+
(insert "\n\n" param-summary)))
355+
(buffer-string))))))
350356

351357
(defun eldoc-meta-net--turn-on ()
352358
"Start the `eldoc-meta-net' worker."

0 commit comments

Comments
 (0)