diff --git a/configuration.nix b/configuration.nix index 256f0b51..750862af 100644 --- a/configuration.nix +++ b/configuration.nix @@ -31,6 +31,7 @@ isMaximal: { lspSignature.enable = !isMaximal; # conflicts with blink in maximal otter-nvim.enable = isMaximal; nvim-docs-view.enable = isMaximal; + harper-ls.enable = isMaximal; }; debugger = { diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 78009b5f..f047d72b 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -528,6 +528,12 @@ - Fixed `typescript` treesitter grammar not being included by default. +[gmvar](https://github.com/gmvar): + +[harper-ls]: https://github.com/Automattic/harper + +- Add [harper-ls] to the `vim.lsp` module. + [derethil](https://github.com/derethil): - Fix `vim.lazy.plugins..enabled` Lua evaluation. diff --git a/modules/plugins/lsp/default.nix b/modules/plugins/lsp/default.nix index eb694583..ed20685d 100644 --- a/modules/plugins/lsp/default.nix +++ b/modules/plugins/lsp/default.nix @@ -7,6 +7,7 @@ ./lspconfig ./lspsaga ./null-ls + ./harper-ls # lsp plugins ./lspsaga diff --git a/modules/plugins/lsp/harper-ls/config.nix b/modules/plugins/lsp/harper-ls/config.nix new file mode 100644 index 00000000..d6e27bfc --- /dev/null +++ b/modules/plugins/lsp/harper-ls/config.nix @@ -0,0 +1,19 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.meta) getExe; + + cfg = config.vim.lsp; +in { + config = mkIf (cfg.enable && cfg.harper-ls.enable) { + vim.lsp.servers.harper-ls = { + root_markers = [".git"]; + cmd = [(getExe pkgs.harper) "--stdio"]; + settings = {harper-ls = cfg.harper-ls.settings;}; + }; + }; +} diff --git a/modules/plugins/lsp/harper-ls/default.nix b/modules/plugins/lsp/harper-ls/default.nix new file mode 100644 index 00000000..9b4b3ec7 --- /dev/null +++ b/modules/plugins/lsp/harper-ls/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./harper-ls.nix + ./config.nix + ]; +} diff --git a/modules/plugins/lsp/harper-ls/harper-ls.nix b/modules/plugins/lsp/harper-ls/harper-ls.nix new file mode 100644 index 00000000..9fab45fe --- /dev/null +++ b/modules/plugins/lsp/harper-ls/harper-ls.nix @@ -0,0 +1,35 @@ +{lib, ...}: let + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) anything attrsOf; +in { + options.vim.lsp.harper-ls = { + enable = mkEnableOption "Harper grammar checking LSP"; + settings = mkOption { + type = attrsOf anything; + default = {}; + example = { + userDictPath = ""; + workspaceDictPath = ""; + fileDictPath = ""; + linters = { + BoringWords = true; + PossessiveNoun = true; + SentenceCapitalization = false; + SpellCheck = false; + }; + codeActions = { + ForceStable = false; + }; + markdown = { + IgnoreLinkTitle = false; + }; + diagnosticSeverity = "hint"; + isolateEnglish = false; + dialect = "American"; + maxFileLength = 120000; + ignoredLintsPath = {}; + }; + description = "Settings to pass to harper-ls"; + }; + }; +}