Skip to content

Commit

Permalink
refactor: move copilot-specific capabilities kludge to lsp-copilot.el
Browse files Browse the repository at this point in the history
  • Loading branch information
kassick committed Dec 11, 2024
1 parent 6ebb2fe commit ba7d3b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 6 additions & 1 deletion clients/lsp-copilot.el
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ automatically, browse to %s." user-code verification-uri))
:name "emacs"
:version "0.1.0"))

(defun lsp-copilot--server-initialized-fn (_)
(defun lsp-copilot--server-initialized-fn (workspace)
;; Patch capabilities -- server may respond with an empty dict. In plist,
;; this would become nil
(let ((caps (lsp--workspace-server-capabilities workspace)))
(lsp:set-server-capabilities-inline-completion-provider? caps t))

(unless (lsp-copilot--authenticated-as)
(lsp-copilot-login)))

Expand Down
6 changes: 1 addition & 5 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -7958,11 +7958,7 @@ SESSION is the active session."
('rust-analyzer
(-> capabilities
(lsp:server-capabilities-text-document-sync?)
(lsp:set-text-document-sync-options-save? t)))
;; for copilot-ls, the inlineCompletionProvider will be sent as {}
('copilot-ls
(-> capabilities
(lsp:set-server-capabilities-inline-completion-provider? t))))
(lsp:set-text-document-sync-options-save? t))))

(setf (lsp--workspace-server-capabilities workspace) capabilities
(lsp--workspace-status workspace) 'initialized)
Expand Down

0 comments on commit ba7d3b5

Please sign in to comment.