Skip to content

sourcegraph/emacs-cody

Repository files navigation

cody.el: Sourcegraph Cody in Emacs

Do not use this yet; it is in development.

Status

  • completely broken at the moment from all the protocol changes

Configuration

Cody uses a distributed copy of the Cody agent as compressed javascript, but you can override this by specifying the location of the agent binary, e.g.:

(setq cody--agent-binary "/path/to/eg/cody/agent/dist/agent-macos-arm64")

Access token

Add to your ~/.authinfo.gpg something that looks like

machine `cody--sourcegraph-host' login apikey password sgp_SECRET

You can bypass this check by setting your access token directly, though this is less secure

(setq cody--access-token "sgp_etc")

To try it out, evaluate the buffer and `M-x cody-login’.

TODO: gnugpg and/or local host keychain support

Sample Configuration

You can create a Sourcegraph access token at https://sourcegraph.com/users/yourname/settings/tokens.

;; Tell `use-package' where to find your clone of `cody.el'.
(add-to-list 'load-path (expand-file-name "~/my/path/to/emacs-cody"))

(use-package cody
  :commands (cody-login cody-restart cody-chat cody-mode)
  ;; Some common key bindings.
  :bind (("C-M-n" . cody-completion-cycle-next-key-dispatch)
         ("C-M-p" . cody-completion-cycle-prev-key-dispatch)
         ("M-TAB" . cody-completion-accept-key-dispatch)
         ("C-M-g" . cody-quit-key-dispatch))
  :init
  (setq cody--sourcegraph-host "sourcegraph.com") ; for clarity; this is the default.
  (setq cody--access-token "sgp_asldkfjalsdkjfaslkdjfalsdkfj")
  (setopt cody-workspace-root "/your/path/to/some/project/dir") ; optional
  :config
  (defalias 'cody-start 'cody-login))

Available commands

Autocompletion is the main use case for now. Chat is just a stub.

  • `M-x cody-login` will start Cody up and apply it to applicable buffers.
  • `M-x cody-logout` shuts Cody down.
  • `M-x cody-mode` toggles Cody on and off in a given buffer.

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •