copilot-emacs / copilot.el Goto Github PK
View Code? Open in Web Editor NEWAn unofficial Copilot plugin for Emacs.
License: MIT License
An unofficial Copilot plugin for Emacs.
License: MIT License
Hi,
thank you so much for putting this together and sharing.
If I start emacs and open a remote file via Tramp, copilot.el complaints it does not find node. I assume it is because it's looking for the node executable on the remote machine (via locate-file).
Would setting default-directory
to ~
within copilot--start-agent
cause any problems, or do you think that'd be an appropriate solution for this issue?
Thank you
When I first start emacs and try to login I get error: No applicable method: jsonrpc--request-continuations, nil
Then I run copilot-diagnose
and get "NotSignedIn" error. Then if I retry copilot-login
I get: jsonrpc-error: "request id=4 failed:", (jsonrpc-error-code . -32602), (jsonrpc-error-message . "Invalid params: must be object"), (jsonrpc-error-data)
Copilot-events:
[client-request] (id:1) Sun Jun 5 23:38:04 2022:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
(:capabilities 'nil))
[server-notification] Sun Jun 5 23:38:05 2022:
(:jsonrpc "2.0" :method "LogMessage" :params
(:level 0 :message "[DEBUG] [agent] [2022-06-05T21:38:05.280Z] Agent service starting" :metadataStr "[DEBUG] [agent] [2022-06-05T21:38:05.280Z]" :extra
["Agent service starting"]))
[server-reply] (id:1) Sun Jun 5 23:38:05 2022:
(:jsonrpc "2.0" :id 1 :result
(:capabilities
(:textDocumentSync
(:openClose t :change 2)
:workspace
(:workspaceFolders
(:supported :json-false :changeNotifications :json-false)))))
[client-request] (id:2) Sun Jun 5 23:38:05 2022:
(:jsonrpc "2.0" :id 2 :method "setEditorInfo" :params
(:editorInfo
(:name "Emacs" :version "25.2.2")
:editorPluginInfo
(:name "copilot.el" :version "0.9.2")))
[client-request] (id:3) Sun Jun 5 23:38:05 2022:
(:jsonrpc "2.0" :id 3 :method "getCompletions" :params
(:doc
(:source "\n" :path "" :uri "" :relativePath "" :languageId "text" :position
(:line 0 :character 0))))
[server-reply] (id:2) Sun Jun 5 23:38:05 2022:
(:jsonrpc "2.0" :id 2 :result "OK")
[server-reply] (id:3) ERROR Sun Jun 5 23:38:05 2022:
(:jsonrpc "2.0" :id 3 :error
(:code 1000 :message "Not authenticated: NotSignedIn"))
[client-request] (id:4) Sun Jun 5 23:38:11 2022:
(:jsonrpc "2.0" :id 4 :method "signInInitiate" :params 'nil)
[server-reply] (id:4) ERROR Sun Jun 5 23:38:11 2022:
(:jsonrpc "2.0" :id 4 :error
(:code -32602 :message "Invalid params: must be object"))
Copilot tends to provide one/multiple lines of completion at a single time.
Sometimes, it is useful to only accept the first few words of suggestion. This is particularly true when writing documentation/prose where I often want to use the copilot completion for difficult error-prone spellings and words.
So, I was wondering if it would be possible to give a prefix argument while hitting the tab key (or other key bound to copilot-accept-completion
to only accept the first x words.
I guess this might be related to copilot.el,, as the emacs would hang, at least twice when I press ESC to reject the suggestions from the copilot. Since the emacs hanged, I have no means to further investigate.
Please let me know how I can investigate further if it's related to copilot.el
I disabled the copilot by M-x copilot-mode for the same buffer/file.
At the same file location, I no longer see the problem.
Hello! Thank you very much for your package, it is really helpful. But about a week ago I encountered a problem:
[INFO] Completion: ((error (code . -32603) (message . "Request getCompletions failed with message: No instance of has been registered.
Context created at:
at new t.Context (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:378830)
at t.createRequestContext (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:325059)
at E (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:335165)
at t.handleGetCompletions (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:335934)
at w.messageHandler (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:359578)
at /Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:2:12978
at /Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:2:14006
at Immediate._onImmediate (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:2:16978)
at processImmediate (node:internal/timers:466:21)
Context created at:
at new t.Context (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:378830)
at new w (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:358230)
at /Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:707481
at /Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:707516
at /Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:707520
at Object.<anonymous> (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:707541)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
Context created at:
at new t.Context (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:378830)
at t.init (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:331234)
at /Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:707414
at /Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:707516
at /Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:707520
at Object.<anonymous> (/Users/darkawower/.emacs.d/.local/straight/repos/copilot.el/dist/agent.js:8:707541)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
")))
Before this message, everything was working fine. I tried reinstalling copilot, logging in again, but to no avail.
My configuration (but actually, I think this problem is independent of my configuration):
(use-package copilot
:defer 1
:bind
("s-]" . copilot-next-completion)
("s-[" . copilot-previous-completion)
("s-l" . copilot-accept-completion)
("s-j" . copilot-complete)
:custom
(copilot-idle-delay 0.3)
:config
(setq copilot--previous-point nil)
(setq copilot--previous-window-width nil)
(defun copilot--preserve-positions ()
(setq copilot--previous-point (point))
(setq copilot--previous-window-width (blamer--real-window-width)))
(defun copilot--positions-changed-p ()
(or (not (equal (point) copilot--previous-point))
(not (equal (window-width) copilot--previous-window-width))))
(defun copilot--rerender ()
(when-let ((copilot--changed (copilot--positions-changed-p)))
(copilot-clear-overlay)
(copilot--preserve-positions)
(blamer--clear-overlay)
(when (evil-insert-state-p) (copilot-complete))))
(add-hook 'post-command-hook #'copilot--rerender)
(add-hook 'evil-insert-state-exit-hook 'copilot-clear-overlay)
(add-hook 'evil-insert-state-entry-hook (lambda ()
(setq blamer--block-render-p t)
(blamer--clear-overlay))))
Hi there!
First and foremost, thanks a lot for this! copilot.el rocks!!
I downloaded and configured copilot.el under doomemacs and it runs perfectly. I can login and also enable it in any buffer. I have tried it using different langs and I'm very satisfied with the result.
However, a key difference with copilot running in other IDEs is that it provides assistance there as the user is typing in. Here, I have to M-x copilot-complete every time I want a suggestion to pop up.
I carefully followed the instructions given for doom emacs in the Installation paragraph, and I also verified that copilot-idle-delay is set to 0. I also updated my working copy of copilot.el and I'm currently running the very last changeset.
A typical view of copilot events after completing once follows (in case this helps):
[client-request] (id:6) Sun Oct 16 00:05:32 2022:
(:jsonrpc "2.0" :id 6 :method "notifyAccepted" :params
(:uuid "d9ea9773-be62-4bf2-828c-8017b2c62de5"))
[client-request] (id:7) Sun Oct 16 00:05:32 2022:
(:jsonrpc "2.0" :id 7 :method "notifyRejected" :params
(:uuids
["d9ea9773-be62-4bf2-828c-8017b2c62de5"]))
[server-reply] (id:6) Sun Oct 16 00:05:32 2022:
(:jsonrpc "2.0" :id 6 :result "OK")
[server-reply] (id:7) Sun Oct 16 00:05:32 2022:
(:jsonrpc "2.0" :id 7 :result "OK")
There is no stderr buffer so I guess this is all the information I can provide but if other is necessary I would be more than happy to provide it.
Thanks a lot!
Hi!
Thank you for the great plugin, works flawlessly. I have one issue though, sometimes I want to disable the plugin and I don't know if there's an easy way to do it. For now, I've been commenting out the section that loads your plugin and restart emacs. I would like to see a functionality that does the following:
Is there anything that allows me to do these already? Otherwise, can you either add them or point me towards the direction to implement them and possibly make a PR?
Thanks in advance!
(use-package copilot
:config
(define-key copilot-completion-map (kbd "C-c") 'copilot-accept-completion)
(define-key copilot-completion-map (kbd "C-l") 'copilot-accept-completion-line)
(define-key copilot-completion-map (kbd "C-w") 'copilot-accept-completion-word)
(define-key copilot-completion-map (kbd "C-n") 'copilot-next-completion)
(define-key copilot-completion-map (kbd "C-p") 'copilot-previous-completion)
:hook (prog-mode . copilot-mode))
好处是设置了独立的键位绑定,不再需要配置 company 和 evil,完全解耦。
Last week I was using commit 73487d6 without much issue. Updated today, and most instances where a single-character triggers a company-mode popup from gopls along with a suggestion from copilot, Emacs freezes and starts eating 98% CPU. Pressing C-g
about 10-15 times eventually makes it wake up.
If I revert to 73487d6 it does not behave this way.
I don't have time to dig too deep into the issue at the moment, but happy to provide more details and/or test/debug things when I have time later today.
For now though, here's my config for various pieces:
TL;DR:
company-mode
is modified to not show previews but still show popup if there's only a single-result, and has a default company-minimum-prefix-length
set to 2
.go-mode
has lsp-mode
enabled, and company-minimum-prefix-length
overridden to 1
.copilot-mode
is enabled for all prog-mode
derived modes, but I use C-<tab>
or <backtab>
instead of regular <tab>
to accept copilot suggestions, as I quite often prefer the suggestion from the language server shown via company-mode.Hi,
Suddenly, it shows below errors and stop works
Debugger entered--Lisp error: (wrong-type-argument listp ":0,")
alist-get(result ":0,")
(let* ((result (alist-get 'result content)) (err (alist-get 'error content)) (id (alist-get 'id content))) (if err (progn (copilot--log "[ERROR] Error in response: %S\n[ERROR] Response:%S\n" err content))) (if (not id) (if (equal (alist-get 'method content) "LogMessage") (copilot--log "[Agent] %s" (alist-get 'message (alist-get 'params content))) (copilot--log "[INFO] Discard message without id: %S" content)) (funcall (alist-get id copilot--callbacks) (cons (cons 'error err) result)) (assq-delete-all id copilot--callbacks)))
copilot--process-response(":0,")
(if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content))
(let ((content (condition-case nil (progn (json-read-from-string content)) (error nil)))) (if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content)))
(let ((content (decode-coding-string (substring (encode-coding-string copilot--output-buffer 'raw-text) (length header) full-length) 'utf-8))) (setq copilot--output-buffer (decode-coding-string (substring (encode-coding-string copilot--output-buffer 'raw-text) full-length) 'utf-8)) (let ((content (condition-case nil (progn (json-read-from-string content)) (error nil)))) (if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content))) (copilot--process-filter process nil))
(progn (let ((content (decode-coding-string (substring (encode-coding-string copilot--output-buffer 'raw-text) (length header) full-length) 'utf-8))) (setq copilot--output-buffer (decode-coding-string (substring (encode-coding-string copilot--output-buffer 'raw-text) full-length) 'utf-8)) (let ((content (condition-case nil (progn (json-read-from-string content)) (error nil)))) (if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content))) (copilot--process-filter process nil)))
(if (>= (length copilot--output-buffer) full-length) (progn (let ((content (decode-coding-string (substring (encode-coding-string copilot--output-buffer ...) (length header) full-length) 'utf-8))) (setq copilot--output-buffer (decode-coding-string (substring (encode-coding-string copilot--output-buffer 'raw-text) full-length) 'utf-8)) (let ((content (condition-case nil (progn ...) (error nil)))) (if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content))) (copilot--process-filter process nil))))
(let* ((header (car header-match)) (content-length (string-to-number (car (cdr header-match)))) (full-length (+ (length header) content-length))) (if (>= (length copilot--output-buffer) full-length) (progn (let ((content (decode-coding-string (substring ... ... full-length) 'utf-8))) (setq copilot--output-buffer (decode-coding-string (substring (encode-coding-string copilot--output-buffer ...) full-length) 'utf-8)) (let ((content (condition-case nil ... ...))) (if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content))) (copilot--process-filter process nil)))))
(progn (let* ((header (car header-match)) (content-length (string-to-number (car (cdr header-match)))) (full-length (+ (length header) content-length))) (if (>= (length copilot--output-buffer) full-length) (progn (let ((content (decode-coding-string ... ...))) (setq copilot--output-buffer (decode-coding-string (substring ... full-length) 'utf-8)) (let ((content ...)) (if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content))) (copilot--process-filter process nil))))))
(if header-match (progn (let* ((header (car header-match)) (content-length (string-to-number (car (cdr header-match)))) (full-length (+ (length header) content-length))) (if (>= (length copilot--output-buffer) full-length) (progn (let ((content ...)) (setq copilot--output-buffer (decode-coding-string ... ...)) (let (...) (if content ... ...)) (copilot--process-filter process nil)))))))
(if (and (not header-match) (> (length copilot--output-buffer) 50)) (progn (copilot--log "[Warning] Copilot agent output buffer reset.") (copilot--log "[Warning] Before reset: %S\n" copilot--output-buffer) (setq copilot--output-buffer nil)) (if header-match (progn (let* ((header (car header-match)) (content-length (string-to-number (car ...))) (full-length (+ (length header) content-length))) (if (>= (length copilot--output-buffer) full-length) (progn (let (...) (setq copilot--output-buffer ...) (let ... ...) (copilot--process-filter process nil))))))))
(let ((header-match (s-match "^Content-Length: \\([0-9]+\\)\15?\n\15?\n" copilot--output-buffer))) (if (and (not header-match) (> (length copilot--output-buffer) 50)) (progn (copilot--log "[Warning] Copilot agent output buffer reset.") (copilot--log "[Warning] Before reset: %S\n" copilot--output-buffer) (setq copilot--output-buffer nil)) (if header-match (progn (let* ((header (car header-match)) (content-length (string-to-number ...)) (full-length (+ ... content-length))) (if (>= (length copilot--output-buffer) full-length) (progn (let ... ... ... ...))))))))
copilot--process-filter(#<process copilot-agent> nil)
(let ((content (decode-coding-string (substring (encode-coding-string copilot--output-buffer 'raw-text) (length header) full-length) 'utf-8))) (setq copilot--output-buffer (decode-coding-string (substring (encode-coding-string copilot--output-buffer 'raw-text) full-length) 'utf-8)) (let ((content (condition-case nil (progn (json-read-from-string content)) (error nil)))) (if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content))) (copilot--process-filter process nil))
(progn (let ((content (decode-coding-string (substring (encode-coding-string copilot--output-buffer 'raw-text) (length header) full-length) 'utf-8))) (setq copilot--output-buffer (decode-coding-string (substring (encode-coding-string copilot--output-buffer 'raw-text) full-length) 'utf-8)) (let ((content (condition-case nil (progn (json-read-from-string content)) (error nil)))) (if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content))) (copilot--process-filter process nil)))
(if (>= (length copilot--output-buffer) full-length) (progn (let ((content (decode-coding-string (substring (encode-coding-string copilot--output-buffer ...) (length header) full-length) 'utf-8))) (setq copilot--output-buffer (decode-coding-string (substring (encode-coding-string copilot--output-buffer 'raw-text) full-length) 'utf-8)) (let ((content (condition-case nil (progn ...) (error nil)))) (if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content))) (copilot--process-filter process nil))))
(let* ((header (car header-match)) (content-length (string-to-number (car (cdr header-match)))) (full-length (+ (length header) content-length))) (if (>= (length copilot--output-buffer) full-length) (progn (let ((content (decode-coding-string (substring ... ... full-length) 'utf-8))) (setq copilot--output-buffer (decode-coding-string (substring (encode-coding-string copilot--output-buffer ...) full-length) 'utf-8)) (let ((content (condition-case nil ... ...))) (if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content))) (copilot--process-filter process nil)))))
(progn (let* ((header (car header-match)) (content-length (string-to-number (car (cdr header-match)))) (full-length (+ (length header) content-length))) (if (>= (length copilot--output-buffer) full-length) (progn (let ((content (decode-coding-string ... ...))) (setq copilot--output-buffer (decode-coding-string (substring ... full-length) 'utf-8)) (let ((content ...)) (if content (copilot--process-response content) (copilot--log "[ERROR] Failed to parse response: %S" content))) (copilot--process-filter process nil))))))
(if header-match (progn (let* ((header (car header-match)) (content-length (string-to-number (car (cdr header-match)))) (full-length (+ (length header) content-length))) (if (>= (length copilot--output-buffer) full-length) (progn (let ((content ...)) (setq copilot--output-buffer (decode-coding-string ... ...)) (let (...) (if content ... ...)) (copilot--process-filter process nil)))))))
(if (and (not header-match) (> (length copilot--output-buffer) 50)) (progn (copilot--log "[Warning] Copilot agent output buffer reset.") (copilot--log "[Warning] Before reset: %S\n" copilot--output-buffer) (setq copilot--output-buffer nil)) (if header-match (progn (let* ((header (car header-match)) (content-length (string-to-number (car ...))) (full-length (+ (length header) content-length))) (if (>= (length copilot--output-buffer) full-length) (progn (let (...) (setq copilot--output-buffer ...) (let ... ...) (copilot--process-filter process nil))))))))
(let ((header-match (s-match "^Content-Length: \\([0-9]+\\)\15?\n\15?\n" copilot--output-buffer))) (if (and (not header-match) (> (length copilot--output-buffer) 50)) (progn (copilot--log "[Warning] Copilot agent output buffer reset.") (copilot--log "[Warning] Before reset: %S\n" copilot--output-buffer) (setq copilot--output-buffer nil)) (if header-match (progn (let* ((header (car header-match)) (content-length (string-to-number ...)) (full-length (+ ... content-length))) (if (>= (length copilot--output-buffer) full-length) (progn (let ... ... ... ...))))))))
copilot--process-filter(#<process copilot-agent> "[ERROR] [restraint] [2022-05-26T08:22:28.178Z] No ...")
Part of copilot-log
buffer
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-26T08:22:33.583Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Completion: ((error) (completions . []))
Seems the format of copilot server return value is not what expected by the program?
If any more information needed, just post here, thanks for the great plugin ;)
I see that one of the recent pr #7 introduces a dependency.
First of all, thank you for this amazing package!
Steps to reproduce:
test.el
with global-copilot-mode enabled(defun test () nil)
and press Enter(defun test2 () nil)
.I understand that you need to add empty lines at the step 3 for a suggestion to be shown, so I'm just wondering if it is possible to remove them when the suggestion is dismissed.
The following piece of code doesn't turn off copilot globally. I'd like to be able to enable it whenever I need it, not have it constantly on.
;; enable copilot manually
(after! copilot
(global-copilot-mode -1))
The expected output should be that the minor mode is turned off for every buffer, however this is not the case.
Hi! Thank you for your work with this package.
I was trying to use this package, but I am hitting an issue when running the copilot-login
command.
I invoke the command, am given the 8 letter code, input it into the browser, come back to the editor and accept the telemetry-terms and then it fails with the following error:
Copilot: Authenticated as GitHub user Failed to get user info.
If I run copilot-diagnose
after it fails I get the following error:
Copilot agent: Running, Network: Server connectivity error, Access: OK
But then, if I run it again it returns:
Copilot agent: Running, Network: OK, Access: OK
And it will return that every time except the first time after it fails the copilot-login
command.
Below is the output from the *Messages*
buffer:
Copilot agent: Running, Network: OK, Access: OK [2 times]
Verifying...
I agree to these telemetry terms as part of the GitHub Copilot technical preview.
https://github.co/copilot-telemetry-terms (y or n) y
Failed to get user info.
Copilot: Authenticated as GitHub user Failed to get user info.
Copilot agent output buffer reset.
Copilot agent: Running, Network: Server connectivity error, Access: OK
Copilot agent: Running, Network: OK, Access: OK
I use doom emacs. After modifying my config.el with the recomendation of this readme:
https://github.com/zerolfx/copilot.el/blob/9b13478720581580a045ac76ad68be075466a963/readme.md?plain=1#L38-L41
I can't use tab to indent.
This worked for me:
(defun my-tab ()
(interactive)
(or (copilot-accept-completion)
(or (company-indent-or-complete-common nil) (indent-for-tab-command))))
Just tried clone-indirect-buffer
in a buffer where copilot works fine, I don't get any overlay/suggestion.
I installed node 17 with nvm.
When I run the following code I get the following path:
emacs --script test.el
/home/douglas/.nvm/versions/node/v17.9.1/bin/node
;; test.el
(defcustom copilot-node-executable
(if (eq system-type 'windows-nt)
"node.exe"
"node")
"Node executable path."
:group 'copilot
:type 'string)
(message
(locate-file copilot-node-executable exec-path))
But when I attempt to run the copilot login I get the following in Messages
Could not find node executable
cl-no-applicable-method: No applicable method: jsonrpc--request-continuations, nil
With the following stack trace:
Debugger entered--Lisp error: (cl-no-applicable-method jsonrpc--next-request-id nil)
signal(cl-no-applicable-method (jsonrpc--next-request-id nil))
cl-no-applicable-method(#s(cl--generic :name jsonrpc--next-request-id :dispatches ((0 #s(cl--generic-generalizer :name eieio--generic-generalizer :priority 50 :tagcode-function cl--generic-struct-tag :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0xa6a2d1c4cbedd43>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x1cba9713a96764e4>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode -0x2b7bed08469105e>)))) :method-table (#s(cl--generic-method :specializers (jsonrpc-connection) :qualifiers nil :uses-cnm nil :function #f(compiled-function (this) "Retrieve the slot `-next-request-id' from an object of class\n`jsonrpc-connection'." #<bytecode -0xdffec517024eae5>))) :options nil) nil)
apply(cl-no-applicable-method #s(cl--generic :name jsonrpc--next-request-id :dispatches ((0 #s(cl--generic-generalizer :name eieio--generic-generalizer :priority 50 :tagcode-function cl--generic-struct-tag :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0xa6a2d1c4cbedd43>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x1cba9713a96764e4>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode -0x2b7bed08469105e>)))) :method-table (#s(cl--generic-method :specializers (jsonrpc-connection) :qualifiers nil :uses-cnm nil :function #f(compiled-function (this) "Retrieve the slot `-next-request-id' from an object of class\n`jsonrpc-connection'." #<bytecode -0xdffec517024eae5>))) :options nil) nil)
#f(compiled-function (&rest args) #<bytecode 0x1196376db8a06fb3>)(nil)
apply(#f(compiled-function (&rest args) #<bytecode 0x1196376db8a06fb3>) nil nil)
jsonrpc--next-request-id(nil)
jsonrpc--async-request-1(nil signInInitiate 'nil :success-fn #f(compiled-function (result) #<bytecode -0x1476dbebf9018fc4>) :error-fn #f(compiled-function (jsonrpc-lambda-elem0) #<bytecode -0x112d31fbc699068b>) :timeout-fn #f(compiled-function () #<bytecode -0x1feb8137e6e23598>))
apply(jsonrpc--async-request-1 nil signInInitiate 'nil :success-fn #f(compiled-function (result) #<bytecode -0x1476dbebf9018fc4>) :error-fn #f(compiled-function (jsonrpc-lambda-elem0) #<bytecode -0x112d31fbc699068b>) :timeout-fn #f(compiled-function () #<bytecode -0x1feb8137e6e23598>) nil)
jsonrpc-request(nil signInInitiate 'nil)
copilot-login()
funcall-interactively(copilot-login)
command-execute(copilot-login record)
counsel-M-x-action("copilot-login")
ivy-call()
ivy-read("M-x " [## 0 vc-src-responsible-p timer-next-integral-multiple-of-time tramp-sudoedit-file-name-handler tramp-completion-handle-file-name-all-completions jsonrpc-name straight-vc-clone backquote-listify eglot-reconnect ert-test-passed-duration--cmacro help-follow-symbol pcomplete-stub japanese-hiragana-two-byte cc-vars dired-unmark-all-marks znc uniquify-rename-buffer inactive f-ancestor-of\? files--splice-dirname-file raw-text-dos lisp-mode-map info--manual-names 0 copilot-login minibuffer-text-before-history compilation-error-list kmacro-pop-ring1 min-width-safe nexus byte-condition-case tramp-sudoedit-handle-set-file-acl xref--push-markers vc-bzr-shelve-menu nswbuff 0 swiper-include-line-number-in-search browse-url-generic-args kmacro-p use-package-handler/:interpreter 0 filename-and-process slot-unbound :match check-declare xref-group counsel--async-filter tramp-handle-make-auto-save-file-name ls-lisp-handle-switches ...] :predicate #f(compiled-function (sym) #<bytecode -0x87b642a6c43fae2>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
counsel-M-x()
funcall-interactively(counsel-M-x)
command-execute(counsel-M-x)
My guess is there is some weird pathing thing here? Where the node executable isn't getting seen for some reason wherever the list code in package is getting run?
In any case I am going to sleep for now
I enter insert-mode, write something, copilot suggestion shows, but when I exit insert-mode, the suggestion is gone. Just copilot-accept-completion
does nothing now.
How can I fix this? What are the triggers for stopping to show the suggestion?
Hi,
I have this working on Mac Montery with emacs 28.1 and nvm node 17.9.1.
But trying what I think is identical setup on WSL2, I get the following upon M-x copilot-login
:
jsonrpc-request: jsonrpc-error: "request id=4 failed:", (jsonrpc-error-code . -32602), (jsonrpc-error-\
message . "Invalid params: must be object"), (jsonrpc-error-data)
copilot-node-executable
is set to "node"
and in a shell within emacs, node --version
returns v17.9.1
(same node version as on my Mac where copilot.el works)
Contents of *copilot-events*
:
(:jsonrpc "2.0" :id 2 :method "setEditorInfo" :params
(:editorInfo
(:name "Emacs" :version "26.3")
:editorPluginInfo
(:name "copilot.el" :version "0.9.6")))
[client-request] (id:3) Tue Jun 28 16:28:58 2022:
(:jsonrpc "2.0" :id 3 :method "signInInitiate" :params 'nil)
[server-reply] (id:2) Tue Jun 28 16:28:58 2022:
(:jsonrpc "2.0" :id 2 :result "OK")
[server-reply] (id:3) ERROR Tue Jun 28 16:28:58 2022:
(:jsonrpc "2.0" :id 3 :error
(:code -32602 :message "Invalid params: must be object"))
[client-request] (id:4) Tue Jun 28 16:35:17 2022:
(:jsonrpc "2.0" :id 4 :method "signInInitiate" :params 'nil)
[server-reply] (id:4) ERROR Tue Jun 28 16:35:17 2022:
(:jsonrpc "2.0" :id 4 :error
(:code -32602 :message "Invalid params: must be object"))
Contents of *copilot-stderr*
does not exist.
I don't think an exception is being thrown, it's just an rpc error presumably between the node executable in my WSL2 and the remote copilot authentication server?
Thanks,
Dave
Thanks for copilot.el, nice to be able to try this out in emacs.
I'm experiencing some interesting behaviour comparing completions in neovim vs. copilot.el;
with the following code in neovim I get ten different solutions while copilot.el gives me a single one.
import jax
import haiku as hk
class Auto
(Completing after "Auto")
Is this an expected behaviour?
Very similar to #34, except with newer versions. When I run copilot-login
, I see the following error in Messages:
jsonrpc-request: jsonrpc-error: "request id=3 failed:", (jsonrpc-error-code . -32602), (jsonrpc-error-message . "Invalid params: must be object"), (jsonrpc-error-data)
I cloned copilot and set it up manually. When I open a typescript buffer, *copilot-events*
gets created, and I can see node 16 running copilot/dist/agent.js.
I tried to debug it by inserting message
calls in copilot.el and jsonrpc, and confirmed that the (:jsonrpc "2.0" :id 3 :method "signInInitiate" :params 'nil)
gets converted to JSON: {"jsonrpc":"2.0","id":4,"method":"signInInitiate","params":["quote",null]}
. Which looks plausibly correct.
My next step after filing this bug is to download jsonrpc 1.0.14 and see what changed. Maybe handling of 'nil
?
From .emacs:
(load-file "~/.emacs.d/lisp/copilot/copilot.el")
(require 'copilot)
;; current version doesn't work with node 18
(setq copilot-node-executable "/home/nathansa/.nvm/versions/node/v16.15.1/bin/node")
(add-hook 'typescript-mode-hook 'copilot-mode)
(customize-set-variable 'copilot-enable-predicates '(evil-insert-state-p))
;; later ...
(add-hook 'typescript-mode-hook
(lambda ()
(tide-setup) ; required
;; lots of tide setup omitted, let me know if it would be helpful...
(define-key tide-mode-map (kbd "C-,") 'copilot-accept-completion)
(company-mode))) ; required
From *copilot-events*
:
(:jsonrpc "2.0" :id 2 :method "setEditorInfo" :params
(:editorInfo
(:name "Emacs" :version "28.1")
:editorPluginInfo
(:name "copilot.el" :version "0.9.7")))
[client-request] (id:3) Fri Nov 11 16:10:15 2022:
(:jsonrpc "2.0" :id 3 :method "signInInitiate" :params 'nil)
[server-notification] Fri Nov 11 16:10:15 2022:
(:jsonrpc "2.0" :method "LogMessage" :params
(:level 0 :message "[DEBUG] [agent] [2022-11-12T00:10:15.343Z] Telemetry initialized" :metadataStr "[DEBUG] [agent] [2022-11-12T00:10:15.343Z]" :extra
["Telemetry initialized"]))
[server-reply] (id:2) Fri Nov 11 16:10:15 2022:
(:jsonrpc "2.0" :id 2 :result "OK")
[server-reply] (id:3) ERROR Fri Nov 11 16:10:15 2022:
(:jsonrpc "2.0" :id 3 :error
(:code -32602 :message "Invalid params: must be object"))
From *messages*
(vscode-wasm-typescript-055c507e12) Starting tsserver...
(vscode-wasm-typescript-055c507e12) tsserver server started successfully.
Company backend ’company-eclim’ could not be initialized:
Symbol’s function definition is void: company-eclim
Quit [4 times]
Making completion list...
Copilot agent started.
jsonrpc-request: jsonrpc-error: "request id=3 failed:", (jsonrpc-error-code . -32602), (jsonrpc-error-message . "Invalid params: must be object"), (jsonrpc-error-data)
Thanks for your package!
When I try to call copilot-login
, Error shows below
Debugger entered--Lisp error: (error "Process copilot-agent not running")
copilot--send-request((:method "httpRequest" :params (:url "https://github.com/login/device/code" :timeout 30000 :method "POST" :headers (:Accept "application/json") :json (:client_id "Iv1.b507a08c87ecfe98" :scope "user:read")) :id 7))
copilot--agent-request("httpRequest" (:url "https://github.com/login/device/code" :timeout 30000 :method "POST" :headers (:Accept "application/json") :json (:client_id "Iv1.b507a08c87ecfe98" :scope "user:read")) #f(compiled-function (result) #<bytecode 0x134833c0d8dbd7dd>))
copilot--agent-http-request("https://github.com/login/device/code" (:method "POST" :headers (:Accept "application/json") :json (:client_id "Iv1.b507a08c87ecfe98" :scope "user:read")) copilot--login-callback)
copilot-login()
funcall-interactively(copilot-login)
command-execute(copilot-login record)
counsel-M-x-action("copilot-login")
ivy-call()
ivy-read("M-x " ("copilot-diagnose" "copilot-complete" "lsp" "java-mode" "org-roam-ui-mode" "org-roam-capture" "load-theme" "version" "lsp-ui-flycheck-list" "js-mode" "text-mode" "org-roam-node-insert" "doom/reload" "flycheck-mode" "eval-buffer" "markdown-table-align" "indium-add-breakpoint" "org-roam-node-find" "indium-quit" "pwd" "abbrev-mode" "align-regexp" "list-abbrevs" "org-roam-db-sync" "sql-postgres-local" "mu4e" "dap-debug" "jest-popup" "emacs-version" "comment-region" "define-abbrevs" "lsp-ui-doc-show" "forge-toggle-closed-visibility" "magit-blame" "edit-abbrevs" "impatient-mode" "uncomment-region" "org-roam-ref-find" "dap-breakpoint-add" "forge-pull-notifications" "indium-remove-breakpoint" "forge-toggle-display-in-status-buffer" "dap-continue" "tab-bar-mode" "indium-launch" "add-mode-abbrev" "git-gutter-mode" "flycheck-list-errors" "=mu4e" "vterm" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
counsel-M-x()
funcall-interactively(counsel-M-x)
command-execute(counsel-M-x)
And for every copilot commands like copilot-diagnose, it always shows an error Debugger entered--Lisp error: (error "Process copilot-agent not running")
How could I run the copilot-agent?
Thanks :)
Hello,
I am having trouble login to GitHub. Disclaimer: emacs newbie here.
copilot-login gives the following
which brings me to this emacs browser
That is where I get confused.
(1) What are the two fields after password? The first is hidden and the second not, so I put my password in the first. I don't know what to do with the one-time code from the previous step, so I put it in the second field--leaving it blank does not seem to change anything.
(2) How to click the "sign in" button? I can't seem to make it work.
(3) What are these multiple "submit" buttons?
In any case, just pressing Enter in the mini buffer brings me to this:
and copilot-diagnose just reports that I am not logged in: Copilot error: (:code 1000 :message "Not authenticated: NotSignedIn")
Here is the full content of the *Messages* buffer
Loading /etc/emacs/site-start.d/00debian.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Copilot agent started.
Contacting host: github.com:443
uncompressing publicsuffix.txt.gz...done
Input field
Verifying...
Authentication failure: Timed out
Authenticated as GitHub user nil.
You can run the command ‘copilot-login’ with M-x c-logi RET
Authenticated as GitHub user nil.
[jsonrpc] Server exited with status 9
Copilot agent started.
Copilot error: (:code 1000 :message "Not authenticated: NotSignedIn")
and of the *copilot events* buffer (2 different attempts)
(:jsonrpc "2.0" :id 2 :result "OK")
[server-reply] (id:3) ERROR Wed Nov 23 17:56:04 2022:
(:jsonrpc "2.0" :id 3 :error
(:code 1000 :message "Not authenticated: NotSignedIn"))
[client-request] (id:4) Wed Nov 23 17:57:36 2022:
(:jsonrpc "2.0" :id 4 :method "getCompletions" :params
(:doc
(:source ";; This buffer is for text that is not saved, and for Lisp evaluation.\n;; To create a file, visit it with C-x C-f and enter text in its buffer.\n\n\n" :tabSize 8 :indentSize 8 :insertSpaces :json-false :path nil :uri "" :relativePath "" :languageId "lisp-interaction" :position
(:line 3 :character 0))))
[server-reply] (id:4) ERROR Wed Nov 23 17:57:36 2022:
(:jsonrpc "2.0" :id 4 :error
(:code 1000 :message "Not authenticated: NotSignedIn"))
[internal] (id:4) ERROR Wed Nov 23 17:57:36 2022:
(:message "error ignored, status set (Not authenticated: NotSignedIn)" :id 4 :error 1000)
(:jsonrpc "2.0" :method "LogMessage" :params
(:level 0 :message "[DEBUG] [agent] [2022-11-23T23:06:39.119Z] Telemetry initialized" :metadataStr "[DEBUG] [agent] [2022-11-23T23:06:39.119Z]" :extra
["Telemetry initialized"]))
[server-reply] (id:2) Wed Nov 23 18:06:39 2022:
(:jsonrpc "2.0" :id 2 :result "OK")
[server-reply] (id:3) Wed Nov 23 18:06:39 2022:
(:jsonrpc "2.0" :id 3 :result
(:status "PromptUserDeviceFlow" :userCode "1406-2ED0" :verificationUri "https://github.com/login/device" :expiresIn 899 :interval 5))
[client-request] (id:4) Wed Nov 23 18:07:09 2022:
(:jsonrpc "2.0" :id 4 :method "signInConfirm" :params
(:userCode "1406-2ED0"))
[client-request] (id:5) Wed Nov 23 18:07:19 2022:
(:jsonrpc "2.0" :id 5 :method "checkStatus" :params
(:dummy "checkStatus"))
[server-reply] (id:5) Wed Nov 23 18:07:19 2022:
(:jsonrpc "2.0" :id 5 :result
(:status "NotSignedIn"))
And for the sake of completeness, here is my .emacs init file
;; Disable package.el in favor of straight.el
(setq package-enable-at-startup nil)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes '(wheatgrass)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; Install straight.el
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;; Install use-package
(straight-use-package 'use-package)
;; Configure use-package to use straight.el by default
(use-package straight
:custom (straight-use-package-by-default t))
;; Load copilot
(use-package copilot
:straight (:host github :repo "zerolfx/copilot.el" :files ("dist" "*.el"))
:ensure t)
;; you can utilize :map :hook and :config to customize copilot
(add-hook 'prog-mode-hook 'copilot-mode)
;; Configure copilot
(defun my/copilot-tab ()
(interactive)
(or (copilot-accept-completion)
(indent-for-tab-command)))
(with-eval-after-load 'copilot
(define-key copilot-mode-map (kbd "<tab>") #'my/copilot-tab))
;; Configure nodejs dependency
(setq copilot-node-executable "/home/proulx-s/.nvm/versions/node/v16.18.1/bin/node")
I am running emacs 27.1 in Ubuntu 18.04 LTS through WSL2.
Thanks for the good work and for the help!
Sébastien
I use copilot.el to do literate programming in org-mode. It works normally a few days ago but stops working today.
When I open an org file the first time, copilot.el will give a suggestion but then will never give any suggestions again. There is an error message in minibuffer:
Error in post-command-hook (copilot--complete-post-command): (args-out-of-range 51 52)
The full log is:
[Agent] [DEBUG] [agent] [2022-05-18T16:08:25.891Z] Agent service starting
[Initialize] ((error) (capabilities (textDocumentSync (openClose . t) (change . 2)) (workspace (workspaceFolders (supported . :json-false) (changeNotifications . :json-false)))))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-18T16:08:26.646Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[Agent] [INFO] [default] [2022-05-18T16:08:28.267Z] request.response: [https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex/completions] took 1620 ms
[Agent] [INFO] [streamChoices] [2022-05-18T16:08:28.268Z] solution 0 returned. finish reason: ["stop"] finishOffset: [undefined] completionId: [{cmpl-59GVoe30Co5lG78dglmeisUmCmG4k}] created: [{1652890108}]
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . [((uuid . "16ce15a7-3810-4982-908f-37fb848e88e2") (text . "import Data.Complex") (range (start (line . 259) (character . 0)) (end (line . 259) (character . 0))) (displayText . "import Data.Complex") (position (line . 259) (character . 0)))]))
[Agent] [INFO] [post-insertion] [2022-05-18T16:08:59.601Z] Could not get document for /home/vitalyr/org/20220214134416-sicp_polyglot.org. Maybe it was closed by the editor.
And here is my configurations for copilot.el:
(customize-set-variable 'copilot-enable-predicates '((lambda () (eq (meow--current-state) 'insert))))
(defun my-tab ()
(interactive)
(or (copilot-accept-completion)
(company-indent-or-complete-common nil)))
;; complete by copilot first, then company-mode
(use-package! copilot
:hook (prog-mode . copilot-mode)
:hook (text-mode . copilot-mode)
:bind (("C-TAB" . 'copilot-accept-completion-by-word)
("C-<tab>" . 'copilot-accept-completion-by-word)
:map company-active-map
("<tab>" . 'my-tab)
("TAB" . 'my-tab)
:map company-mode-map
("<tab>" . 'my-tab)
("TAB" . 'my-tab)))
I have updated to the latest code but it didn't help.
There are many copilot commands that only make sense when the overlay is active.
I bind them in copilot-mode-map
using menu-item
while preventing them from overriding other keys unless the overlay is active with a filter function.
(defun my-copilot-filter (cmd)
(and copilot--overlay
cmd))
(general-define-key
:keymaps 'copilot-mode-map
"TAB" `(menu-item "" copilot-accept-completion :filter my-copilot-filter)
"C-g" `(menu-item "" copilot-clear-overlay :filter my-copilot-filter)
"M-f" `(menu-item "" copilot-accept-completion-by-word :filter my-copilot-filter)
"C-e" `(menu-item "" copilot-accept-completion-by-line :filter my-copilot-filter)
;;
)
It would be safer it copilot.el
provided a public way to check if the overlay is being showed instead of making use of the internal variable as above. Such as
(defun copilot-active-overlay-p ()
(and copilot--overlay
t))
Edit: also, exposing the suggestion string is cool, too! It can also fulfill the feature request.
(defun copilot-current-suggestion ()
(and copilot--overlay
(overlay-get copilot--overlay 'completion)))
How would one go about enabling copilot completions when using elpy and jedi? Using this combination requires that company mode is disabled
When I try to run copilot-login
I get
helm-M-x-execute-command: Wrong number of arguments: (1 . 1)
The same goes for copilot-diagnose
.
when I typing function check_if_
, when call copilot-previous-completion or copilot-next-completion, to choice another completion , got message shows " only one completion is available" , but same code in visual studio code , can get more than one completion
I find some variables provided by projectile
are used in copilot--get-relative-path
.
And copilot.el
can't work until I turn on projectile-mode
on my machine.
Hi!
I'm trying to set up the project.
The login works as expected:
Verifying...
I agree to these telemetry terms as part of the GitHub Copilot technical preview.
https://github.co/copilot-telemetry-terms (y or n) y
Login success!
but on copilot-diagnose I receive a message like this:
Copilot agent: Running, Network: OK, Access: error: ((code . 1000) (message . "Not authenticated: NoTelemetryConsent"))
What could be the reason?
Thank you in advance.
I am finishing copilot-login .. but on each restart, it shows this in copilot events buffer.
(:jsonrpc "2.0" :id 2 :result "OK")
[server-notification] Fri Jun 24 10:34:25 2022:
(:jsonrpc "2.0" :method "LogMessage" :params
(:level 1 :message "[INFO] [auth] [2022-06-24T05:04:25.702Z] Invalid copilot token: missing token: 403 " :metadataStr "[INFO] [auth] [2022-06-24T05:04:25.702Z]" :extra
["Invalid copilot token: missing token: 403 "]))
[server-request] (id:0) Fri Jun 24 10:34:25 2022:
(:jsonrpc "2.0" :id 0 :method "window/showMessageRequest" :params
(:type 2 :message "Your Copilot experience is not fully configured, complete your setup." :actions
[(:title "Copilot Settings")
(:title "Dismiss")]))
[client-reply] (id:0) Fri Jun 24 10:34:25 2022:
(:jsonrpc "2.0" :id 0 :result nil)
[server-reply] (id:3) ERROR Fri Jun 24 10:34:25 2022:
(:jsonrpc "2.0" :id 3 :error
(:code 1000 :message "Not authenticated: NotAuthorized"))
I don't know where this bug came from, but when copilot enabled in emacs (in wsl) buffer , each time press alt+tab to swith applications ,back to emacs, an I or O inserted in the buffer, after disable the copilot, I or O not insert anymore .
emacs-version is 29.0.50, which has jsonrpc 1.0.15 built in.
copilot-version is 0.9.6
node --version is v16.15.1
When I run copilot-login
I get an error producing this backtrace:
Debugger entered--Lisp error: (jsonrpc-error "request id=3 failed:" (jsonrpc-error-code . -32602) (jsonrpc-error-message . "Invalid params: must be object") (jsonrpc-error-data))
signal(jsonrpc-error ("request id=3 failed:" (jsonrpc-error-code . -32602) (jsonrpc-error-message . "Invalid params: must be object") (jsonrpc-error-data)))
jsonrpc-request(#<jsonrpc-process-connection jsonrpc-process-connection-156badb09cac> signInInitiate 'nil)
copilot-login()
funcall-interactively(copilot-login)
call-interactively(copilot-login record nil)
command-execute(copilot-login record)
execute-extended-command(nil "copilot-login" "copilot-logi")
funcall-interactively(execute-extended-command nil "copilot-login" "copilot-logi")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
The contents of the *copilot events*
buffer:
(:jsonrpc "2.0" :id 1 :result
(:capabilities
(:textDocumentSync
(:openClose t :change 2)
:workspace
(:workspaceFolders
(:supported :json-false :changeNotifications :json-false)))))
[client-request] (id:2) Tue Jul 26 13:12:29 2022:
(:jsonrpc "2.0" :id 2 :method "setEditorInfo" :params
(:editorInfo
(:name "Emacs" :version "29.0.50")
:editorPluginInfo
(:name "copilot.el" :version "0.9.6")))
[client-request] (id:3) Tue Jul 26 13:12:29 2022:
(:jsonrpc "2.0" :id 3 :method "signInInitiate" :params 'nil)
[server-reply] (id:2) Tue Jul 26 13:12:29 2022:
(:jsonrpc "2.0" :id 2 :result "OK")
[server-reply] (id:3) ERROR Tue Jul 26 13:12:29 2022:
(:jsonrpc "2.0" :id 3 :error
(:code -32602 :message "Invalid params: must be object"))
This was working great for several weeks now. But suddently it stopped working. I updated by pulling the repository. And running copilot-login again. But to no avail. Copilot working fine in other editor.
Here is the error I get:
[Agent] [DEBUG] [agent] [2022-05-15T08:28:30.572Z] Agent service starting
[Initialize] ((error) (capabilities (textDocumentSync (openClose . t) (change . 2)) (workspace (workspaceFolders (supported . :json-false) (changeNotifications . :json-false)))))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:54.800Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:55.033Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:55.708Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[Agent] [INFO] [ghostText] [2022-05-15T08:33:55.911Z] Cancelled after extractPrompt
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:56.200Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:56.402Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:56.845Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:57.178Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:57.345Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:57.577Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:57.671Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:57.813Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:57.913Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[INFO] Completion: ((error) (completions . []))
[Agent] [INFO] [default] [2022-05-15T08:33:58.210Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:58.433Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:58.919Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:59.080Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[Agent] [INFO] [ghostText] [2022-05-15T08:33:59.185Z] Cancelled after extractPrompt
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:59.275Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:33:59.397Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[Agent] [INFO] [ghostText] [2022-05-15T08:34:00.823Z] Cancelled after extractPrompt
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:34:02.769Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:34:02.991Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:34:03.897Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:34:04.136Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[Agent] [INFO] [ghostText] [2022-05-15T08:34:04.201Z] Cancelled after extractPrompt
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:34:05.435Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[Agent] [INFO] [ghostText] [2022-05-15T08:34:05.840Z] Cancelled after extractPrompt
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:34:07.380Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[Agent] [INFO] [ghostText] [2022-05-15T08:34:09.218Z] Cancelled after extractPrompt
[INFO] Completion: ((error) (completions . []))
[Agent] [INFO] [ghostText] [2022-05-15T08:34:10.858Z] Cancelled after extractPrompt
[INFO] Completion: ((error) (completions . []))
[Agent] [INFO] [ghostText] [2022-05-15T08:34:14.243Z] Cancelled after extractPrompt
[INFO] Completion: ((error) (completions . []))
[Agent] [INFO] [ghostText] [2022-05-15T08:34:15.877Z] Cancelled after extractPrompt
[INFO] Completion: ((error) (completions . []))
[Agent] [INFO] [ghostText] [2022-05-15T08:34:19.165Z] Cancelled after extractPrompt
[INFO] Completion: ((error) (completions . []))
[Agent] [INFO] [ghostText] [2022-05-15T08:34:20.896Z] Cancelled after extractPrompt
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:34:40.184Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:34:40.747Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:34:41.304Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:34:42.769Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[Agent] [INFO] [default] [2022-05-15T08:34:43.985Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[Agent] [INFO] [default] [2022-05-15T08:35:41.560Z] request.response: [https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex/completions] took 57575 ms
[ERROR] Failed to parse response: nil
[ERROR] Failed to parse response: nil
[Warning] Copilot agent output buffer reset.
[Warning] Before reset: "etadataStr":"[INFO] [streamChoices] [2022-05-15T08:35:41.567Z]","extra":["solution 0 returned. finish reason: [\"stop\"] finishOffset: [undefined] completionId: [{cmpl-5840zdIu3rRg0ClhWESBNkd5N6dKw}] created: [{1652603741}]"]}}Content-Length: 246
{"jsonrpc":"2.0","method":"LogMessage","params":{"level":3,"message":"[ERROR] [streamChoices] [2022-05-15T08:35:41.567Z] Invalid streamingData","metadataStr":"[ERROR] [streamChoices] [2022-05-15T08:35:41.567Z]","extra":["Invalid streamingData"]}}Content-Length: 348
{"jsonrpc":"2.0","method":"LogMessage","params":{"level":3,"message":"[ERROR] [streamChoices] [2022-05-15T08:35:41.568Z] Invalid streamingData,joinedText:[n] not a substring of joinedTokens:[]","metadataStr":"[ERROR] [streamChoices] [2022-05-15T08:35:41.568Z]","extra":["Invalid streamingData","joinedText:[n] not a substring of joinedTokens:[]"]}}Content-Length: 89
{"jsonrpc":"2.0","method":"statusNotification","params":{"status":"Normal","message":""}}Content-Length: 674
{"jsonrpc":"2.0","method":"LogMessage","params":{"level":3,"message":"[ERROR] [restraint] [2022-05-15T08:35:41.573Z] No value found for meanLogProb -- only got {\"promptCharLen\":1910,\"promptEndPos\":1893,\"documentLength\":7295,\"delayMs\":0,\"promptComputeTimeMs\":8,\"timeSinceIssuedMs\":1,\"numTokens\":0,\"compCharLen\":1,\"numLines\":1,\"python\":0}","metadataStr":"[ERROR] [restraint] [2022-05-15T08:35:41.573Z]","extra":["No value found for meanLogProb -- only got {\"promptCharLen\":1910,\"promptEndPos\":1893,\"documentLength\":7295,\"delayMs\":0,\"promptComputeTimeMs\":8,\"timeSinceIssuedMs\":1,\"numTokens\":0,\"compCharLen\":1,\"numLines\":1,\"python\":0}"]}}Content-Length: 714
{"jsonrpc":"2.0","method":"LogMessage","params":{"level":3,"message":"[ERROR] [restraint] [2022-05-15T08:35:41.574Z] No value found for meanLogProb -- only got {\"promptCharLen\":1910,\"promptEndPos\":1893,\"documentLength\":7295,\"delayMs\":0,\"promptComputeTimeMs\":8,\"timeSinceIssuedMs\":1,\"numTokens\":0,\"compCharLen\":1,\"numLines\":1,\"confidence\":null,\"python\":0}","metadataStr":"[ERROR] [restraint] [2022-05-15T08:35:41.574Z]","extra":["No value found for meanLogProb -- only got {\"promptCharLen\":1910,\"promptEndPos\":1893,\"documentLength\":7295,\"delayMs\":0,\"promptComputeTimeMs\":8,\"timeSinceIssuedMs\":1,\"numTokens\":0,\"compCharLen\":1,\"numLines\":1,\"confidence\":null,\"python\":0}"]}}Content-Length: 271
{"jsonrpc":"2.0","id":47,"result":{"completions":[{"uuid":"c932d92e-ec3c-41c4-9c7c-6322acd3389f","text":"# open a websocket connetion","range":{"start":{"line":66,"character":0},"end":{"line":66,"character":27}},"displayText":"n","position":{"line":66,"character":27}}]}}"
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "InProgress") (message . "")))
[INFO] Completion: ((error) (completions . []))
[Agent] [INFO] [default] [2022-05-15T08:36:01.861Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[Agent] [INFO] [default] [2022-05-15T08:36:02.193Z] request.response: [https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex/completions] took 332 ms
[Agent] [INFO] [streamChoices] [2022-05-15T08:36:02.195Z] solution 0 returned. finish reason: ["stop"] finishOffset: [undefined] completionId: [{cmpl-5841KwYTLSXw10mUWNxW4mxz1HsID}] created: [{1652603762}]
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Normal") (message . "")))
[INFO] Completion: ((error) (completions . []))
Follows discussion here: #21
For information:
OS: MacOS
Build options: "--with-ns '--enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules"
Emacs: 28.1
Configuration:
:straight (:host github :repo "zerolfx/copilot.el"
:branch "main")
:custom
(copilot-node-executable "/Users/Marcos/.nvm/versions/node/v17.9.1/bin/node"))
Also, please attach relative stuff in Message, copilot stderr and copilot event?
I just have one line of error with:
cl-no-applicable-method: No applicable method: jsonrpc--request-continuations, nil
on *Message*
. The other buffers do not exist.
I this error when I try to run copilot-login
Symbol’s function definition is void: json-serialize
M-x version says:
GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) of 2021-04-04, unofficial emacs-snapshot build: http://emacs.ganneff.de/, git commit dd5ba88afbb63f54603cc632fc55993c04531a85
Ever since commit dfa803e I'm afraid I've had issues with the cursor position.
Physically, the position does not change, and any cursor movement/editing actions briefly show the cursor in the correct position again, until a copilot suggestion appears. However it only happens for single-line suggestions from copilot. If it's suggesting multiple lines, the visual cursor position stays in the right place.
Here's a couple of gifs:
On commit 56b7d1b (latest):
On commit 3dcf2a7 with copilot-overlay-safe
set to nil
:
As per above image, there should be the first candidate of pyim "删除" displayed on the buffer, but current it displays the copilot suggestion and it hides pyim's candidate, this is not an issue when the candidate is only one or two Chinese character, but if we are inputing a very long sentence, then hide the whole candidate will be an issue.
I had difficulty getting this to work in spacemacs with the instructions that were provided. I did ultimately get it working, so I wanted to share my config. I ultimately had to add a bunch of stuff to dotspacemacs/user-config:
(defun dotspacemacs/user-config ()
"Configuration for user code:
This function is called at the very end of Spacemacs startup, after layer
configuration.
Put your configuration code here, except for variables that should be set
before packages are loaded."
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(use-package copilot
:straight (:host github :repo "zerolfx/copilot.el" :files ("dist" "*.el"))
:ensure t)
(setq copilot-node-executable "/home/<username>/.nvm/versions/node/v16.16.0/bin/node")
(with-eval-after-load 'company
;; disable inline previews
(delq 'company-preview-if-just-one-frontend company-frontends))
(define-key copilot-completion-map (kbd "<tab>") 'copilot-accept-completion)
;; (define-key copilot-completion-map (kbd "TAB") 'copilot-accept-completion)
(add-hook 'prog-mode-hook 'copilot-mode)
(define-key evil-insert-state-map (kbd "C-<tab>") 'copilot-accept-completion-by-word)
(define-key evil-insert-state-map (kbd "C-TAB") 'copilot-accept-completion-by-word) )
This looks a little hack to me, but it works. If there's a better way to handle that, I'd like to know and help update the instructions for others.
Hi, I've got this weird behavior on Doom Emacs when editing a .react.js
file with rjsx-mode
, other modes seems to work just fine:
TAB
correctly complete the copilot suggestion, and selecting something in the dropdown and hitting enter
correctly use the code-completion from the dropdown,TAB
trigger another mechanism of code completion related to jsx
I'm using the exact same configuration for Doom Emacs from your readme, with (javacript +lsp)
enabled in config.el
, the lsp
server being used is jsts-ls
.
I'm on Archlinux (btw ;)), with emacs 28.1-7
, on the most recent commit from doom emacs right now, and the last commit for rjsx-mode.
Looks like rjsx-mode
is based on js2-mode
, and if I switch temporarily to js2-mode
then I'm not able to reproduce the bug anymore: hitting TAB
correctly completes both copilot suggestions and lsp code completion, even if the other one is missing (however I loose some nice functionalities regarding code-completion from rjsx-mode
, such as this jsx
completion).
One way to make sense of this would be that the jsx
completion from rjsx-mode
is not triggering completion candidates in a proper emacs dropdown, and copilot.el
cannot handle this case.
I've taken some screenshots to illustrate.
Here, the completion from Copilot is shown, which is expected, but there's no dropdown:
When I hit TAB
expecting the copilot suggestion to be used, then it's the jsx
completion that is being used:
However when there's both copilot suggestions and a dropdown then it's working fine:
If it's of any use, this is my Doom Emacs' init.el
:
;;; init.el -*- lexical-binding: t; -*-
;; This file controls what Doom modules are enabled and what order they load
;; in. Remember to run 'doom sync' after modifying it!
;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;; documentation. There you'll find a link to Doom's Module Index where all
;; of our modules are listed, including what flags they support.
;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
;; 'C-c c k' for non-vim users) to view its documentation. This works on
;; flags as well (those symbols that start with a plus).
;;
;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;; directory (for easy access to its source code).
(doom! :input
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
;;chinese
;;japanese
;;layout ; auie,ctsrnm is the superior home row
:completion
(company +childframe) ; the ultimate code completion backend
;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine...
;;ivy ; a search engine for love and life
(vertico +icons) ; the search engine of the future
:ui
deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs
;;doom-quit ; DOOM quit-message prompts when you quit Emacs
;;(emoji +unicode) ; 🙂
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;hydra
indent-guides ; highlighted indent columns
ligatures ; ligatures and symbols to make your code pretty again
minimap ; show a map of the code on the side
modeline ; snazzy, Atom-inspired modeline, plus API
nav-flash ; blink cursor line after big motions
neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows
;;tabs ; a tab bar for Emacs
;;treemacs ; a project drawer, like neotree but cooler
unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
(window-select +numbers) ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces
zen ; distraction-free coding or writing
:editor
(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
multiple-cursors ; editing in many places at once
;;objed ; text object editing for the innocent
parinfer ; turn lisp into python, sort of
rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to
;;word-wrap ; soft wrapping with language-aware indent
:emacs
dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
(ibuffer +icons) ; interactive buffer management
undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
:term
;;eshell ; the elisp shell that works everywhere
;;shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs
vterm ; the best terminal emulation in Emacs
:checkers
syntax ; tasing you for every semicolon you forget
;;(spell +flyspell) ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
:tools
;;ansible
;;biblio ; Writes a PhD for you (citation needed)
;;debugger ; FIXME stepping through code, to help you add bugs
;;direnv
docker
editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists
lookup ; navigate your code and its documentation
lsp ; M-x vscode
magit ; a git porcelain for Emacs
make ; run make tasks from Emacs
;;pass ; password manager for nerds
;;pdf ; pdf enhancements
;;prodigy ; FIXME managing external services & code builders
;;rgb ; creating color strings
;;taskrunner ; taskrunner for all your projects
;;terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux
;;upload ; map local to remote projects via ssh/ftp
:os
(:if IS-MAC macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience
:lang
;;agda ; types of types of types of types...
;;beancount ; mind the GAAP
;;(cc +lsp) ; C > C++ == 1
;;clojure ; java with a lisp
;;common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs
;;crystal ; ruby at the speed of c
;;csharp ; unity, .NET, and mono shenanigans
;;data ; config/data formats
;;(dart +flutter) ; paint ui and not much else
;;dhall
;;elixir ; erlang done right
elm ; care for a cup of TEA?
emacs-lisp ; drown in parentheses
;;erlang ; an elegant language for a more civilized age
;;ess ; emacs speaks statistics
;;factor
;;faust ; dsp, but you get to keep your soul
;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER)
;;fsharp ; ML stands for Microsoft's Language
;;fstar ; (dependent) types and (monadic) effects and Z3
;;gdscript ; the language you waited for
(go +lsp) ; the hipster dialect
;;(graphql +lsp) ; Give queries a REST
;;(haskell +lsp) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on
json ; At least it ain't XML
;;(java +lsp) ; the poster child for carpal tunnel syndrome
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
(javascript +lsp) ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
;;latex ; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove
;;ledger ; be audit you can be
;;lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
org ; organize your plain life in plain text
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional
;;python ; beautiful is better than ugly
;;qt ; the 'cutest' gui framework ever
;;racket ; a DSL for DSLs
;;raku ; the artist formerly known as perl6
rest ; Emacs as a REST client
;;rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
;;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
;;(scheme +guile) ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor
;;sml
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
web ; the tubes
yaml ; JSON, but readable
;;zig ; C, but simpler
:email
;;(mu4e +org +gmail)
;;notmuch
;;(wanderlust +gmail)
:app
;;calendar
;;emms
;;everywhere ; *leave* Emacs!? You must be joking
;;irc ; how neckbeards socialize
;;(rss +org) ; emacs as an RSS reader
;;twitter ; twitter client https://twitter.com/vnought
:config
;;literate
(default +bindings +smartparens))
Thanks!
I'm using doom emacs, and the following lines of the config are disabling line numbers in all buffers (If I comment this part of the config, I have line numbers again)
I have this line in my doom config.el (setq display-line-numbers-type t)
Hi there, first off: big thanks for making this package!
I just installed the package into my doom emacs, and am getting the following error in the logs when I call copilot-complete
:
(I was able to log in and authenticate just fine, and I do have access to copilot in vs code).
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "LogMessage") (params (level . 1) (message . "[INFO] [default] [2022-04-14T08:27:18.340Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex") (metadataStr . "[INFO] [default] [2022-04-14T08:27:18.340Z]") (extra . ["[fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex"])))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "LogMessage") (params (level . 1) (message . "[INFO] [default] [2022-04-14T08:27:18.555Z] request.response: [https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex/completions] took 213 ms") (metadataStr . "[INFO] [default] [2022-04-14T08:27:18.555Z]") (extra . ["request.response: [https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex/completions] took 213 ms"])))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "Warning") (message . "")))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "LogMessage") (params (level . 3) (message . "[ERROR] [fetch] [2022-04-14T08:27:18.560Z] Unhandled status from server:,466,Please upgrade your Copilot extension to continue using this service.
") (metadataStr . "[ERROR] [fetch] [2022-04-14T08:27:18.560Z]") (extra . ["Unhandled status from server:" "466" "Please upgrade your Copilot extension to continue using this service.
"])))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "statusNotification") (params (status . "RemoveProgress") (message . "")))
[INFO] Discard message without id: ((jsonrpc . "2.0") (method . "LogMessage") (params (level . 1) (message . "[INFO] [ghostText] [2022-04-14T08:27:18.560Z] Breaking, no choices") (metadataStr . "[INFO] [ghostText] [2022-04-14T08:27:18.560Z]") (extra . ["Breaking, no choices"])))
[INFO] Completion: ((error) (completions . []))
My config is basically copy/pasted from the readme.
; complete by copilot first, then company-mode
(defun my-tab ()
(interactive)
(or (copilot-accept-completion)
(company-indent-or-complete-common nil)))
(use-package! copilot
:after org
:config
(setq copilot-enable-predicates '(evil-insert-state-p))
(add-hook 'prog-mode-hook 'copilot-mode)
; Make it work with company-mode
(with-eval-after-load 'company
; disable inline previews
(delq 'company-preview-if-just-one-frontend company-frontends)
; enable tab completion
(define-key company-mode-map (kbd "<tab>") 'my-tab)
(define-key company-mode-map (kbd "TAB") 'my-tab)
(define-key company-active-map (kbd "<tab>") 'my-tab)
(define-key company-active-map (kbd "TAB") 'my-tab)))
I'm kind of a novice, so please let me know if you need more info to help diagnose this.
Cheers!
First of all, huge kudos to making this run at all. Very impressive!
When doing basic typing, all text is delayed. Maybe communication with Github servers runs synchronously somehow?
Basically, even typing "printf" starts to become a slideshow, once you get to letters "int" in "printf".
Here is the profiler-report. I started the profiler, typed printf with thing becoming sluggish and quickly turned off the profiler after finishing typing printf:
22 78% - timer-event-handler
22 78% - apply
11 39% - #<compiled 0xc84f09d4e586fe8>
9 32% - execute-extended-command--shorter
9 32% - completion-try-completion
9 32% - completion--nth-completion
9 32% - completion--some
9 32% - #<compiled -0xd0405c3a3e2ed9e>
7 25% - completion-pcm-try-completion
7 25% completion-pcm--find-all-completions
1 3% sit-for
11 39% - copilot--post-command-debounce
11 39% - copilot-complete
11 39% - copilot--get-completion
11 39% - jsonrpc-async-request
11 39% - jsonrpc--async-request-1
11 39% - jsonrpc-connection-send
11 39% - apply
11 39% - #<compiled -0x2b75ade3e65c9d4>
1 3% - process-send-string
1 3% - jsonrpc--process-filter
1 3% - jsonrpc-connection-receive
1 3% - jsonrpc--log-event
1 3% - pp-to-string
1 3% - pp-buffer
1 3% - indent-sexp
1 3% - lisp-indent-initial-state
1 3% - lisp-ppss
1 3% - syntax-ppss
1 3% - add-hook
1 3% #<compiled 0x17506bba75d24a0d>
3 10% - ...
3 10% Automatic GC
3 10% - command-execute
3 10% - byte-code
3 10% - read-extended-command
1 3% - completing-read-default
1 3% - command-execute
1 3% - funcall-interactively
1 3% - minibuffer-complete
1 3% - completion-in-region
1 3% - completion--in-region
1 3% - #<compiled -0x681a8a8b7c3eb26>
1 3% - apply
1 3% - #<compiled -0x16260e3da3a2f75e>
1 3% - completion--in-region-1
1 3% - completion--do-completion
1 3% - completion--done
1 3% - completion--message
1 3% minibuffer-message
Context:
Emacs 28.1 with native-comp enabled by default
Windows 11, Emacs running via MSYS2 MinGW64.
Near clean config file, Ivy, LSP, counsel etc. all disabled.
Editing a 1000 line C file.
Node 18+ is not supported but found 18.3
Please make it available on Node 18+ version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.