Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp-copilot: Replace LSP server with the official GitHub one #4710

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions clients/lsp-copilot.el
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"Copilot LSP configuration"
:group 'lsp-mode
:tag "Copilot LSP"
:link '(url-link "https://www.npmjs.com/package/copilot-node-server"))
:link '(url-link "https://www.npmjs.com/package/@github/copilot-language-server"))

(defcustom lsp-copilot-enabled nil
"Whether the server should be started to provide completions."
Expand All @@ -48,7 +48,7 @@
:type '(repeat string)
:group 'lsp-copilot)

(defcustom lsp-copilot-executable "copilot-lsp"
(defcustom lsp-copilot-executable "copilot-language-server"
"The system-wise executable of lsp-copilot.
When this executable is not found, you can stil use
lsp-install-server to fetch an emacs-local version of the LSP."
Expand All @@ -71,16 +71,16 @@ The input are the file name and the major mode of the buffer."
:type 'boolean
:group 'lsp-copilot)

(defcustom lsp-copilot-version "1.41.0"
(defcustom lsp-copilot-version "1.270.0"
"Copilot version."
:type '(choice (const :tag "Latest" nil)
(string :tag "Specific Version"))
:group 'lsp-copilot)

(lsp-dependency 'copilot-ls
`(:system ,lsp-copilot-executable)
'(:npm :package "copilot-node-server"
:path "copilot-node-server"
'(:npm :package "@github/copilot-language-server"
:path "copilot-language-server"
:version lsp-copilot-version))

(defun lsp-copilot--find-active-workspaces ()
Expand Down Expand Up @@ -211,6 +211,7 @@ automatically, browse to %s." user-code verification-uri))
("$/progress" (lambda (&rest args) (lsp-message "$/progress with %S" args)))
("featureFlagsNotification" #'ignore)
("statusNotification" #'ignore)
("didChangeStatus" #'ignore)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4708 (comment)

I'm seeing a bunch of Warning (lsp-mode): Unknown notification: didChangeStatus messages. Not too familiar w/ LSP, but do we need to set up some additional handling for these notifications?

https://github.com/orgs/github/packages/npm/package/copilot-language-server

The status is sent to the client as a didChangeStatus notification. Typically this would be conveyed to the user in a status bar icon or other UI affordance.

I think it would be fine to simply ignore it for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didChangeStatus does not seem to be a LSP (the protocol) standard notification, it's copilot-specific.

From https://www.npmjs.com/package/@github/copilot-language-server :

Status Notification

The status is sent to the client as a didChangeStatus notification. Typically this would be conveyed to the user in a status bar icon or other UI affordance.

Notification includes the following fields:

message - a string describing the status (can be empty)
kind - status of the language server:
    'Normal' - When everything is working normally.
    'Error' - When not authorized and authenticated.
    'Warning' - When there is a temporary issue, such as a failed HTTP request.
    'Inactive' - When the current file is ignored due to file size or content exclusions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to handle this due to the Inactive kind -- it'd be good to know that a given file is not getting completions because of token limits ...

Copy link

@dylnclrk dylnclrk Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New to emacs dev, but would you just want to print messages to the lsp log buffer when you get the inactive messages?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly yes -- use lsp--info, --error, --warn -- that'll make to the lsp-mode log buffer and to the minibuffer, so the user has some visual feedback

("window/logMessage" #'lsp--window-log-message)
("conversation/preconditionsNotification" #'ignore))))

Expand Down
Loading