Skip to content

A dead-simple LSP around wakatime-cli to send code tracking heartbeats

License

Notifications You must be signed in to change notification settings

mrnossiom/wakatime-lsp

Repository files navigation

Wakatime LSP

A dead-simple LSP around wakatime-cli to send code tracking heartbeats

Nix Powered Cachix Cache Time spent on wakatime-lsp Join support Discord

I made this LSP wrapper implementation around wakatime-cli because I wanted support for WakaTime in Helix. That said, it's should be compatible with every LSP implementations.

Installation

With cargo

Install from repository with cargo:

cargo install --git https://github.com/mrnossiom/wakatime-lsp

I don't plan on publishing pre-v1 versions on crates.io.

With nix flakes

A flake.nix is available which means that you can use github:mrnossiom/wakatime-lsp as a flake identifier. That way you can:

  • import this repository in your flake inputs

    {
      wakatime-lsp.url = "github:mrnossiom/wakatime-lsp";
      wakatime-lsp.inputs.nixpkgs.follows = "nixpkgs";
    }

    Add the package to your NixOS or Home Manager packages depending on your installation.

  • use with nix shell for temporary testing

    e.g. nix shell github:mrnossiom/wakatime-lsp

  • use with nix profile for imperative installation

    e.g. nix profile install github:mrnossiom/wakatime-lsp

Package is reachable through packages.${system}.default or packages.${system}.wakatime-lsp.

Download binary from GitHub releases

Find the latest wakatime-lsp release on GitHub here.

You may download the compressed tarball corresponding to your OS.

For non-nixOS setups, you will also need wakatime-cli in path which you can download:

Configuration

Currently wakatime-lsp is not configurable cause it's more of a simple wakatime-cli wrapper which itself is configurable with $WAKATIME_HOME/.wakatime.cfg.

Required configuration is to set your WakaTime api key in $WAKATIME_HOME/.wakatime.cfg, like so:

[settings]
api_key=waka_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

It might be already filled if you've used another wakatime plugin in the past.

Usage

Helix

You can add wakatime-lsp to your languages.toml configuration. Though, it's currently possible to add global LSPs, you can add wakatime for significant languages. Adding global LSPs is blocking on Helix's new config system.

e.g.

[language-server.wakatime]
command = "wakatime-lsp"

[[language]]
name = "markdown"
language-servers = ["marksman", "wakatime"]

[[language]]
name = "rust"
language-servers = ["rust-analyzer", "wakatime"]

[[language]]
name = "nix"
language-servers = ["nil", "wakatime"]

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.