minad:main
← galeo:add-corfu-doc
已打开 05:48PM - 29 May 22 UTC
Hi @minad
According to your request, I refactored the code in `corfu.el` tha… t creates the child frame and sets the frame position and size. I also made some modifications to meet the needs of `corfu-doc`. As suggested by Stefan's code review, the version of `corfu-doc` is set to 0.8, also to transition from my repo version.
Please review the code when you have time.
Thanks.
现在正在剧烈重构中,如果之后不会再次大改的话,应该会一直叫 corfu-docframe
了
2022-11-18T19:21:45+0800
现在叫 corfu-infoframe
2022-11-18T22:28:04+0800
现在叫 corfu-popupinfo
期待能尽早看到 corfu-terminal 也能被合并进 corfu 的一天
minad:main
← jgarte:jgarte-patch-2
See #178. We plan to add corfu-doc here soon. Then corfu-terminal will include s… upport directly and corfu-doc-terminal won't be needed.
好家伙,看来至少要等到明年二月份(安详.jpg
已打开 10:17AM - 18 Nov 22 UTC
已关闭 05:03PM - 05 Sep 23 UTC
enhancement
help wanted
I have tried `corfu-docframe` and it works well. I would like to support it in … terminal. The code looks much saner than its predecessor `corfu-doc` package, and I think it should be possible to do this with about 3-5 advices if `corfu-docframe` is refactored properly. My suggestions are:
- Split `corfu-docframe--show` into two parts, one child-dependent, and other one independent, so that I can override the child-dependent part.
- Split `corfu-docframe-scroll-up` into two part as above, it's saner to advice plain function than interactive commands.
What do you think, @minad?
Probably I can return to this extension around Feb 2023. In the meantime, if you could get the assignment it would be great! I’ve seen that you’ve been trying to get it but unfortunately hit some unpredictable obstacles.
corfu-terminal 的作者还没有签协议,并且看到相关的这个扩展变动这么频繁表示要过会儿再碰
合并历时半年,这期间 corfu-doc
除了 bug fixes 不接收任何 “new code changes ”,corfu[,-doc]-terminal
的合并过程只会更艰难。
看来还是任重而道远
不过这个 pr 我个人感觉很有用啊,大佬不考虑一下给现在的 corfu 提个 pr 吗?
我刚才浏览了一下,合并之后似乎已经不存在当时我 PR 想要修复问题了。
我也看了下,貌似现在的逻辑是每次获取文档后,会更新 corfu--extra
里 company-doc-buffer
这个 buffer,但 corfu 也没有设置过这个变量的值
https://github.com/minad/corfu/blob/main/extensions/corfu-docframe.el#L116
现在测试 corfu-docframe
,触发 corfu 补全后,新补全内容的文档会覆盖旧文档
噢,问题还在,我先前没看清楚。
我去提 PR。
重现步骤:
启动 Emacs:
emacsq.sh -L ~/repos/emacs-corfu \
-L ~/repos/emacs-corfu/extensions \
-P corfu,corfu-docframe \
-M global-corfu-mode,corfu-docframe-mode,corfu-docframe-toggle
执行 M-x describe-function RET pcase RET
打开 help 窗口。
在 *scratch*
输入 (corfu-
。
按 C-M-i
补全。
等待 docframe
显示。
*Help*
缓冲内容变了。
如果我们对一个函数不熟悉,想一边看文档一边写代码,补全 doc 吧 Help 刷掉就很烦。
1 个赞
的确是,我被这个问题困扰过一端时间
糊过一段代码就是让光标留在当前 buffer,然后在 help buffer 上执行 help-go-back
,没想到问题是在这个地方,果然还是得多看源码
PR 被否决了,@minad 认为应该让上游来解决。
我又提了一个新的 PR ,解决当变量值是一个超大列表时的卡顿问题。
1 个赞
看 minad 的发言,像是想用一种最泛用的解决方式,直接去改 :company-doc-buffer
的行为从而一劳永逸地解决问题,而不是改他这里,那这下一来要花的时间可就难以估量了
(defun corfu--in-region (&rest args)
"Corfu completion in region function called with ARGS."
;; XXX We can get an endless loop when `completion-in-region-function' is set
;; globally to `corfu--in-region'. This should never happen.
(apply (if (corfu--popup-support-p) #'corfu--in-region-1
(default-value 'completion-in-region-function))
args))
(defun corfu--in-region-1 (beg end table &optional pred)
"Complete in region, see `completion-in-region' for BEG, END, TABLE, PRED."
(barf-if-buffer-read-only)
;; Restart the completion. This can happen for example if C-M-/
;; (`dabbrev-completion') is pressed while the Corfu popup is already open.
(when completion-in-region-mode (corfu-quit))
(let* ((pt (max 0 (- (point) beg)))
(str (buffer-substring-no-properties beg end))
(metadata (completion-metadata (substring str 0 pt) table pred))
(exit (plist-get completion-extra-properties :exit-function))
(threshold (completion--cycle-threshold metadata))
(completion-in-region-mode-predicate
设置 corfu–extra 这个变量的是 completion-extra-properties
,是个 Emacs 的变量,而 :company-doc-buffer
咋看也是个 company-mode
里的变量,不懂要改的话还能怎么操作
并且看 commit 现在还在改来改去,精力真是充沛啊
看现在 minad 的做法,似乎是认为这种做法是合理的;我注意到他把 corfu-echo
给拆了出来
以后貌似要 corfu-echo
corfu-infoframe
corfu-info
三者齐头并进了(其实感觉这么做不太好,本身这个功能就是在补全项旁弹出对应文档,现在又加了个显示 location 的功能,跟 corfu-info
功能重叠了有点)
这个插件还不稳定,又改名叫 corfu-popupinfo
了。这名字好丑!
corfu-doc 不是挺好听的嘛
看来还要继续动荡一阵子。不如暂时锁定合并之前的版本,打上我在 #8 楼提供的两个补丁。
aqua0210:
corfu-doc 不是挺好听的嘛
因为现在这个扩展的功能不只是看文档了,还可以查源码的原因吧
我也感觉作者起的这几个名字都好丑,感觉叫 corfu-popup
得了;要是作者强调这是要看补全的 info,那 corfu-echo
也是看补全的 info,为啥不叫 corfu-echoinfo
看作者现在的改动,我收回之前“感觉这么做不太好”的评价;单独整个 childframe 出来,的确是 corfu-info
这种弹个 buffer 出来的替代品,之前没有看源码的功能,corfu-info
跟 corfu-infoframe
的关系就很尴尬
现在用大佬写的补丁,配合上现在的 corfu-popupinfo
,方便了很多