From 48abdc9d32f56e038f4aca478cf6d5a1628b8286 Mon Sep 17 00:00:00 2001 From: William Boman Date: Fri, 29 Apr 2022 13:14:57 +0200 Subject: docs: more deprecations and update some outdated docs --- lua/nvim-lsp-installer.lua | 2 +- lua/nvim-lsp-installer/servers/eslint/README.md | 57 ++--------------------- lua/nvim-lsp-installer/servers/zeta_note/init.lua | 1 - 3 files changed, 6 insertions(+), 54 deletions(-) (limited to 'lua') diff --git a/lua/nvim-lsp-installer.lua b/lua/nvim-lsp-installer.lua index ab566551..f41dbbf7 100644 --- a/lua/nvim-lsp-installer.lua +++ b/lua/nvim-lsp-installer.lua @@ -195,7 +195,6 @@ function M.install_by_filetype(filetype) end --- Queues a server to be installed. Will also open the status window. ---- Use the .on_server_ready(cb) function to register a handler to be executed when a server is ready to be set up. ---@param server_identifier string @The server to install. This can also include a requested version, for example "rust_analyzer@nightly". function M.install(server_identifier) local server_name, version = servers.parse_server_identifier(server_identifier) @@ -266,6 +265,7 @@ function M.uninstall_all(no_confirm) status_win().open() end +---@deprecated Setup servers directly via lspconfig instead. See https://github.com/williamboman/nvim-lsp-installer/discussions/636 ---@param cb fun(server: Server) @Callback to be executed whenever a server is ready to be set up. function M.on_server_ready(cb) dispatcher.register_server_ready_callback(cb) diff --git a/lua/nvim-lsp-installer/servers/eslint/README.md b/lua/nvim-lsp-installer/servers/eslint/README.md index c3a115de..a8c2a301 100644 --- a/lua/nvim-lsp-installer/servers/eslint/README.md +++ b/lua/nvim-lsp-installer/servers/eslint/README.md @@ -1,43 +1,6 @@ # eslint -## Enabling document formatting - -To make the `eslint` server respond to `textDocument/formatting` LSP requests, you need to manually enable this -setting. This is done when setting up the LSP server, like so: - -```lua -local lsp_installer = require "nvim-lsp-installer" - -function common_on_attach(client, bufnr) - -- add your code here -end - -lsp_installer.on_server_ready(function (server) - local opts = { - on_attach = common_on_attach, - } - - if server.name == "eslint" then - opts.on_attach = function (client, bufnr) - -- neovim's LSP client does not currently support dynamic capabilities registration, so we need to set - -- the resolved capabilities of the eslint server ourselves! - client.resolved_capabilities.document_formatting = true - common_on_attach(client, bufnr) - end - opts.settings = { - format = { enable = true }, -- this will enable formatting - } - end - - server:setup(opts) -end) -``` - -This will make `eslint` respond to formatting requests, for example when triggered through: - -- `:lua vim.lsp.buf.formatting()` -- `:lua vim.lsp.buf.formatting_seq_sync()` -- `:lua vim.lsp.buf.formatting_sync()` +*NOTE*: You will have to install the [`eslint` package](https://www.npmjs.com/package/eslint) either locally or globally for the server to run successfully. ## Eslint in projects that use pnp @@ -45,18 +8,8 @@ To allow the `eslint` server to resolve eslint and eslint plugins in a project t command used to run the server. This is done when setting up the LSP server, like so: ```lua -lsp_installer.on_server_ready(function (server) - local opts = { - on_attach = common_on_attach, - } - - if server.name == "eslint" then - local eslint_config = require("lspconfig.server_configurations.eslint") - opts.cmd = { "yarn", "exec", unpack(eslint_config.default_config.cmd) } - end - - server:setup(opts) -end) +local eslint_config = require("lspconfig.server_configurations.eslint") +lspconfig.eslint.setup { + opts.cmd = { "yarn", "exec", unpack(eslint_config.default_config.cmd) } +} ``` - -*NOTE*: You will have to install the [`eslint` package](https://www.npmjs.com/package/eslint) either locally or globally for the server to run successfully. diff --git a/lua/nvim-lsp-installer/servers/zeta_note/init.lua b/lua/nvim-lsp-installer/servers/zeta_note/init.lua index 2658772e..3db58620 100644 --- a/lua/nvim-lsp-installer/servers/zeta_note/init.lua +++ b/lua/nvim-lsp-installer/servers/zeta_note/init.lua @@ -28,7 +28,6 @@ return function(name, root_dir) std.chmod("+x", { "zeta-note" }) end, default_options = { - cmd = { "zeta-note" }, cmd_env = { PATH = process.extend_path { root_dir }, }, -- cgit v1.2.3-70-g09d2