OlegGulevskyy / better-ts-errors.nvim

MIT License
109 stars 5 forks source link

better-ts-errors.nvim

> If you are unlucky enough to work with TypeScript and stuck in Vim mode (using Neovim tho), then at least have a better formatted TypeScript errors. https://gifyu.com/image/Sipos https://gifyu.com/image/Sipox

Demo screenshots

Click to see demo images demo 1 demo 2

⚑️ Features

Will be added when possible..

πŸ“‹ Installation

If you want JS Objects in error messages to be formatted, ensure you have Prettier installed and available in PATH.

npm install -g prettier

I haven't used any other package managers than folke/lazy.nvim, so not sure exactly how to install it via others, because you need to specify dependency.

Package manager Snippet
[wbthomason/packer.nvim](https://github.com/wbthomason/packer.nvim) ```lua -- stable version -- No idea how to set dependency in packer, pls let me know if you use it -- You need to have "MunifTanjim/nui.nvim" as Dependency use {"OlegGulevskyy/better-ts-errors.nvim" } ```
[junegunn/vim-plug](https://github.com/junegunn/vim-plug) ```lua -- No idea how to set dependency in vim-plug, pls let me know if you use it -- You need to have "MunifTanjim/nui.nvim" as Dependency Plug "better-ts-errors.nvim", { "tag": "*" } ```
[folke/lazy.nvim](https://github.com/folke/lazy.nvim) ```lua -- stable version return { "OlegGulevskyy/better-ts-errors.nvim", dependencies = { "MunifTanjim/nui.nvim" }, config = { keymaps = { toggle = 'dd', -- default 'dd' go_to_definition = 'dx' -- default 'dx' } } } ```

β˜„ Getting started

Simple thing at the moment - set your keymap via config options keymap and use it to toggle pretty TS error message

βš™ Configuration

The configuration list sometimes become cumbersome, making it folded by default reduce the noise of the README file.

Click to unfold the full list of options with their default values > **Note**: The options are also available in Neovim by calling `:h better-ts-errors.options` ```lua require("better-ts-errors").setup({ keymaps = { toggle = 'dd', -- Toggling keymap go_to_definition = 'dx' -- Go to problematic type from popup window } }) ```

⌨ Contributing

PRs and issues are always welcome. Make sure to provide as much context as possible when opening one.

🎭 Motivations

I am forced to work with TypeScript, and at times it can be quite alright, but one thing that sucks from it is its error messages. This small plugin is inspired by pretty-ts-errors for VSCode users. https://github.com/yoavbls/pretty-ts-errors

So, I'd like to have some niceties in Neovim also, that's it for Motivations section.

Few things to note:

πŸͺΆ Sort of roadmap