Skip to content

Commit

Permalink
fix: use lsp-error in case of errors during inline completion
Browse files Browse the repository at this point in the history
  • Loading branch information
kassick committed Dec 5, 2024
1 parent 5475384 commit 44aafbb
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions lsp-inline-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -372,22 +372,24 @@ text range that was updated by the completion"
(unless implicit
(lsp--spinner-start) )

(unwind-protect
(if-let* ((resp (lsp-request-while-no-input "textDocument/inlineCompletion"
(lsp-inline-completion--params implicit)))
(items (lsp-inline-completion--parse-items resp)))

(progn
(lsp-inline-completion--clear-overlay)
(setq lsp-inline-completion--items items)
(setq lsp-inline-completion--current 0)
(setq lsp-inline-completion--start-point (point))
(lsp-inline-completion-show-overlay))
(condition-case err
(unwind-protect
(if-let* ((resp (lsp-request-while-no-input "textDocument/inlineCompletion"
(lsp-inline-completion--params implicit)))
(items (lsp-inline-completion--parse-items resp)))

(progn
(lsp-inline-completion--clear-overlay)
(setq lsp-inline-completion--items items)
(setq lsp-inline-completion--current 0)
(setq lsp-inline-completion--start-point (point))
(lsp-inline-completion-show-overlay))
(unless implicit
(lsp--info "No Suggestions!")))
;; Clean up
(unless implicit
(lsp--info "No Suggestions!")))
;; Clean up
(unless implicit
(lsp--spinner-stop))))
(lsp--spinner-stop)))
(t (lsp--error "Couldnot fetch completions: %s" err))))


;; Inline Completion Mode
Expand Down

0 comments on commit 44aafbb

Please sign in to comment.