Automatic coding-time tracking for codetime.dev, ported from codetime-vscode.
Open files in Zed and your activity (project, language, file, git branch/origin, read vs. write) is reported to the CodeTime API. View the stats on your dashboard.
Zed extensions cannot subscribe to editor events or draw a status-bar item the way the VS Code API allows. The only hook into editing activity that Zed exposes to extensions is the language server protocol. So this project ships two parts:
| Part | Crate | Role |
|---|---|---|
| Zed extension | codetime-zed (WASM) |
Registers and launches the language server for every language. |
| Language server | codetime-ls (native) |
Receives didOpen/didChange/didSave, POSTs event logs to the CodeTime API. |
Consequence: there is no in-editor status bar with your total time — that VS Code feature has no Zed equivalent. Tracking (the core feature) works the same.
If you have already signed in with another CodeTime client (the CLI, the VS Code
extension, …), a token is in ~/.codetime/config.json and this extension picks
it up automatically — no setup needed.
To set it explicitly, get your token from codetime.dev
and add it to Zed's settings.json:
{
"lsp": {
"CodeTime": {
"initialization_options": {
"token": "<your-token>"
}
}
}
}The token is resolved in this order, first match wins:
initialization_options.tokeninsettings.json(above)- the
CODETIME_TOKENenvironment variable in the shell Zed inherits - the
tokenfield of~/.codetime/config.json
Optional key under initialization_options: api_url overrides the API base
(default https://api.codetime.dev). An HTTPS_PROXY / HTTP_PROXY env var is
honored automatically.
The published flow downloads a prebuilt codetime-ls from GitHub releases. To
run from source:
-
Build and expose the language server on your
PATH(the extension prefers acodetime-lsfound there before downloading one):cargo install --path codetime-ls # or: cargo build -p codetime-ls --release && cp target/release/codetime-ls ~/.local/bin/ -
In Zed, open the command palette → zed: install dev extension and select this repository's root. Zed compiles
src/lib.rsto WASM and loads it. -
Add your token (see above) and start editing. Watch the language server log (command palette → dev: open language server logs →
CodeTime) to confirm events are sent.
cargo build -p codetime-ls # native language server
rustup target add wasm32-wasip1 # once
cargo build -p codetime-zed --target wasm32-wasip1 # the extension itself