Skip to content

error duing copilot--on-doc-change in vertico completions #286

Open
@offbyone

Description

@offbyone

I've just started, after a recent doom update, getting an error the first time I try select a completion from the minibuffer using vertico. The traceback implicates copilot-mode's copilot--on-doc-change function. I am not sure why this is happening or how to get you better debugging info, but something is fishy here:

Debugger entered--Lisp error: (wrong-type-argument utf-8-string-p "  roles:\370\210\200\200\202")
  json-serialize((:jsonrpc "2.0" :method "textDocument/didChange" :params (:textDocument (:uri "buffer://%20*Minibuf-1*" :version 4) :contentChanges [(:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :text "  roles:�")])) :false-object :json-false :null-object nil)
  jsonrpc--json-encode((:jsonrpc "2.0" :method "textDocument/didChange" :params (:textDocument (:uri "buffer://%20*Minibuf-1*" :version 4) :contentChanges [(:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :text "  roles:�")])))
  #f(compiled-function (arg1 &rest rest) "Send MESSAGE, a JSON object, to CONNECTION." #<bytecode 0x2d8814c44a59c28>)(#<jsonrpc-process-connection jsonrpc-process-connection-43645c72> :method textDocument/didChange :params (:textDocument (:uri "buffer://%20*Minibuf-1*" :version 4) :contentChanges [(:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :text "  roles:�")]))
  apply(#f(compiled-function (arg1 &rest rest) "Send MESSAGE, a JSON object, to CONNECTION." #<bytecode 0x2d8814c44a59c28>) #<jsonrpc-process-connection jsonrpc-process-connection-43645c72> (:method textDocument/didChange :params (:textDocument (:uri "buffer://%20*Minibuf-1*" :version 4) :contentChanges [(:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :text "  roles:�")])))
  jsonrpc-connection-send(#<jsonrpc-process-connection jsonrpc-process-connection-43645c72> :method textDocument/didChange :params (:textDocument (:uri "buffer://%20*Minibuf-1*" :version 4) :contentChanges [(:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :text "  roles:�")]))
  jsonrpc-notify(#<jsonrpc-process-connection jsonrpc-process-connection-43645c72> textDocument/didChange (:textDocument (:uri "buffer://%20*Minibuf-1*" :version 4) :contentChanges [(:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :text "  roles:�")]))
  (progn (if (copilot--connection-alivep) nil (copilot--start-agent)) (jsonrpc-notify copilot--connection 'textDocument/didChange (list :textDocument (list :uri (copilot--get-uri) :version copilot--doc-version) :contentChanges content-changes)))
  (let* ((range-start (list :line (- (line-number-at-pos beg) copilot--line-bias) :character (- beg (save-excursion (goto-char beg) (line-beginning-position))))) (range-end (if is-insertion range-start (list :line (- (line-number-at-pos end) copilot--line-bias) :character (- end (save-excursion (goto-char end) (line-beginning-position)))))) (text (if is-insertion (buffer-substring-no-properties beg end) "")) (content-changes (vector (list :range (list :start range-start :end range-end) :text text)))) (setq copilot--doc-version (1+ copilot--doc-version)) (progn (if (copilot--connection-alivep) nil (copilot--start-agent)) (jsonrpc-notify copilot--connection 'textDocument/didChange (list :textDocument (list :uri (copilot--get-uri) :version copilot--doc-version) :contentChanges content-changes))))
  (save-restriction (widen) (let* ((range-start (list :line (- (line-number-at-pos beg) copilot--line-bias) :character (- beg (save-excursion (goto-char beg) (line-beginning-position))))) (range-end (if is-insertion range-start (list :line (- (line-number-at-pos end) copilot--line-bias) :character (- end (save-excursion ... ...))))) (text (if is-insertion (buffer-substring-no-properties beg end) "")) (content-changes (vector (list :range (list :start range-start :end range-end) :text text)))) (setq copilot--doc-version (1+ copilot--doc-version)) (progn (if (copilot--connection-alivep) nil (copilot--start-agent)) (jsonrpc-notify copilot--connection 'textDocument/didChange (list :textDocument (list :uri (copilot--get-uri) :version copilot--doc-version) :contentChanges content-changes)))))
  (progn (save-restriction (widen) (let* ((range-start (list :line (- (line-number-at-pos beg) copilot--line-bias) :character (- beg (save-excursion ... ...)))) (range-end (if is-insertion range-start (list :line (- ... copilot--line-bias) :character (- end ...)))) (text (if is-insertion (buffer-substring-no-properties beg end) "")) (content-changes (vector (list :range (list :start range-start :end range-end) :text text)))) (setq copilot--doc-version (1+ copilot--doc-version)) (progn (if (copilot--connection-alivep) nil (copilot--start-agent)) (jsonrpc-notify copilot--connection 'textDocument/didChange (list :textDocument (list :uri (copilot--get-uri) :version copilot--doc-version) :contentChanges content-changes))))))
  (if (or is-insertion is-deletion) (progn (save-restriction (widen) (let* ((range-start (list :line (- ... copilot--line-bias) :character (- beg ...))) (range-end (if is-insertion range-start (list :line ... :character ...))) (text (if is-insertion (buffer-substring-no-properties beg end) "")) (content-changes (vector (list :range ... :text text)))) (setq copilot--doc-version (1+ copilot--doc-version)) (progn (if (copilot--connection-alivep) nil (copilot--start-agent)) (jsonrpc-notify copilot--connection 'textDocument/didChange (list :textDocument (list :uri ... :version copilot--doc-version) :contentChanges content-changes)))))))
  (let* ((is-before-change (eq chars-replaced nil)) (is-after-change (not is-before-change)) (is-insertion (and is-after-change (not (equal beg end)))) (is-deletion (and is-before-change (not (equal beg end))))) (if (or is-insertion is-deletion) (progn (save-restriction (widen) (let* ((range-start (list :line ... :character ...)) (range-end (if is-insertion range-start ...)) (text (if is-insertion ... "")) (content-changes (vector ...))) (setq copilot--doc-version (1+ copilot--doc-version)) (progn (if (copilot--connection-alivep) nil (copilot--start-agent)) (jsonrpc-notify copilot--connection 'textDocument/didChange (list :textDocument ... :contentChanges content-changes))))))))
  copilot--on-doc-change(13 22 0)
  vertico-insert()
  vertico-exit(nil)
  funcall-interactively(vertico-exit nil)
  command-execute(vertico-exit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions