all repos

init.lua @ 1726311d20d474e24f709b687c05e1dd22eeaff0

my nvim config
4 files changed, 37 insertions(+), 16 deletions(-)
updated lsp config
Author: neoteny ss2316544@gmail.com
Committed at: 2021-11-10 17:09:49 +0200
Parent: 71682e7
M lua/lsp/config.lua

@@ -30,9 +30,14 @@

require("nvim-lsp-installer").on_server_ready(function(server) local opts = { on_attach = on_attach } - local ok, user_opts = pcall(require, "lsp.providers." .. server.name) - if ok then - opts = vim.tbl_deep_extend("force", opts, user_opts) + if server.name == "jsonls" then + opts = vim.tbl_deep_extend("force", opts, require "lsp.providers.jsonls" or {}) + elseif server.name == "yamlls" then + opts = vim.tbl_deep_extend("force", opts, require "lsp.providers.yamlls" or {}) + elseif server.name == "tsserver" then + opts = vim.tbl_deep_extend("force", opts, require "lsp.providers.tsserver" or {}) + elseif server.name == "sumneko_lua" then + opts = vim.tbl_deep_extend("force", opts, require "lsp.providers.sumneko_lua" or {}) end server:setup(opts)
M lua/lsp/providers/jsonls.lua

@@ -1,3 +1,12 @@

+return { + settings = { + schemas = { + { fileMatch = { "package.json" }, url = "https://json.schemastore.org/package.json" }, + }, + }, +} + +--[[ return { settings = { json = {

@@ -35,4 +44,4 @@ },

}, }, }, -} +}]]
D

@@ -1,12 +0,0 @@

-return { - settings = { - ["rust-analyzer"] = { - assist = { - importGranularity = "module", - importPrefix = "by_self", - }, - cargo = { loadOutDirsFromCheck = true }, - procMacro = { enable = true }, - }, - }, -}
A lua/lsp/providers/tsserver.lua

@@ -0,0 +1,19 @@

+return { + setup = { + handlers = { + ["textDocument/publishDiagnostics"] = function(_, _, p, id, _, cfg) + if p.diagnostics ~= nil then + local i = 1 + while i <= #p.diagnostics do + if p.diagnostics[i].code == 80001 then + table.remove(p.diagnostics, i) + else + i = i + 1 + end + end + end + vim.lsp.diagnostic.on_publish_diagnostics(_, _, p, id, _, cfg) + end, + }, + }, +}