[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot dfab9a0 011/139: Experimental diagnostic overlays
From: |
João Távora |
Subject: |
[elpa] externals/eglot dfab9a0 011/139: Experimental diagnostic overlays |
Date: |
Mon, 14 May 2018 09:54:42 -0400 (EDT) |
branch: externals/eglot
commit dfab9a08a6b6af099c21f9cd8a99f5a00d81cb4e
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Experimental diagnostic overlays
---
eglot.el | 40 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/eglot.el b/eglot.el
index 479e87a..cd91d78 100644
--- a/eglot.el
+++ b/eglot.el
@@ -414,11 +414,47 @@
;;; Notifications
;;;
+(defvar-local eglot--diagnostic-overlays nil)
+
(cl-defun eglot--textDocument/publishDiagnostics
(_process &key uri diagnostics)
"Handle notification publishDiagnostics"
- (eglot--message "So yeah I got %s for %s"
- diagnostics uri))
+ (let* ((obj (url-generic-parse-url uri))
+ (filename (car (url-path-and-query obj)))
+ (buffer (find-buffer-visiting filename)))
+ (cond
+ (buffer
+ (with-current-buffer buffer
+ (eglot--message "OK so add some %s diags" (length diagnostics))
+ (mapc #'delete-overlay eglot--diagnostic-overlays)
+ (setq eglot--diagnostic-overlays nil)
+ (cl-flet ((pos-at (pos-plist)
+ (save-excursion
+ (goto-char (point-min))
+ (forward-line (plist-get pos-plist :line))
+ (forward-char (plist-get pos-plist :character))
+ (point))))
+ (loop for diag across diagnostics
+ do (cl-destructuring-bind (&key range severity
+ _code _source message)
+ diag
+ (cl-destructuring-bind (&key start end)
+ range
+ (let* ((begin-pos (pos-at start))
+ (end-pos (pos-at end))
+ (ov (make-overlay begin-pos
+ end-pos
+ buffer)))
+ (push ov eglot--diagnostic-overlays)
+ (overlay-put ov 'face
+ (case severity
+ (1 'flymake-errline)
+ (2 'flymake-warnline)))
+ (overlay-put ov 'help-echo
+ message)
+ (overlay-put ov 'eglot--diagnostic diag))))))))
+ (t
+ (eglot--message "OK so %s isn't visited" filename)))))
;;; Helpers
- [elpa] branch externals/eglot created (now 4c0bfc3), João Távora, 2018/05/14
- [elpa] externals/eglot 3a8f9a1 002/139: Remove a couple of comments, João Távora, 2018/05/14
- [elpa] externals/eglot 72895ca 006/139: Handle notifications, João Távora, 2018/05/14
- [elpa] externals/eglot 0222e7e 007/139: Improve `eglot--current-process', João Távora, 2018/05/14
- [elpa] externals/eglot 2775dea 003/139: Rename eglot--continuations eglot--pending-continuations, João Távora, 2018/05/14
- [elpa] externals/eglot c417eb4 009/139: Cancel timeouts when process dies unexpectedly, João Távora, 2018/05/14
- [elpa] externals/eglot 6f0a8df 008/139: Organize a bit, João Távora, 2018/05/14
- [elpa] externals/eglot c222c3b 019/139: Lay groundwork for uniform treatment of network connections, João Távora, 2018/05/14
- [elpa] externals/eglot 3489176 004/139: Add a mode-line construct and some minor fanciness, João Távora, 2018/05/14
- [elpa] externals/eglot dfab9a0 011/139: Experimental diagnostic overlays,
João Távora <=
- [elpa] externals/eglot 16be2fc 020/139: Fix parser to accept multiple messages in one chunk, João Távora, 2018/05/14
- [elpa] externals/eglot 0ec7801 012/139: Simplify `eglot--protocol-initialize`, João Távora, 2018/05/14
- [elpa] externals/eglot 4f246b5 017/139: * eglot.el (eglot-mode-map): Move up before minor mode., João Távora, 2018/05/14
- [elpa] externals/eglot bc011d0 010/139: Minor cleanup, João Távora, 2018/05/14
- [elpa] externals/eglot e60c7fc 013/139: Overhaul async mechanism safety, João Távora, 2018/05/14
- [elpa] externals/eglot a4f99e0 005/139: Introduce and use `eglot--current-process-or-lose', João Távora, 2018/05/14
- [elpa] externals/eglot efd14d6 015/139: Fix mode line, João Távora, 2018/05/14
- [elpa] externals/eglot 63f2208 030/139: Less obstrusive flymake stuff for now, João Távora, 2018/05/14
- [elpa] externals/eglot 8bd634c 016/139: Start working on this again, João Távora, 2018/05/14
- [elpa] externals/eglot 3403f86 027/139: Correctly report what we currently are capable of, João Távora, 2018/05/14