Extension APIs to Support Coder #26290
ConradIrwin
started this conversation in
Extensions and Themes
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Coder would like to be able to provide seamless integration with Zed, as they do for other IDEs.
Today you can deep link from Coder to Zed with
zed://ssh/coder.X/Y
. This works only if you have thecoder-cli
installed and have authenticated in the last 7 days.Phase 1: Show coder workspaces in Zed
We could reasonably easily make this work for users who are already authenticated with the CLI by adding an extension API:
extension.get_remote_projects() -> Result<Vec<SshConnection>>
This would use the new process:exec capability to shell out to the CLI, and show a notification prompting them to auth in the terminal if they are not currently authenticated.
Phase 2: Handling authentication in Zed
I'm least sure about how to make this work. Perhaps the simplest is to treat the token as a "setting", so in the manifest the extension could say something like:
One of the downside of this is the tokens expire after 7 days, and so the extension will want to keep its own notion of the current token somewhere (ideally in keychain, though today coder CLI just writes the auth token to disk).
Another option would be to try and provide the building blocks needed to support oauth2, though I'm not sure that coder supports the auto-redirect vs just the device-based copy token flow.
There's obviously a lot of details to get right with this approach...
Phase 3: Tighter integration with Coder
Currently the VSCode extension can intercept links from the Coder UI. This means that they can send the authentication token to the extension to avoid the authentication step in the common case. If we've already solved auth, we could probably make this work by allowing URLs to trigger extensions based on their id:
zed://extension/coder/<your-url-goes-here>
, and adding two extension APIs:extension.handle_open_url(url)
called when zed receives an open with such a URLZedApi::open_url(url)
to allow the extension to callzed://ssh/..
Beta Was this translation helpful? Give feedback.
All reactions