Skip to content

Commit d904e8a

Browse files
authored
Add support for workspace/codeLens/refresh (#3047)
1 parent c3308a8 commit d904e8a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lsp-lens.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,13 @@ CALLBACK - callback for the lenses."
309309
(funcall callback lsp-lens--backend-cache lsp--cur-version)
310310
(lsp-lens--backend-fetch-missing lsp-lens--backend-cache callback lsp--cur-version)))))
311311

312+
(defun lsp--lens-on-refresh (workspace)
313+
"Clear lens within all buffers of WORKSPACE, refreshing all workspace buffers."
314+
(cl-assert (not (eq nil workspace)))
315+
(cl-loop
316+
for ws-buffer in (lsp--workspace-buffers workspace) do
317+
(lsp-lens-refresh t ws-buffer)))
318+
312319
;;;###autoload
313320
(defun lsp-lens--enable ()
314321
"Enable lens mode."

lsp-mode.el

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3347,7 +3347,7 @@ disappearing, unset all the variables related to it."
33473347
(workspaceFolders . t)
33483348
(configuration . t)
33493349
,@(when lsp-semantic-tokens-enable '((semanticTokens . ((refreshSupport . t)))))
3350-
,@(when lsp-lens-enable '((codeLens . ((refreshSupport . :json-false)))))
3350+
,@(when lsp-lens-enable '((codeLens . ((refreshSupport . t)))))
33513351
(fileOperations . ((didCreate . :json-false)
33523352
(willCreate . :json-false)
33533353
(didRename . :json-false)
@@ -6181,6 +6181,11 @@ WORKSPACE is the active workspace."
61816181
(fboundp 'lsp--semantic-tokens-on-refresh))
61826182
(lsp--semantic-tokens-on-refresh workspace))
61836183
nil)
6184+
((equal method "workspace/codeLens/refresh")
6185+
(when (and lsp-lens-enable
6186+
(fboundp 'lsp--lens-on-refresh))
6187+
(lsp--lens-on-refresh workspace))
6188+
nil)
61846189
(t (lsp-warn "Unknown request method: %s" method) nil))))
61856190
;; Send response to the server.
61866191
(unless (eq response 'delay-response)

0 commit comments

Comments
 (0)