Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Commit

Permalink
demo: migrate to new way of setting up LSP servers
Browse files Browse the repository at this point in the history
  • Loading branch information
williamboman committed Apr 28, 2022
1 parent be7c10b commit 6bd0109
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions a.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
local lsp_installer = require("nvim-lsp-installer")

lsp_installer.settings {
require("nvim-lsp-installer").setup {
ui = {
icons = {
server_installed = "",
Expand All @@ -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 }

0 comments on commit 6bd0109

Please sign in to comment.