Skip to content

Commit dcce464

Browse files
authored
lsp-ui-sideline: display all code actions of the current diagnostics (#790)
* lsp-ui-sideline: display all code actions of the current diagnostics * use LSP APIs to get diagnostics locations to account for LSP_USE_PLISTS
1 parent 9e92f75 commit dcce464

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

lsp-ui-sideline.el

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,13 +619,26 @@ from the language server."
619619
(lsp--registered-capability "textDocument/codeAction")))
620620
(lsp-request-async
621621
"textDocument/codeAction"
622-
(-let (((start . end) (if (eq lsp-ui-sideline-update-mode 'line)
623-
(cons 0 (- eol bol))
624-
(--> (- (point) bol) (cons it it)))))
622+
(-let* ((diagnostics (lsp-ui-sideline--line-diags (1- line-widen)))
623+
((start . end) (cond ((eq lsp-ui-sideline-update-mode 'line)
624+
(cons 0 (- eol bol)))
625+
(diagnostics
626+
(let* ((start (- (point) bol))
627+
(end start))
628+
(mapc
629+
(-lambda
630+
((&Diagnostic
631+
:range (&Range :start (&Position :character c1)
632+
:end (&Position :character c2))))
633+
(setq start (min c1 start))
634+
(setq end (max c2 end)))
635+
diagnostics)
636+
(cons start end)))
637+
(t (--> (- (point) bol) (cons it it))))))
625638
(list :textDocument doc-id
626639
:range (list :start (list :line (1- line-widen) :character start)
627640
:end (list :line (1- line-widen) :character end))
628-
:context (list :diagnostics (lsp-ui-sideline--line-diags (1- line-widen)))))
641+
:context (list :diagnostics diagnostics)))
629642
(lambda (actions)
630643
(when (eq (current-buffer) buffer)
631644
(lsp-ui-sideline--code-actions actions bol eol)))

0 commit comments

Comments
 (0)