-
Notifications
You must be signed in to change notification settings - Fork 128
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: Install server #247
feat: Install server #247
Conversation
(defcustom copilot-version "1.14.0" | ||
"Copilot version." | ||
:type 'string | ||
:group 'copilot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made this variable customizable so the user can choose what version to install.
As part of this PR, we would also get rid of the |
@emil-vdw
|
@jcs090218 |
@emil-vdw After giving it another thought, I realized that this step can be skipped. It's okay to delete |
What if we prompt the user to install the server when it's not yet installed in the new location? This is much more straightforward IMO. 🤔 Then we can remove
👍 Done. |
@jcs090218 Very cool! You solved the long-term issue! One last request: |
Actually, I need someone to test on Unix-like system (linux or macOS), because I'm using Windows now. 😂 I assumed it will work since the code are dragged directly from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few concerns:
- The reliability of the
copilot-node-server
npm package. Can we trust it to be available, up-to-date and not to be hijacked? Should we investigate whether to pull the agent distributables straight from the corresponding github tag of the officialcopilot.vim
repo? - The fact that at some point a mismatch between the minimum required server version and
copilot.el
version will break the plugin (see comment below).
Co-authored-by: Emil van der Westhuizen <[email protected]>
Co-authored-by: Emil van der Westhuizen <[email protected]>
I don't know much about the upstream |
I'm not sure but those examples may be using official distributions (albeit through npm). The copilot vim is an official github owned (official copilot) repository so it can be relied upon. The npm package being installed by us through npm is not official and we should at least strongly consider pulling from the official distribution instead. In my opinion there should be very good reasons for using the unofficial distribution instead. |
Ah, okay. I thought |
I found the npm package Maybe we can use it for now and later switch to our own NPM package. |
Yeah, I second this. It would take me some time to do this. Plus, it would make this PR too big if it was implemented in the same PR. 😅 |
@jcs090218 I have added some commits to fix some bugs and support Linux. I don't have access to push to your branch though. |
Fixes for Linux
Merged! :) |
Would you mind testing those changes on Windows again as well? |
Yeah, it works now! :) |
copilot.el
Outdated
@@ -245,27 +246,27 @@ Please upgrade the server via `M-x copilot-reinstall-server`")) | |||
"Login to Copilot." | |||
(interactive) | |||
(copilot--dbind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest are indentation errors.
I've made the changes to this PR. Can we merge this? 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to pull main (jsonrpc error handling changes).
Thank you for all of your work on this project! You should have write access now and I will make sure you can merge without review (although try to get a review when practicable).
(cond | ||
((null copilot-node-executable) | ||
(user-error "Could not find node executable")) | ||
((not (file-exists-p copilot-install-dir)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This did not catch the condition correctly when I uninstalled the copilot server (this directory is still present). Maybe make it more reliable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you uninstall the server? 🤔 The copilot-install-dir
will be gone if you uninstall it through M-x copilot-uninstall-server
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah that makes sense. I did:
npm -g --prefix ~/.emacs.d/.cache/copilot uninstall copilot-node-server
Co-authored-by: Emil van der Westhuizen <[email protected]>
Co-authored-by: Emil van der Westhuizen <[email protected]>
Shall we do the cleanup in a subsequent PR @jcs090218 @zerolfx? |
I think it's fine to clean up in a subsequent PR. Feel free to merge 👍. |
this seems to install (or try to start) copilot server at the wrong location:
the extra |
You are right. It's weird since I did applied the change but it some how got reverted. 🤔 I'm on it. |
FYI, I've opened the fix in #267. However, I cannot merge PRs without other maintainer's approval. Therefore, the current workaround is to update (setq copilot--server-executable (f-join copilot-install-dir "node_modules" "copilot-node-server" "bin" "copilot-node-server")) |
When opening emacs with this PR I get the following it complains that I should use |
Can you try Edit: make sure you've updated to the latest version. |
Indeed, I get this with main but don't get it if I checkout right before this PR |
I've made the fix in #268. Thanks for the bug report! |
For #120.