Closed aguynamedben closed 7 months ago
eldoc-box just has a few heuristic prettifier functions that cleans up the markdown returned from language servers, and fontifies the markdown with markdown-mode
(you probably already know this). It should be pretty easy for someone to copy these functions and write some boilerplate code to integrate with company and corfu. For me it doesn't make much sense for company or corfu to import eldoc-box just for the prettification.
(defvar eldoc-box-buffer-hook '(eldoc-box--prettify-markdown-separator
eldoc-box--replace-en-space
eldoc-box--remove-linked-images
eldoc-box--remove-noise-chars
eldoc-box--fontify-html
eldoc-box--condense-large-newline-gaps)
"Hook run after buffer for doc is setup.
Run inside the new buffer. By default, it contains some Markdown
prettifiers, which see.")
@casouri Thanks for the response. I'm going to close this. eldoc-box was doing a lot of legwork to clean up nastiness coming from PyRight language server. PyRight gives back "plaintext" instead of Markdown, and it's plaintext is Python doc strings (not actually plain text). So your extra step of processing was cleaning it twice.
Interestingly, the Eglot package leans on markdown-mode as well, which I use. I think Eglot was cleaning the nasty output from PyRight once, and then you were cleaning it again.
I switched my Python language server to pylsp (https://github.com/python-lsp/python-lsp-server) which gives back proper Markdown from it's language server, and now (a) Corfu showing it nicely, eldoc-box showing it nicely, and eldoc buffer showing it nicely.
Thanks for your response, language servers and these documentation UXes are so interesting! I love eldoc-box, thank you for sharing your work and helping people like me understand things. 🙏
I'm glad you found out what works best for you 😁
This package is awesome. It's the best "pretty printing" of docs I've seen in Emacs. Great work!
I'm wondering if you've ever considered making this a "front end" for corfu or company-mode.
Below is a comparison:
eldoc-box
!!! awesome!
stock eldoc buffer
Pretty good, has syntax highlighting, displays horizontal rule, but has goofy &nsbp;'s from Markdown (I see why you added a prettifier layer!)
corfu-popupinfo-mode
No syntax highlighting, no horizontal rule, but at least monospace
company-quickhelp
Seems like it's just whitespace stripped and non-monospace
I would guess that Corfu and Company Mode completion systems are on the rise due to the popularity of language servers, and the eglot and lsp Emacs packages. It seems like you have the best "clean up the docs" system that would benefit many people if the logic could be ported or shared with corfu or company-mode.