-
Notifications
You must be signed in to change notification settings - Fork 166
Find and run the server locally #404
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
Changes from 2 commits
89e6b8d
3004101
07aa83d
6c54280
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ | |
|
|
||
| (require 'cl-lib) | ||
| (require 'compile) | ||
| (require 'files) | ||
| (require 'json) | ||
| (require 'jsonrpc) | ||
| (require 'subr-x) | ||
|
|
@@ -316,14 +317,14 @@ Incremented after each change.") | |
| ((and (file-name-absolute-p copilot-server-executable) | ||
| (file-exists-p copilot-server-executable)) | ||
| copilot-server-executable) | ||
| ((executable-find copilot-server-executable t)) | ||
| ((executable-find copilot-server-executable nil)) | ||
| (t | ||
| (let ((path (executable-find | ||
| (f-join copilot-install-dir | ||
| (cond ((eq system-type 'windows-nt) "") | ||
| (t "bin")) | ||
| copilot-server-executable) | ||
| t))) | ||
| nil))) | ||
|
||
| (unless (and path (file-exists-p path)) | ||
| (error "The package %s is not installed. Unable to find %s" | ||
| copilot-server-package-name path)) | ||
|
|
@@ -360,7 +361,10 @@ Incremented after each change.") | |
| (defun copilot-install-server () | ||
| "Interactively install server." | ||
| (interactive) | ||
| (if-let* ((npm-binary (executable-find "npm"))) | ||
| (if-let* ((default-directory (if (file-remote-p default-directory) | ||
|
||
| "~/" | ||
| default-directory)) | ||
| (npm-binary (executable-find "npm"))) | ||
| (progn | ||
| (make-directory copilot-install-dir 'parents) | ||
| (copilot-async-start-process | ||
|
|
@@ -462,10 +466,9 @@ SUCCESS-FN is the CALLBACK." | |
|
|
||
| (defun copilot--start-server () | ||
| "Start the copilot server process in local." | ||
| (cond | ||
| ((not (file-exists-p (copilot-server-executable))) | ||
| (user-error "Server is not installed, please install via `M-x copilot-install-server`")) | ||
| (t | ||
| (let ((default-directory (if (file-remote-p default-directory) | ||
| "~/" | ||
| default-directory))) | ||
| (let ((installed-version (copilot-installed-version))) | ||
| (when (and copilot-version (not (equal installed-version copilot-version))) | ||
| (warn "This package has been tested for Copilot server version %s but version %s has been detected. | ||
|
|
@@ -481,7 +484,7 @@ You can change the installed version with `M-x copilot-reinstall-server` or remo | |
| `( :editorInfo (:name "Emacs" :version ,emacs-version) | ||
| :editorPluginInfo (:name "copilot.el" :version ,(or (copilot-installed-version) "unknown")) | ||
| ,@(when copilot-network-proxy | ||
| `(:networkProxy ,copilot-network-proxy))))))) | ||
| `(:networkProxy ,copilot-network-proxy)))))) | ||
|
|
||
| ;; | ||
| ;; login / logout | ||
|
|
||
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.
You can just remove this param - it's optional.
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.
fixed