Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acm-template-candidate-update 报错 #799

Closed
zqs123q opened this issue Nov 29, 2023 · 6 comments
Closed

acm-template-candidate-update 报错 #799

zqs123q opened this issue Nov 29, 2023 · 6 comments

Comments

@zqs123q
Copy link

zqs123q commented Nov 29, 2023

有eglot经验,第一次尝试使用lsp-bridge + gopls,跳转ok,但是没有补全,手动调用lsp-bridge-popup-complete-menu也没反应,也没看到什么报错。
然后尝试emacs -q 最小化配置运行,看到acm-template-candidate-update有报错。

*Message* 输出

[LSP-Bridge] Active project ’xxx’, enjoy hacking!
Error in post-command-hook (lsp-bridge-monitor-post-command): (wrong-number-of-arguments ((t) (r g b) (format "#%02x%02x%02x" (ash r -8) (ash g -8) (ash b -8))) 0)
Error running timer ‘acm-template-candidate-update’: (wrong-number-of-arguments ((t) (r g b) (format "#%02x%02x%02x" (ash r -8) (ash g -8) (ash b -8))) 0) [4 times]
Quit [2 times]
Error running timer ‘acm-template-candidate-update’: (wrong-number-of-arguments ((t) (r g b) (format "#%02x%02x%02x" (ash r -8) (ash g -8) (ash b -8))) 0) [2 times]

toggle-debug-on-error堆栈

