Replies: 4 comments 2 replies
-
With eglot your choices are:
With this in mind you can look at packages that hook into Eldoc to "pop-up" information in places other than the mini-buffer. There are two solutions that I have tried that work well.
The The Want to use the Edit: Eldoc Box has gotten a lot better, as there are now working functions that call up the box on-demand. There are two separate commands for when you have Eglot, and when you do not: (setq eldoc-echo-area-use-multiline-p nil
eldoc-idle-delay 0.75)
(require 'eldoc-box)
(global-set-key (kbd "C-c i") #'eldoc-box-help-at-point)
(define-key eglot-mode-map (kbd "C-c I") #'eldoc-box-eglot-help-at-point) Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
@trev-dev Regarding the annoying line wrapping in the I wrote the following workaround which replaces "---" with something else. In this case, I replaced it with a sequence of hyphen-like characters that should fill the width of the popup frame without causing wrapping: (defun kb/eglot--format-markup (markup)
"Format MARKUP according to LSP's spec."
(pcase-let ((`(,string ,mode)
(if (stringp markup) (list markup 'gfm-view-mode)
(list (plist-get markup :value)
(pcase (plist-get markup :kind)
("markdown" 'gfm-view-mode)
("plaintext" 'text-mode)
(_ major-mode))))))
(with-temp-buffer
(setq-local markdown-fontify-code-blocks-natively t)
;; Replace the horizontal rule, which is three hyphens in the markup,
;; with X number of hyphens-like characters, with X being enough to
;; cover the width of `eldoc-box-max-pixel-width'. We can't simply
;; replace with more hyphens since `gfm-view-mode' renders any set of
;; three hyphens as a horizontal rule
(setq string (string-replace "---"
(make-string (floor (/ eldoc-box-max-pixel-width (window-font-width))) ?⎺)
string))
(insert string)
(let ((inhibit-message t)
(message-log-max nil))
(ignore-errors (delay-mode-hooks (funcall mode))))
(font-lock-ensure)
(string-trim (buffer-string)))))
(advice-add 'eglot--format-markup :override #'kb/eglot--format-markup) I tried looking at |
Beta Was this translation helpful? Give feedback.
-
The https://github.com/jrblevin/markdown-mode/blob/master/markdown-mode.el#L3515 It's uncontrollable. So I just replace the (defun cxa/filter-args/eglot--format-markup (args)
(mapcar (lambda (markup)
(if (plistp markup)
(let* ((value (plist-get markup :value))
(kind (plist-get markup :kind))
(_ (string= kind "markdown"))
(value (string-replace "---" "" value)))
(plist-put markup :value value))
markup))
args))
(advice-add 'eglot--format-markup :filter-args 'cxa/filter-args/eglot--format-markup) |
Beta Was this translation helpful? Give feedback.
-
FYI I updated my original response to suit my newer experience with eldoc-box. #912 (comment) |
Beta Was this translation helpful? Give feedback.
-
Greetings,
I just god Eglot working with Company, but, I was wondering if Eglot has equivalent functionality to LSP-UI, like a popup-menu, documentation, and so forth?
Or will I need enable some extra company feature to get this type of functionality with Eglot?
https://github.com/company-mode/company-quickhelp
^ This extra company-quickhelp package looks useful, but I want to check if Eglot has it's own built-in UI functionality to implement stuff like this?
Note: I'm transitioning from lsp-mode/lsp-ui to Eglot, so there's a lot I don't know and Eglot is still lacking in the documentation area. Eglot itself seems similar to lsp-mode, but I'm not sure what's the best way to get lsp-ui like functionality working with Eglot?
I'm confused about this, so I figured I'd ask here.
Thanks in advance for the help.
Beta Was this translation helpful? Give feedback.
All reactions