mrnossiom / wakatime-lsp

A dead-simple LSP around wakatime-cli to send code tracking heartbeats
CeCILL Free Software License Agreement v2.1
10 stars 0 forks source link

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: ```sh cargo install --git https://github.com/mrnossiom/wakatime-lsp ``` While `wakatime-lsp` seems to work fine for my use case right now, I don't want to publish on `crates.io` rightaway. You will also need `wakatime-cli` in path which you can download: - With you prefered package manager at [`wakatime` repology](https://repology.org/project/wakatime/versions) or [`wakatime-cli` repology](https://repology.org/project/wakatime-cli/versions) - or from [WakaTime repository artefacts](https://github.com/wakatime/wakatime-cli/releases/latest)
With nix flakes A `flake.nix` is available which means that you can use `github:mrnossiom/wakatime-lsp` as a flake identifier, so you can. - import this repository in your flake inputs ```nix { wakatime-lsp.url = "github:mrnossiom/wakatime-lsp"; wakatime-lsp.inputs.nixpkgs.follows = "nixpkgs"; } ``` Add the package to your [NixOS](https://nixos.org/) or [Home Manager](https://github.com/nix-community/home-manager) packages depending on your installation. - use with `nix shell`/`nix run` 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`.

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.