Skip to content

Commit aa72674

Browse files
committed
Progress reporting
1 parent 94258bc commit aa72674

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

lsp-java.el

+17-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ The slash is expected at the end."
5151
:group 'lsp-java
5252
:type 'string)
5353

54+
(defvar lsp-java-progress-string ""
55+
"Path of the java executable.")
56+
57+
(defface lsp-java-progress-face
58+
'((t (:inherit 'success)))
59+
"face for activity message"
60+
:group 'lsp-java)
61+
5462
(defcustom lsp-java-workspace-dir (expand-file-name (locate-user-emacs-file "workspace/"))
5563
"LSP java workspace directory."
5664
:group 'lsp-java
@@ -435,8 +443,13 @@ PARAMS the parameters for actionable notifications."
435443
"Progress report handling.
436444
437445
PARAMS progress report notification data."
438-
(let ((inhibit-message lsp-java-inhibit-message))
439-
(lsp-message "%s%s" (gethash "status" params) (if (gethash "complete" params) " (done)" ""))))
446+
(-let [(&hash "status" "complete") params]
447+
(setq lsp-java-progress-string (propertize (s-replace "%" "%%" status) 'face 'lsp-java-progress-face))
448+
(when complete
449+
(run-with-idle-timer 0.8 nil (lambda ()
450+
(setq lsp-java-progress-string nil))))))
451+
452+
(put 'lsp-java-progress-string 'risky-local-variable t)
440453

441454
(defun lsp-java--render-string (str)
442455
"Render STR with `java-mode' syntax highlight."
@@ -857,6 +870,8 @@ PROJECT-URI uri of the item."
857870
(xref--show-xrefs (lsp--locations-to-xref-items refs) nil)
858871
(user-error "No implementations")))
859872

873+
(add-to-list 'global-mode-string (list '(t lsp-java-progress-string)))
874+
860875
(lsp-register-client
861876
(make-lsp--client
862877
:new-connection (lsp-stdio-connection 'lsp-java--ls-command)

0 commit comments

Comments
 (0)