{ pkgs, treefmt }: let dictionary = [ "Asahi" "LLMs" "LTeX" "NixOS" ]; tomlFormatter = pkgs.formats.toml { }; valeDictionary = { directory = "./.vale/styles/config/vocabularies/General"; filename = "accept.txt"; content = builtins.concatStringsSep "\n" dictionary; file = builtins.toFile valeDictionary.filename valeDictionary.content; }; typosConfig = { default.extendWords = builtins.listToAttrs ( builtins.map (x: { name = x; value = x; }) dictionary ); }; typosConfigFile = tomlFormatter.generate "_typos.toml" typosConfig; in { helix.language-server = { # https://ltex-plus.github.io/ltex-plus/supported-languages.html ltex-ls-plus = { command = "${pkgs.ltex-ls-plus}/bin/ltex-ls-plus"; config.ltex.dictionary.en-US = dictionary; }; # https://vale.sh/docs/formats/code vale-ls.command = "${pkgs.vale-ls}/bin/vale-ls"; # https://writewithharper.com/docs/integrations/language-server#Supported-Languages harper-ls.command = "${pkgs.harper}/bin/harper-ls"; }; treefmt.programs.typos = { enable = true; locale = "en-us"; configFile = typosConfigFile.outPath; }; devshell = { commands = [ { help = "sync vale configuration"; name = "vale-sync"; command = "${pkgs.vale}/bin/vale sync"; } ]; packages = [ pkgs.vale ]; devshellStartup = { vale_config.text = '' mkdir -p ${valeDictionary.directory} ${pkgs.uutils-coreutils-noprefix}/bin/ln -fs ${valeDictionary.file} ${valeDictionary.directory}/${valeDictionary.filename} ''; }; }; }