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

introduction of less intrusive eglot--user-error #1054

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,9 @@ treated as in `eglot-dbind'."
,obj-once
,@body)))
(t
(eglot--error "%S didn't match any of %S"
,obj-once
',(mapcar #'car clauses)))))))
(eglot--user-error "%S didn't match any of %S"
Inc0n marked this conversation as resolved.
Show resolved Hide resolved
,obj-once
',(mapcar #'car clauses)))))))


;;; API (WORK-IN-PROGRESS!)
Expand Down Expand Up @@ -1321,6 +1321,11 @@ CONNECT-ARGS are passed as additional arguments to

;;; Helpers (move these to API?)
;;;

(defun eglot--user-error (format &rest args)
"Signal Eglot-specific `user-error' with FORMAT and ARGS."
(user-error "[eglot] %s" (apply #'format format args)))

(defun eglot--error (format &rest args)
"Error out with FORMAT with ARGS."
(error "[eglot] %s" (apply #'format format args)))
Expand Down Expand Up @@ -3135,7 +3140,7 @@ at point. With prefix argument, prompt for ACTION-KIND."
when (or (not action-kind)
(equal action-kind (plist-get action :kind)))
collect (cons (plist-get action :title) action))
(apply #'eglot--error
(apply #'eglot--user-error
(if action-kind `("No \"%s\" code actions here" ,action-kind)
`("No code actions here")))))
(preferred-action (cl-find-if
Expand Down