In the current implementation, the extension always downloads its own wakatime-cli binary on first run, regardless of whether the user already has it installed system-wide. This causes several issues:
- Duplication: If the user already has
wakatime-cli installed via their OS package manager, the extension still downloads its own copy, wasting disk space.
- Compatibility issues: On some Linux distributions (e.g., NixOS, as well as certain containerized environments), the downloaded binary may not be executable due to differences in system libraries or the dynamic linker.
- Update complexity: The user cannot manage
wakatime-cli versions through their system package manager and must rely on the extension's update mechanism.
- Offline/restricted environments: If the user works offline or behind a restrictive firewall, the extension fails to download the binary, making it useless even though a system
wakatime-cli may already be present.
I propose changing the extension's logic as follows:
- On initialization, the extension first checks whether the
wakatime-cli executable is available in the user's PATH.
- If found, the extension uses that system binary without downloading its own copy.
- If not found, the extension falls back to downloading its own version, as it does now.
This approach would:
-
Eliminate duplication and save disk space.
-
Ensure compatibility with environments where the user has already ensured a working binary.
-
Give users control over version and updates through their standard OS mechanisms.
-
Allow offline use if wakatime-cli is already installed.
An additional option could be to add a configuration setting where the user can manually specify the path to wakatime-cli (with a default of looking in PATH). This would be even more flexible and cover cases where the binary is installed in a non‑standard location.
For example, Zed already supports a similar mechanism for LSP servers. Users can specify a custom binary path in their settings like this:
"lsp": {
"clangd": {
"binary": {
"ignore_system_version": false,
"path": "/run/current-system/sw/bin/clangd"
}
}
}
A similar configuration option ("wakatime_cli_path") could be added for this extension, allowing users to point to a system‑wide installation.
Additional context
-
This approach is already used in many other WakaTime plugins for editors such as VSCode, Sublime Text, and IntelliJ — they first look for a system‑wide wakatime-cli and only download their own if it is missing.
-
It is a standard practice for plugins that integrate with external CLI tools and significantly improves user experience.
This change would require only a small modification to the initialization code — checking PATH and falling back to the download if needed.
In the current implementation, the extension always downloads its own
wakatime-clibinary on first run, regardless of whether the user already has it installed system-wide. This causes several issues:wakatime-cliinstalled via their OS package manager, the extension still downloads its own copy, wasting disk space.wakatime-cliversions through their system package manager and must rely on the extension's update mechanism.wakatime-climay already be present.I propose changing the extension's logic as follows:
wakatime-cliexecutable is available in the user'sPATH.This approach would:
Eliminate duplication and save disk space.
Ensure compatibility with environments where the user has already ensured a working binary.
Give users control over version and updates through their standard OS mechanisms.
Allow offline use if
wakatime-cliis already installed.An additional option could be to add a configuration setting where the user can manually specify the path to
wakatime-cli(with a default of looking inPATH). This would be even more flexible and cover cases where the binary is installed in a non‑standard location.For example, Zed already supports a similar mechanism for LSP servers. Users can specify a custom binary path in their settings like this:
A similar configuration option (
"wakatime_cli_path") could be added for this extension, allowing users to point to a system‑wide installation.Additional context
This approach is already used in many other WakaTime plugins for editors such as VSCode, Sublime Text, and IntelliJ — they first look for a system‑wide
wakatime-cliand only download their own if it is missing.It is a standard practice for plugins that integrate with external CLI tools and significantly improves user experience.
This change would require only a small modification to the initialization code — checking
PATHand falling back to the download if needed.