Skip to content

Commit d380187

Browse files
committed
feat: display all code actions of the current diagnostics - by @taquangtrung
1 parent 25f7a33 commit d380187

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

sideline-lsp.el

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,26 @@ Execute CALLBACK to display candidates in sideline."
125125
(doc-id (lsp--text-document-identifier)))
126126
(lsp-request-async
127127
"textDocument/codeAction"
128-
(-let (((start . end) (if (eq sideline-lsp-update-mode 'line)
129-
(cons 0 (- eol bol))
130-
(--> (- (point) bol) (cons it it)))))
128+
(-let* ((diagnostics (sideline-lsp--line-diags (1- line-widen)))
129+
((start . end) (cond ((eq sideline-lsp-update-mode 'line)
130+
(cons 0 (- eol bol)))
131+
(diagnostics
132+
(let* ((start (- (point) bol))
133+
(end start))
134+
(mapc
135+
(-lambda
136+
((&Diagnostic
137+
:range (&Range :start (&Position :character c1)
138+
:end (&Position :character c2))))
139+
(setq start (min c1 start))
140+
(setq end (max c2 end)))
141+
diagnostics)
142+
(cons start end)))
143+
(t (--> (- (point) bol) (cons it it))))))
131144
(list :textDocument doc-id
132145
:range (list :start (list :line (1- line-widen) :character start)
133146
:end (list :line (1- line-widen) :character end))
134-
:context (list :diagnostics (sideline-lsp--line-diags (1- line-widen)))))
147+
:context (list :diagnostics diagnostics)))
135148
(lambda (actions)
136149
(when (eq (current-buffer) buffer)
137150
(sideline-lsp--code-actions callback actions)))

0 commit comments

Comments
 (0)