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

feat: Use the latest server #305

Closed
wants to merge 3 commits into from
Closed

Conversation

jcs090218
Copy link
Member

Fix #304.

@alexmurray
Copy link
Contributor

I have tried using copilot 1.30.0 locally with copilot.el and it fails to work correctly - ie it doesn't appear to return any completions, and when running copilot-diagnose I see the following:

Copilot error: (:code -32002 :message "Agent service not initialized.")

it looks like a significant reworking of the protocol between the local nodejs server and the client (either in vim or emacs) happened in the 1.28.0 release - see github/copilot.vim@f45ecd9 for details - so I think copilot.el would need similar updates to work with this newer version

@jidicula
Copy link
Contributor

jidicula commented May 27, 2024

it looks like a significant reworking of the protocol between the local nodejs server and the client (either in vim or emacs) happened in the 1.28.0 release - see github/copilot.vim@f45ecd9 for details - so I think copilot.el would need similar updates to work with this newer version

could the default be brought forward to 1.27.0 perhaps?

edit: I've opened #314

jidicula added a commit to jidicula/copilot.el that referenced this pull request Jun 8, 2024
@kassick
Copy link

kassick commented Jul 8, 2024

Looking at the code of the vim plugin, it looks like the node server is a LSP server with support for textDocument/inlineCompletion. One option would be to let lsp-mode handle all the I/O (such as here and make the UI simply interact with it

Wrapping the lsp-inline-completion in a with-lsp-workspace workspace would ensure that only result from the target server are called:

(defun copilot-inline-completions ()
  (interactive)

  (-when-let (workspace (--some (lsp-find-workspace it (buffer-file-name))
                               '(copilot-lsp copilot-lsp-remote)))

        (with-lsp-workspace workspace (lsp-inline-completion))))

I'll try to run the node server with lsp-mode and I'll let you know if it worked as expected

@kassick
Copy link

kassick commented Jul 11, 2024

Yup, it kinda works -- https://github.com/kassick/copilot-lsp

copilot-lsp + gitlab-lsp + lsp-inline-completions (plus an upstream fix to lsp-mode) displays the inline completions

@jcs090218
Copy link
Member Author

jcs090218 commented Jul 11, 2024

could the default be brought forward to 1.27.0 perhaps?

@jidicula Does it solve the issue if we used this version? 🤔

@kassick
Copy link

kassick commented Jul 11, 2024

@jidicula Does it solve the issue if we used this version? 🤔

the issue as in "it starts when using the latest version of the server"? I'm using version 1.37.0 -- it starts, it completes when asking for inlineCompletions, so, for this, it does.

But the solution in my repo goes in a rather different direction -- use lsp-mode to do the I/O, instead of using json-rpc. It lets all the typical issues (document sync, start/restart, callbacks after completion, etc.) to lsp-mode to handle.

One may try to backport the relevant portions of lsp-mode to copilot.el or go in the direction I went in the POC -- I'm not certain which is best, TBH.

(it the issue is the reason why this MR was trying to upgrade to >=1.30.0, then I have no idea, sorry ;) )

jcs090218 pushed a commit that referenced this pull request Aug 6, 2024
@jcs090218 jcs090218 closed this Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update copilot-version
5 participants