A dead-simple language server around wakatime-cli to send code tracking heartbeats
I made this language server wrapper implementation around wakatime-cli because I wanted support for WakaTime in Helix. That said, it's should be compatible with every LSP implementation.
wakatime-ls listens to open, change, save and close file events. It then reflects this activity by sending heartbeats via the wakatime-cli.
With cargo
Install from repository with cargo:
# from crates.io
cargo install wakatime-ls
# or from source
cargo install --git https://github.com/mrnossiom/wakatime-lsWith nix flakes
A flake.nix is available which means that you can use github:mrnossiom/wakatime-ls as a flake identifier. Package is reachable through packages.${system}.default or packages.${system}.wakatime-ls. That way you can:
-
import this repository in your flake inputs
{ wakatime-ls.url = "github:mrnossiom/wakatime-ls"; wakatime-ls.inputs.nixpkgs.follows = "nixpkgs"; }
Add the package to your NixOS or Home Manager packages depending on your installation.
-
use with
nix shellfor temporary testinge.g.
nix shell github:mrnossiom/wakatime-ls -
use with
nix profilefor imperative installatione.g.
nix profile install github:mrnossiom/wakatime-ls
Download binary from GitHub releases
Find the latest wakatime-ls release on GitHub here.
You may download the compressed tarball corresponding to your OS.
You will also need wakatime-cli in your $PATH for setups others than Nix, which already bundles it. You can download wakatime-cli:
- with your preferred package manager (see
wakatime-clirepology) - from the
wakatime-clireleases page
Currently wakatime-ls is not configurable cause it's more of a simple wakatime-cli wrapper which itself is configurable with $WAKATIME_HOME/.wakatime.cfg (see docs). ($WAKATIME_HOME defaults to $HOME)
It might be already filled if you've used another WakaTime plugin in the past.
Required configuration is to set your WakaTime api key in $WAKATIME_HOME/.wakatime.cfg, like so:
[settings]
api_key=waka_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxYou need to add wakatime-ls to your languages.toml configuration (see docs). Though, it's not currently possible to add global language servers, you can add wakatime for your most significant languages.
Helix does not merge values, you also need to specify the original language servers defined for the language. You can find them in the default languages.toml
Adding global language servers is blocking on Helix's new config system.
e.g.
[language-server.wakatime]
command = "wakatime-ls"
[[language]]
name = "markdown"
language-servers = ["marksman", "wakatime"]
[[language]]
name = "rust"
language-servers = ["rust-analyzer", "wakatime"]
[[language]]
name = "nix"
language-servers = ["nil", "wakatime"]
# add as many entries as the number of the languages you usewakatime-ls is a language server, it's easy to quickly integrate into any editor that support the language server protocol.
Feel free to make a PR for your own favorite editor.
Work is licensed under CECILL-2.1, a French OSS license that allows modification and distribution of the software while requiring the same license for derived works.