jose-elias-alvarez / nvim-lsp-ts-utils

Utilities to improve the TypeScript development experience for Neovim's built-in LSP client.
The Unlicense
438 stars 18 forks source link

Breaking changes #87

Open jose-elias-alvarez opened 2 years ago

jose-elias-alvarez commented 2 years ago

84fa70cae6ba9b53f4c3027b86427d3ffdb2535b deprecates this plugin's null-ls integrations (and ef4f4ac3191c09c44003f9e348f6c3c62a6b18f0 removes them completely).

Since I spun null-ls off from this plugin, I've received requests from users who wanted to configure the sources included here separately. It's now possible to set up diagnostics, formatting, and ESLint code actions exclusively via null-ls. As a result, I've deprecated the integrations here.

To replicate the previous functionality and migrate to the null-ls API (the recommended option), remove all ESLint / formatter-related settings from your nvim-lsp-ts-utils config and use the following as a basis:

local null_ls = require("null-ls")
null_ls.config({
    sources = {
        null_ls.builtins.diagnostics.eslint.with({ -- eslint or eslint_d
            prefer_local = "node_modules/.bin",
        }),
        null_ls.builtins.code_actions.eslint.with({ -- eslint or eslint_d
            prefer_local = "node_modules/.bin",
        }),
        null_ls.builtins.formatting.prettier.with({ -- prettier, eslint, eslint_d, or prettierd
            prefer_local = "node_modules/.bin",
        }),
    },
})
require("lspconfig")["null-ls"].setup({ on_attach = on_attach })

This will register sources for diagnostics, formatting, and code actions that automatically use project-local executables when available and fall back to global executables. Other options you may have set in eslint_opts / formatter_opts can now be passed directly into with.

You can use your plugin manager to pin to 825630a5d28634fbb3663d1e605ff0a82b843d81, the last commit before the deprecation, but you won't receive further updates, so I recommend migrating.

You may also want to consider migrating to the ESLint language server, which can also provide ESLint diagnostics, code actions, and formatting. I've personally switched and find it fast and stable enough to use for daily work.

I hope that shifting integrations entirely to null-ls can help this plugin stay focused and continue to grow. In the future, I'd like to make it a "full" LSP plugin like rust-tools.nvim that automatically sets up tsserver + additional functionality, and removing the burden of coordinating integrations with another plugin will help.

jose-elias-alvarez commented 2 years ago

627963630691c3f3113a8b549fca4246ed4960eb switches to the new vim.diagnostic API. As a consequence, the plugin now depends on Neovim 0.6.0.

If you don't want to or cannot update, you can pin the plugin to 7c52536cf40cc1cad3f39ba4e044ce7e92c99758, but Neovim 0.6.0 contains a lot of improvements, so you should aim to update as soon as you can.