Skip to content

Commit

Permalink
Merge pull request #313 from NotAShelf/ts-error-translator
Browse files Browse the repository at this point in the history
languages/ts: add `ts-error-translator.nvim` as an extension plugin
  • Loading branch information
NotAShelf authored Jun 24, 2024
2 parents 35c7327 + ba803c8 commit 7b719d0
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 20 deletions.
39 changes: 22 additions & 17 deletions docs/release-notes/rl-0.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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`
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
33 changes: 30 additions & 3 deletions modules/plugins/languages/ts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -32,6 +33,7 @@
}
'';
};

denols = {
package = pkgs.deno;
lspConfig = ''
Expand Down Expand Up @@ -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 [
Expand All @@ -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})
'';
})
]);
}

0 comments on commit 7b719d0

Please sign in to comment.