Debugger entered--Lisp error: (wrong-number-of-arguments ((t) (r g b) (format "#%02x%02x%02x" (ash r -8) (ash g -8) (ash b -8))) 0)
(closure (t) (r g b) (format "#%02x%02x%02x" (ash r -8) (ash g -8) (ash b -8)))()
apply((closure (t) (r g b) (format "#%02x%02x%02x" (ash r -8) (ash g -8) (ash b -8))) nil)
acm-frame-color-blend("unspecified-bg" "#AAAAAA" 0.9)
(set-face-background 'acm-frame-default-face (acm-frame-color-blend default-background blend-background (if is-dark-mode 0.8 0.9)))
(progn (set-face-background 'acm-frame-default-face (acm-frame-color-blend default-background blend-background (if is-dark-mode 0.8 0.9))))
(if (or force (equal (face-attribute 'acm-frame-default-face :background) 'unspecified)) (progn (set-face-background 'acm-frame-default-face (acm-frame-color-blend default-background blend-background (if is-dark-mode 0.8 0.9)))))
(let* ((is-dark-mode (string-equal (acm-frame-get-theme-mode) "dark")) (blend-background (if is-dark-mode "#000000" "#AAAAAA")) (default-background (if (or force (equal (face-attribute 'acm-frame-default-face :background) 'unspecified)) (face-attribute 'default :background) (face-attribute 'acm-frame-default-face :background)))) (if (or force (equal (face-attribute 'acm-frame-default-face :background) 'unspecified)) (progn (set-face-background 'acm-frame-default-face (acm-frame-color-blend default-background blend-background (if is-dark-mode 0.8 0.9))))) (if (or force (equal (face-attribute 'acm-frame-select-face :background) 'unspecified)) (progn (set-face-background 'acm-frame-select-face (acm-frame-color-blend default-background blend-background 0.6)))) (if (or force (equal (face-attribute 'acm-frame-select-face :foreground) 'unspecified)) (progn (set-face-foreground 'acm-frame-select-face (face-attribute 'font-lock-function-name-face :foreground)))))
acm-frame-init-colors()
(let* ((menu-old-cache (cons acm-menu-max-length-cache acm-menu-number-cache))) (acm-mode 1) (add-hook 'pre-command-hook #'acm--pre-command nil 'local) (set (make-local-variable 'acm-menu-offset) 0) (if (= 0 (length acm-menu-candidates)) (set (make-local-variable 'acm-menu-index) -1) (set (make-local-variable 'acm-menu-index) 0) (if (and current-select-candidate-index (> (length candidates) 1)) (progn (cond ((and (= previous-select-candidate-index 0) (= current-select-candidate-index 1)) (let* (... ...) (progn ... nil)) (let* (... ...) (progn ... nil))) ((and (= previous-select-candidate-index 1) (= current-select-candidate-index 0)) (let* (... ...) (progn ... nil)) (let* (... ...) (progn ... nil)) (set (make-local-variable ...) 1)) ((and (= previous-select-candidate-index 1) (= current-select-candidate-index 1)) (set (make-local-variable ...) 1)))))) (set (make-local-variable 'acm-candidates) candidates) (set (make-local-variable 'acm-menu-candidates) menu-candidates) (acm-frame-init-colors) (setq acm-menu-frame-popup-point (or (car bounds) (point))) (if (posn-at-point acm-menu-frame-popup-point) (progn (setq acm-menu-frame-popup-position (acm-frame-get-popup-position acm-menu-frame-popup-point)) (if (and (frame-live-p acm-menu-frame) (not (eq (frame-parent acm-menu-frame) (selected-frame)))) (progn (if (frame-live-p acm-menu-frame) (progn (if ... ...) (delete-frame acm-menu-frame) (setq acm-menu-frame nil))) (if (frame-live-p acm-doc-frame) (progn (if ... ...) (delete-frame acm-doc-frame) (setq acm-doc-frame nil))))) (if (frame-live-p acm-menu-frame) nil (setq acm-menu-frame (acm-frame-make-frame "acm frame" t)) (save-current-buffer (set-buffer (get-buffer-create acm-buffer)) (use-local-map acm-frame--mouse-ignore-map) (let ((tail ...)) (while tail (let ... ... ...)))) (let ((win (frame-root-window acm-menu-frame))) (set-window-buffer win acm-buffer) (set-window-dedicated-p win t))) (acm-menu-render menu-old-cache))))
(cond ((and (equal (length candidates) 1) (string-equal keyword (plist-get (nth 0 candidates) :label)) (not (member (plist-get (nth 0 candidates) :annotation) '("Emmet Abbreviation" "Snippet" "Yas-Snippet" "Tempel")))) (acm-hide)) ((> (length candidates) 0) (let* ((menu-old-cache (cons acm-menu-max-length-cache acm-menu-number-cache))) (acm-mode 1) (add-hook 'pre-command-hook #'acm--pre-command nil 'local) (set (make-local-variable 'acm-menu-offset) 0) (if (= 0 (length acm-menu-candidates)) (set (make-local-variable 'acm-menu-index) -1) (set (make-local-variable 'acm-menu-index) 0) (if (and current-select-candidate-index (> (length candidates) 1)) (progn (cond (... ... ...) (... ... ... ...) (... ...))))) (set (make-local-variable 'acm-candidates) candidates) (set (make-local-variable 'acm-menu-candidates) menu-candidates) (acm-frame-init-colors) (setq acm-menu-frame-popup-point (or (car bounds) (point))) (if (posn-at-point acm-menu-frame-popup-point) (progn (setq acm-menu-frame-popup-position (acm-frame-get-popup-position acm-menu-frame-popup-point)) (if (and (frame-live-p acm-menu-frame) (not ...)) (progn (if ... ...) (if ... ...))) (if (frame-live-p acm-menu-frame) nil (setq acm-menu-frame (acm-frame-make-frame "acm frame" t)) (save-current-buffer (set-buffer ...) (use-local-map acm-frame--mouse-ignore-map) (let ... ...)) (let (...) (set-window-buffer win acm-buffer) (set-window-dedicated-p win t))) (acm-menu-render menu-old-cache))))) (t (acm-hide)))
(let* ((gc-cons-threshold most-positive-fixnum) (keyword (acm-get-input-prefix)) (previous-select-candidate-index (+ acm-menu-offset acm-menu-index)) (previous-select-candidate (acm-menu-index-info (acm-menu-current-candidate))) (candidates (or candidate (acm-update-candidates))) (menu-candidates (cl-subseq candidates 0 (min (length candidates) acm-menu-length))) (current-select-candidate-index (cl-position previous-select-candidate (mapcar 'acm-menu-index-info menu-candidates) :test 'equal)) (bounds (acm-get-input-prefix-bound))) (cond ((and (equal (length candidates) 1) (string-equal keyword (plist-get (nth 0 candidates) :label)) (not (member (plist-get (nth 0 candidates) :annotation) '("Emmet Abbreviation" "Snippet" "Yas-Snippet" "Tempel")))) (acm-hide)) ((> (length candidates) 0) (let* ((menu-old-cache (cons acm-menu-max-length-cache acm-menu-number-cache))) (acm-mode 1) (add-hook 'pre-command-hook #'acm--pre-command nil 'local) (set (make-local-variable 'acm-menu-offset) 0) (if (= 0 (length acm-menu-candidates)) (set (make-local-variable 'acm-menu-index) -1) (set (make-local-variable 'acm-menu-index) 0) (if (and current-select-candidate-index (> ... 1)) (progn (cond ... ... ...)))) (set (make-local-variable 'acm-candidates) candidates) (set (make-local-variable 'acm-menu-candidates) menu-candidates) (acm-frame-init-colors) (setq acm-menu-frame-popup-point (or (car bounds) (point))) (if (posn-at-point acm-menu-frame-popup-point) (progn (setq acm-menu-frame-popup-position (acm-frame-get-popup-position acm-menu-frame-popup-point)) (if (and ... ...) (progn ... ...)) (if (frame-live-p acm-menu-frame) nil (setq acm-menu-frame ...) (save-current-buffer ... ... ...) (let ... ... ...)) (acm-menu-render menu-old-cache))))) (t (acm-hide))))
acm-update()
acm-template-candidate-update()
apply(acm-template-candidate-update nil)
timer-event-handler([t 25959 8649 869625 nil acm-template-candidate-update nil nil 927000 nil])

@manateelazycat
Copy link
Owner

你的Emacs主题有问题吧? 我看到了 unspecified-bg

@zqs123q
Copy link
Author

zqs123q commented Nov 30, 2023

我是在终端使用emacs,在mac和linux里试了下,确实是没有默认的背景色。。
emacs -nw -Q
然后
(face-attribute 'default :background)
"unspecified-bg"

这块临时hack下,虽然不报错了,但还是没有补全出来

(defun acm-frame-init-colors (&optional force)
(let* ((is-dark-mode (string-equal (acm-frame-get-theme-mode) "dark"))
(blend-background (if is-dark-mode "#000000" "#AAAAAA"))
(default-background (if (or force (equal (face-attribute 'acm-frame-default-face :background) 'unspecified))
(face-attribute 'default :background)
(face-attribute 'acm-frame-default-face :background)))
(default-background (if (equal default-background "unspecified-bg")
"#f7f7f7"
default-background)))

@manateelazycat
Copy link
Owner

lsp-bridge 的acm菜单不支持终端, 所以弹不出来。

@manateelazycat
Copy link
Owner

原因是, 终端没有菜单对齐的方案, 包括坐标像素级计算API缺少, 导致跨窗口弹出补全菜单没法做到。

@zqs123q
Copy link
Author

zqs123q commented Nov 30, 2023

get了,感谢回复,搜到另外一个acm-terminal,我去试一下

@manateelazycat
Copy link
Owner

acm-terminal 应该已经不支持了, 很久没有维护了。

因为 lsp-bridge 可以直接支持远程服务器代码补全, 建议直接用GUI。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants