From f04ada478f4bfa5637744876f00ff56f85dcf552 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Tue, 21 Jul 2026 00:14:25 -0400 Subject: Update --- src/wasp-overlay.el | 60 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 9 deletions(-) (limited to 'src/wasp-overlay.el') diff --git a/src/wasp-overlay.el b/src/wasp-overlay.el index b62550e7..cc334f8a 100644 --- a/src/wasp-overlay.el +++ b/src/wasp-overlay.el @@ -48,6 +48,7 @@ (when-let* ((pos (window-absolute-pixel-position))) (when (not (equal pos w/overlay-last-cursor)) (setf w/overlay-last-cursor pos) + (w/binary-pub "overlay asset clear" "") (w/binary-pub "overlay info emacs cursor" (s-concat (w/bus-binary-build-length-prefixed (format "%s" (car pos))) @@ -92,7 +93,7 @@ Optionally, make the cells be COLOR." (defface w/overlay-clippy-face '((t :foreground "black" - :font "Terminus (TTF):antialias=false:hinting=false:pixelsize=24" + :font "Terminus (TTF):antialias=false:hinting=false:pixelsize=12" )) "Face for Clippy dialogue." :group 'wasp) @@ -158,17 +159,36 @@ Optionally, make the cells be COLOR." (w/write-line msg 'w/overlay-clippy-face)))) (defun w/overlay-clippy-say (msg) "Have Clippy say MSG." - (w/overlay-clippy-clear) - (w/overlay-clippy-write msg) - (w/overlay-clippy-border t) - (w/show-frame w/overlay-clippy-frame t) - (raise-frame w/overlay-clippy-frame) - (w/overlay-clippy-animate "EXPLAIN") - (setf w/overlay-clippy-speech-timer 10)) + (unless w/overlay-clippy-speech-timer + (w/overlay-clippy-clear) + (w/overlay-clippy-write msg) + (w/overlay-clippy-border t) + (w/show-frame w/overlay-clippy-frame t) + (raise-frame w/overlay-clippy-frame) + (w/overlay-clippy-animate "EXPLAIN") + (setf w/overlay-clippy-speech-timer 10))) +(require 'flymake) (defun w/overlay-clippy-check-events () "Check for events that Clippy should respond to." - ) + (when-let* ((diags (--filter (s-equals? "clippy" (flymake-diagnostic-origin it)) (flymake-diagnostics)))) + (w/overlay-clippy-say + (s-concat + "It looks like you made a mistake.\nWould you like help with that?\n\n" + (s-join "\n" + (--map + (s-concat + (or + (-some->> + (flymake-diagnostic-data it) + (alist-get 'eglot-lsp-diag) + (w/plist-get :range) + (w/plist-get :start) + (w/plist-get :line) + (format "On line %s:\n")) + "") + (flymake-diagnostic-message it)) + diags)))))) (defun w/overlay-clippy-update () "Update Clippy." @@ -189,5 +209,27 @@ Optionally, make the cells be COLOR." w/overlay-clippy-timer (run-with-timer 1 nil #'w/overlay-clippy-timer-run))) +(defun w/overlay-display-asset (type path) + "Indicate to the overlay that it should display an asset of TYPE at PATH." + (w/binary-pub "overlay asset display" + (s-concat + (w/bus-binary-build-length-prefixed type) + (w/bus-binary-build-length-prefixed path)))) +(defun w/overlay-asset-eldoc-display-function (docs interactive) + "Handler for `eldoc-display-functions' (DOCS INTERACTIVE)." + (ignore interactive) + (-each docs + (lambda (doc) + (when-let* ((docstr (format "%s" (car doc)))) + (--each + (s-match-strings-all + (rx bol + "newton-" (group (one-or-more alnum)) ":" (zero-or-more space) + (group (one-or-more printing)) eol) + docstr) + (-when-let ((_ type path) it) + (w/overlay-display-asset type path))))))) +(add-to-list 'eldoc-display-functions #'w/overlay-asset-eldoc-display-function) + (provide 'wasp-overlay) ;;; wasp-overlay.el ends here -- cgit v1.3.1