From f00ecd4eb92e53a23add212ebfdb7cb9ac799902 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 24 Jun 2024 16:55:45 +0300 Subject: [PATCH 1/2] languages/ts: add `ts-error-translator.nvim` as an extension plugin --- flake.lock | 17 ++++++++++++++++ flake.nix | 5 +++++ modules/plugins/languages/ts.nix | 33 +++++++++++++++++++++++++++++--- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index dc71af0..0a83798 100644 --- a/flake.lock +++ b/flake.lock @@ -1597,6 +1597,22 @@ "type": "github" } }, + "plugin-ts-error-translator": { + "flake": false, + "locked": { + "lastModified": 1712269172, + "narHash": "sha256-NJ0qfKvkwZ/0GolAeATlQLyQ7nGN6Z6q3uRqI+73wPk=", + "owner": "dmmulroy", + "repo": "ts-error-translator.nvim", + "rev": "11ae55b28bde02663b5f983f59b0e3fd9c4e845b", + "type": "github" + }, + "original": { + "owner": "dmmulroy", + "repo": "ts-error-translator.nvim", + "type": "github" + } + }, "plugin-vim-dirtytalk": { "flake": false, "locked": { @@ -1840,6 +1856,7 @@ "plugin-toggleterm-nvim": "plugin-toggleterm-nvim", "plugin-tokyonight": "plugin-tokyonight", "plugin-trouble": "plugin-trouble", + "plugin-ts-error-translator": "plugin-ts-error-translator", "plugin-vim-dirtytalk": "plugin-vim-dirtytalk", "plugin-vim-fugitive": "plugin-vim-fugitive", "plugin-vim-illuminate": "plugin-vim-illuminate", diff --git a/flake.nix b/flake.nix index 9df0448..3a5dfcd 100644 --- a/flake.nix +++ b/flake.nix @@ -183,6 +183,11 @@ flake = false; }; + plugin-ts-error-translator = { + url = "github:dmmulroy/ts-error-translator.nvim"; + flake = false; + }; + # Copying/Registers plugin-registers = { url = "github:tversteeg/registers.nvim"; diff --git a/modules/plugins/languages/ts.nix b/modules/plugins/languages/ts.nix index 139c409..c9942ec 100644 --- a/modules/plugins/languages/ts.nix +++ b/modules/plugins/languages/ts.nix @@ -9,10 +9,11 @@ inherit (lib.modules) mkIf mkMerge; inherit (lib.lists) isList; inherit (lib.meta) getExe; - inherit (lib.types) enum either listOf package str; - inherit (lib.nvim.lua) expToLua; - inherit (lib.nvim.types) mkGrammarOption diagnostics; + inherit (lib.types) enum either listOf package str bool; + inherit (lib.nvim.lua) expToLua toLuaObject; + inherit (lib.nvim.types) mkGrammarOption diagnostics mkPluginSetupOption; inherit (lib.nvim.languages) diagnosticsToLua; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.languages.ts; @@ -32,6 +33,7 @@ } ''; }; + denols = { package = pkgs.deno; lspConfig = '' @@ -143,6 +145,24 @@ in { inherit defaultDiagnosticsProvider; }; }; + + extensions = { + ts-error-translator = { + enable = mkEnableOption '' + Typescript error translation with + [ts-error-translator.nvim](github.com/dmmulroy/ts-error-translator.nvim) + ''; + + setupOpts = mkPluginSetupOption "ts-error-translator" { + # This is the default configuration behaviour. + auto_override_publish_diagnostics = mkOption { + description = "Automatically override the publish_diagnostics handler"; + type = bool; + default = true; + }; + }; + }; + }; }; config = mkIf cfg.enable (mkMerge [ @@ -169,5 +189,12 @@ in { inherit diagnosticsProviders; }; }) + + (mkIf cfg.extensions."ts-error-translator".enable { + vim.startPlugins = ["ts-error-translator"]; + vim.luaConfigRC.ts-error-translator = entryAnywhere '' + require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts}) + ''; + }) ]); } From ba803c8684edd7f4d82863d7ae7494409cbbb06f Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 24 Jun 2024 17:00:01 +0300 Subject: [PATCH 2/2] docs: update release notes Mention ts-error-translator's addition to the module system --- docs/release-notes/rl-0.7.md | 39 ++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index a0f6fca..2ce8aa5 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -15,15 +15,27 @@ Release notes for release 0.7 [](#opt-vim.visuals.fidget-nvim.setupOpts.progress.display.overrides) from `anything` to a `submodule` for better type checking. - Fix null `vim.lsp.mappings` generating an error and not being filtered out. -- Add basic transparency support for `oxocarbon` theme by setting the - highlight group for `Normal`, `NormalFloat`, `LineNr`, `SignColumn` and - optionally `NvimTreeNormal` to `none`. +- Add basic transparency support for `oxocarbon` theme by setting the highlight + group for `Normal`, `NormalFloat`, `LineNr`, `SignColumn` and optionally + `NvimTreeNormal` to `none`. [horriblename](https://github.com/horriblename): - Fix broken treesitter-context keybinds in visual mode -- Depcrecate use of `__empty` to define empty tables in lua. Empty attrset are - no longer filtered and thus should be used instead. +- Deprecate use of `__empty` to define empty tables in lua. Empty attrset are no + longer filtered and thus should be used instead. + +[jacekpoz](https://github.com/jacekpoz): + +- Add [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) support. + +- Fix Emac typo + +[diniamo](https://github.com/diniamo): + +- Move the `theme` dag entry to before `luaScript`. + +- Add rustfmt as the default formatter for Rust [NotAShelf](https://github.com/notashelf) @@ -39,19 +51,12 @@ Release notes for release 0.7 added once the [credo](https://github.com/rrrene/credo) linter has been added to nixpkgs. A pull request is currently open. -- Remove vim-tidal and friends +- Remove vim-tidal and friends. - Clean up Lualine module to reduce theme dependency on Catppuccin, and fixed blending issues in component separators. -[jacekpoz](https://github.com/jacekpoz): - -- Add [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) support. - -- Fix Emac typo - -[diniamo](https://github.com/diniamo): - -- Move the `theme` dag entry to before `luaScript`. - -- Add rustfmt as the default formatter for Rust +- Add + [ts-error-translator.nvim](https://github.com/dmmulroy/ts-error-translator.nvim) + extension of the TS language module, under + `vim.languages.ts.extensions.ts-error-translator`