galeo / corfu-doc Goto Github PK
View Code? Open in Web Editor NEWDocumentation popup for Corfu
License: GNU General Public License v3.0
Documentation popup for Corfu
License: GNU General Public License v3.0
Thanks for the great package. Can you please tell what the theme is in the screenshot? :)
I sometimes see completions like this, where the documentation frame is way to the left and cut off at the edge of my monitor:
I've only seen this with cider, and mostly in the cider REPL as I recall.
I'm using Emacs 29 recent master on a MacOS M1 machine.
I tried with corfu-doc-display-within-parent-frame
set to both nil
and t
; same result.
Hey there!
I know this is pretty alpha-stuff, so please don't feel pressure from my asking about features. :) I really, really don't want to encroach on your time.
That said, does this work with lsp-mode? When I've tried it it doesn't seem to work. I can get some documentation from inside of corfu
with M-h. It would be really snazzy if that documentation popped up in this window. Is there just something that I need to configure?
I just started the school semester; I doubt I'll personally have much time to tinker with this, but if there is something I might be able to help with, please let me know and I'll see what I can do.
Thank you for publishing this! I love that you just kind of said "fine, I'll do it myself" ala Thanos when @minad said this kind of thing wasn't a priority. π
Is it possible to scroll the documentation with the mouse wheel?
I'd also like to be able to toggle the documentation by clicking the middle mouse button.
(define-key corfu-map (kbd "M-p") #'corfu-doc-scroll-down) ;; corfu-next
(define-key corfu-map (kbd "M-n") #'corfu-doc-scroll-up) ;; corfu-previous
Hi! I guess this might be a matter of perspective, but these binds feel backwards to me; corfu-next
advances down to the next selection, which does correspond to corfu-doc-scroll-down
, but would conventionally be bound to M-n
(n
for next), not M-p
(and vice versa).
Hello, I use emacs-daemon + emacsclient on Arch Linux. I usually run emacs using systemctl --user start emacs.service
. After the latest update of corfu-doc
I'm getting the error in logs:
Jun 06 10:52:36 rudakov-xps emacs[4841]: Warning (initialization): An error occurred while loading β/home/rrudakov/.emacs.d/init.elβ:
Jun 06 10:52:36 rudakov-xps emacs[4841]: error: Corfu-doc requires child frames to display documentation
Jun 06 10:52:36 rudakov-xps emacs[4841]: To ensure normal operation, you should investigate and remove the
Jun 06 10:52:36 rudakov-xps emacs[4841]: cause of the error in your initialization file. Start Emacs with
Jun 06 10:52:36 rudakov-xps emacs[4841]: the β--debug-initβ option to view a complete error backtrace. Disable showing Disable logging
Jun 06 10:52:36 rudakov-xps emacs[4841]: Package rfc2368 is deprecated
Jun 06 10:52:36 rudakov-xps emacs[4841]: Package cl is deprecated
Starting emacs without systemctl works fine.
Hi,
I'm the author of corfu-terminal
. corfu-terminal
allows to use Corfu on terminal. I'm trying to make corfu-doc
working in terminal, but I can't find any sane way to do this, because corfu-doc
depends heavily on the window of child frame. For Corfu, it was easy because though it uses child frame, it is line oriented.
Can you help to corfu-doc
usable on terminal? One solution would be to use corfu--popup-show
and corfu--popup-hide
but that might be too specialized for Corfu to use. Another solution would be to not depend on the window of child frame, instead be line oriented like Corfu and rewrite the doc buffer (the buffer visible in the child frame) for every change (e.g. scroll, candidate change) using a function to show the popup and another to hide it. Then I can write a package like corfu-doc-terminal
and override those functions that show and hide the popup. If you don't do anything, then another package must be developed from scratch for doing the same work but with terminal support, which is indeed undesirable.
After updating the package today, the (corfu-doc-mode)
line in my init.el works when emacs is started normally, but errors when emacs is started as a daemon. This is likely because when running as daemon, no frame is available while running init.el.
The exact error I get is as follows:
Warning (initialization): An error occurred while loading β/home/archit/.config/emacs/init.elβ:
error: Corfu-doc requires child frames to display documentation
Emacs continues after the error but does not load the rest of init.el and shows the above error in the messages buffer.
I am using emacs 29 on Linux.
Very fantastic work! I love the package.
I noticed that the package creates a .cache directory in the emacs-directory
which stores SVG files. Though I'm not sure if this is directly from a setting this package set or a setting in another package this relies on, would it be possible to have a variable which chooses which directory is the cache?
Hello, although corfu-doc allows scrolling of the doc, I'd sometimes prefer to just move the doc to a buffer and open/view it in the current window. How can I do that?
Hey @galeo,
in preparation of minad/corfu#178 I tested your package more thoroughly. Overall, this is great work! I observed a few issues which should be resolved first before merging this into Corfu itself:
When scrolling over candidates the doc frame flickers heavily. It always redisplays once without content and then with content. Is there a chance to improve this such that the content is displayed immediately?
There are multiple missing docstrings and other warnings which should be sorted out. Check out package-lint.
The option corfu-doc-display-within-parent-frame is set to nil by default. This option does not work on most platforms, in particular not on the free ones. I suggest we remove the option entirely and always display the frame inside the parent frame. This should also simplify the position computation slightly.
You define a variable space=1 in corfu-doc--calculate-doc-frame-position
such that the frames have a distance of 1. Did you consider instead to move the frames very close to each other space=-1, such that they share the border. This looks better in my opinion. (EDIT: Fixed, but we should also handled border width /= 1.)
Sometimes the child frame size fluctuates slightly when scrolling. This is probably related to the redisplay issue when scrolling.
You use advices to hook into Corfu. Would it be possible to instead register a post-command-hook and then perform the required updates there, depending on if the corfu--frame is alive, the selected candidate etc? This seems a little bit cleaner.
After commit caccd9475783cfc12ab5c49d44b6ca7535e84a4a, corfu-doc-terminal
broke (corfu-doc-terminal#2). Can you revert the change? I need corfu-doc--get-cf-popup-edges
to make corfu-doc-terminal
work.
If this change is for add corfu-doc
to Corfu, then I would suggest making this kind of changes in a dedicated branch, so that the MELPA version is not affected.
Hey there! I love this package!
I'm getting an issue with the child frame when Emacs is on my external monitor. Here's what it looks like:
Is there anything else that I can contribute to help figure this out? I wouldn't call myself an elisp wizard or anything, but I can follow whatever instructions you give me. I'm sorry if this isn't too helpful. π
Have you had any luck trying to bind the mouse wheel (button 4 and 5) to scroll documentation?
I tried but it didn't work. I'll try to reconstruct the command and paste it here.
I noticed a behavior I cannot explain, which I will try to demonstrate below:
In the *scratch*
buffer, I type y-[completion-at-point]
:
Now, I will quit this completion with corfu-quit
, and then try to complete at point (invoke completion-at-point
) again, but now there is no corfu popup:
Repeating this process (of completing and quitting) would yield the above results, alternating between the two.
I do not have any special configuration (only the add-hook
form from the README).
Why does this happen?
The reason I post this question here is because it happens only when corfu-doc-mode
is enabled.
Thanks for writing corfu-doc!
I noticed that the behavior of corfu-doc-toggle
is inconsistent, in that it doesn't restore state correctly when you exit the Corfu completion. To reproduce this,
corfu-doc-mode
is off.corfu-doc-toggle
.keyboard-quit
.corfu-doc--frame
pops up automatically because corfu-doc-mode
was not turned off.I modified this command to clean up after itself as follows:
(defun corfu-doc--cleanup ()
(advice-remove 'corfu--popup-hide #'corfu-doc--cleanup)
(advice-remove 'corfu--popup-show #'corfu-doc--set-timer)
(corfu-doc--hide))
(defun corfu-doc-toggle ()
(interactive)
(advice-add 'corfu--popup-hide :after #'corfu-doc--cleanup)
(if (and corfu-doc--frame (frame-visible-p corfu-doc--frame))
(progn (corfu-doc--hide)
(advice-remove 'corfu--popup-show #'corfu-doc--set-timer))
(corfu-doc--show)
(advice-add 'corfu--popup-show :after #'corfu-doc--set-timer)))
If you want to reuse corfu-doc-mode
in corfu-doc-toggle
, perhaps you could add an unwind-protect
clause to this command instead?
Important: this package has been merged into Corfu as one of its extensions. And this repository is deprecated now.
"one of its extensions" is unnecessarily vague. Please at least say which extension.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.