From 9834eb33242e7c24b35e15877fc7ef1ac0e6e90f Mon Sep 17 00:00:00 2001 From: Snoweuph Date: Sun, 1 Feb 2026 08:59:16 +0100 Subject: [PATCH] lsp/harper-ls: add config option for filetypes --- docs/manual/release-notes/rl-0.9.md | 3 ++ modules/plugins/lsp/harper-ls/config.nix | 3 +- modules/plugins/lsp/harper-ls/harper-ls.nix | 43 ++++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 651f9f4e..42e708d4 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -174,6 +174,9 @@ - Added Makefile support via `languages.make`. +- Added config option to [harper-ls](https://github.com/Automattic/harper) to + limit it to supported filetypes. + [vagahbond](https://github.com/vagahbond): [codewindow.nvim]: https://github.com/gorbit99/codewindow.nvim diff --git a/modules/plugins/lsp/harper-ls/config.nix b/modules/plugins/lsp/harper-ls/config.nix index d6e27bfc..2f12bea3 100644 --- a/modules/plugins/lsp/harper-ls/config.nix +++ b/modules/plugins/lsp/harper-ls/config.nix @@ -11,9 +11,10 @@ in { config = mkIf (cfg.enable && cfg.harper-ls.enable) { vim.lsp.servers.harper-ls = { - root_markers = [".git"]; + root_markers = [".git" ".harper-dictionary.txt"]; cmd = [(getExe pkgs.harper) "--stdio"]; settings = {harper-ls = cfg.harper-ls.settings;}; + filetypes = cfg.harper-ls.filetypes; }; }; } diff --git a/modules/plugins/lsp/harper-ls/harper-ls.nix b/modules/plugins/lsp/harper-ls/harper-ls.nix index 9fab45fe..4522fea6 100644 --- a/modules/plugins/lsp/harper-ls/harper-ls.nix +++ b/modules/plugins/lsp/harper-ls/harper-ls.nix @@ -1,6 +1,6 @@ {lib, ...}: let inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) anything attrsOf; + inherit (lib.types) anything attrsOf nullOr listOf str; in { options.vim.lsp.harper-ls = { enable = mkEnableOption "Harper grammar checking LSP"; @@ -31,5 +31,46 @@ in { }; description = "Settings to pass to harper-ls"; }; + filetypes = mkOption { + type = nullOr (listOf str); + # + default = [ + "asciidoc" + "c" + "clojure" + "cmake" + "cpp" + "cs" + "daml" + "dart" + "gitcommit" + "go" + "haskell" + "html" + "ink" + "java" + "javascript" + "javascriptreact" + "kotlin" + "lhaskell" + "lua" + "mail" + "markdown" + "nix" + "php" + "python" + "ruby" + "rust" + "scala" + "sh" + "swift" + "text" + "toml" + "typescript" + "typescriptreact" + "typst" + ]; + description = "Filetypes to auto-attach LSP server in"; + }; }; }