From 6bd01094a5f64ec57812a5558e82e4dd9dd2ae95 Mon Sep 17 00:00:00 2001 From: William Boman Date: Thu, 28 Apr 2022 14:06:02 +0200 Subject: [PATCH] demo: migrate to new way of setting up LSP servers --- a.lua | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/a.lua b/a.lua index 7ce3e7e09..bb1e5959b 100644 --- a/a.lua +++ b/a.lua @@ -1,6 +1,4 @@ -local lsp_installer = require("nvim-lsp-installer") - -lsp_installer.settings { +require("nvim-lsp-installer").setup { ui = { icons = { server_installed = "", @@ -9,32 +7,32 @@ lsp_installer.settings { }, }, } +local lspconfig = require("lspconfig") local function on_attach(client, bufnr) -- set up buffer keymaps, etc. end -lsp_installer.on_server_ready(function (server) - local opts = { - on_attach = on_attach - } +local tsutils = require "nvim-lsp-ts-utils" +lspconfig.tsserver.setup { + init_options = { hostInfo = "neovim" }, + on_attach = function (client, bufnr) + tsutils.setup {} + tsutils.setup_client(client) + end +} - if server.name == "tsserver" then - local tsutils = require "nvim-lsp-ts-utils" - opts.init_options = { hostInfo = "neovim" } - opts.on_attach = function (client, bufnr) - tsutils.setup {} - tsutils.setup_client(client) - end - elseif server.name == "sumneko_lua" then - opts.settings = { - Lua = { - diagnostics = { - globals = { "vim" } - } +lspconfig.sumneko_lua.setup { + on_attach = on_attach, + settings = { + Lua = { + diagnostics = { + globals = { "vim" } } } - end + } +} - server:setup(opts) -end) +lspconfig.graphql.setup { on_attach = on_attach } +lspconfig.jsonls.setup { on_attach = on_attach } +lspconfig.cssls.setup { on_attach = on_attach }