all repos

init.lua @ 7e97c9e54fc94e2460c90392844a4f085e3e8cbf

my nvim config
2 files changed, 55 insertions(+), 63 deletions(-)
refactor(nvim-lsp-installer): update to new version
Author: Smirnov Olexander ss2316544@gmail.com
Committed at: 2022-05-09 12:06:44 +0300
Parent: da80a74
M lua/configs/lsp/init.lua

@@ -1,12 +1,57 @@

require "configs.lsp.diagnostic"() require "configs.lsp.null-ls" -require("nvim-lsp-installer").on_server_ready(function(server) - server:setup(require "configs.lsp.providers"(server, { - on_attach = require "configs.lsp.attach", - flags = { debounce_text_changes = 150 }, - capabilities = require("cmp_nvim_lsp").update_capabilities( - vim.lsp.protocol.make_client_capabilities() - ), - })) - vim.cmd [[ do User LspAttachBuffers ]] -end) +require("nvim-lsp-installer").setup { + ensure_installed = { "sumneko_lua" }, +} + +local lspconfig = require "lspconfig" +local options = { + on_attach = require "configs.lsp.attach", + flags = { debounce_text_changes = 150 }, + capabilities = require("cmp_nvim_lsp").update_capabilities( + vim.lsp.protocol.make_client_capabilities() + ), +} + +local servers = { + rnix = {}, + denols = {}, + yamlls = { + settings = { + yaml = { + schemaStore = { + enable = true, + url = "https://www.schemastore.org/api/json/catalog.json", + }, + }, + }, + }, + gopls = { + settings = { + gopls = { + linksInHover = false, + analyses = { + unusedparams = true, + unreachable = true, + }, + staticcheck = true, + memoryMode = "Normal", + }, + }, + }, + pyright = { + python = { + disableOrganizeImports = true, + autoSearchPaths = true, + analysis = { useLibraryCodeForTypes = false }, + }, + }, +} + +for name, conf in pairs(servers) do + lspconfig[name].setup(vim.tbl_extend("force", options, conf)) +end + +lspconfig.sumneko_lua.setup(require("lua-dev").setup { + lspconfig = options, +})
D

@@ -1,53 +0,0 @@

----@param server Server ----@param opts table ----@return table -return function(server, opts) - if server.name == "sumneko_lua" then - return vim.tbl_extend( - "force", - opts, - require("lua-dev").setup { lspconfig = server:get_default_options() } - ) - end - - if server.name == "pyright" then - return vim.tbl_extend("force", opts, { - python = { - disableOrganizeImports = true, - autoSearchPaths = true, - analysis = { useLibraryCodeForTypes = false }, - }, - }) - end - - if server.name == "gopls" then - return vim.tbl_extend("force", opts, { - settings = { - gopls = { - linksInHover = false, - analyses = { - unusedparams = true, - unreachable = true, - }, - staticcheck = true, - memoryMode = "Normal", - }, - }, - }) - end - - if server.name == "yamlls" then - return vim.tbl_extend("force", opts, { - settings = { - yaml = { - schemaStore = { - enable = true, - url = "https://www.schemastore.org/api/json/catalog.json", - }, - }, - }, - }) - end - - return opts -end