From b8eb1bbc58d9cbd07564eb911926e1e7198187e9 Mon Sep 17 00:00:00 2001 From: zhaozg Date: Sat, 14 Nov 2020 15:45:41 +0800 Subject: [PATCH] remove diagnostic-nvim nvim-lua/diagnostic.nvim is deprecated. [migration guide](https://github.com/nvim-lua/diagnostic-nvim/issues/73) --- layers/Enhance/lsp/init.vim | 5 ---- layers/Enhance/lsp/packages.vim | 1 - lua/neospace/lsp.lua | 46 --------------------------------- 3 files changed, 52 deletions(-) diff --git a/layers/Enhance/lsp/init.vim b/layers/Enhance/lsp/init.vim index 262c046..d02781e 100644 --- a/layers/Enhance/lsp/init.vim +++ b/layers/Enhance/lsp/init.vim @@ -1,8 +1,3 @@ -let g:diagnostic_enable_virtual_text = 1 -let g:diagnostic_virtual_text_prefix = '⛔' -let g:diagnostic_insert_delay = 1 -let g:space_before_virtual_text = 5 - let g:neospace.lsp_enable = get(g:, "neospace.lsp_enable", { \ 'lua': 1, \ 'sh': 1, diff --git a/layers/Enhance/lsp/packages.vim b/layers/Enhance/lsp/packages.vim index fbd4157..690b656 100644 --- a/layers/Enhance/lsp/packages.vim +++ b/layers/Enhance/lsp/packages.vim @@ -1,3 +1,2 @@ MP 'neovim/nvim-lspconfig' -MP 'nvim-lua/diagnostic-nvim' MP 'nvim-lua/lsp-status.nvim' diff --git a/lua/neospace/lsp.lua b/lua/neospace/lsp.lua index c6c49ea..cb23237 100644 --- a/lua/neospace/lsp.lua +++ b/lua/neospace/lsp.lua @@ -1,54 +1,8 @@ -local nvim = require'nvim' -local vim = nvim.vim -local api = vim.api - local nvim_lsp = require('nvim_lsp') -local on_attach = function(client, bufnr) - bufnr = bufnr or 0 - - local resolved_capabilities = client.resolved_capabilities - - -- Mappings. - local opts = {noremap = true, silent = true} - api.nvim_buf_set_keymap(bufnr, "n", "gD", - "lua show_diagnostics_details()", opts) - api.nvim_buf_set_keymap(bufnr, "n", "gd", - "lua vim.lsp.buf.definition()", opts) - api.nvim_buf_set_keymap(bufnr, "n", "gi", - "lua vim.lsp.buf.implementation()", opts) - api.nvim_buf_set_keymap(bufnr, "n", "gK", "lua vim.lsp.buf.hover()", - opts) - api.nvim_buf_set_keymap(bufnr, "n", "gh", - "lua vim.lsp.buf.signature_help()", opts) - api.nvim_buf_set_keymap(bufnr, "n", "gr", - "lua vim.lsp.buf.references()", opts) - api.nvim_buf_set_keymap(bufnr, "n", "gF", - "lua vim.lsp.buf.formatting()", opts) - api.nvim_buf_set_keymap(bufnr, "n", "ga", - "lua request_code_actions()", opts) - api.nvim_buf_set_keymap(bufnr, 'n', 'gD', - 'lua vim.lsp.buf.type_definition()', opts) - api.nvim_buf_set_keymap(bufnr, 'n', 'gR', - 'lua vim.lsp.buf.rename()', opts) - api.nvim_buf_set_keymap(bufnr, 'n', 'e', - 'lua vim.lsp.util.show_line_diagnostics()', - opts) - if resolved_capabilities.document_highlight then - api.nvim_command [[autocmd CursorHold lua vim.lsp.buf.document_highlight()]] - api.nvim_command [[autocmd CursorHoldI lua vim.lsp.buf.document_highlight()]] - end - api.nvim_command [[autocmd CursorMoved lua vim.lsp.util.buf_clear_references()]] - - require'diagnostic'.on_attach(client, bufnr) -end - local M = {} -M.on_attach = on_attach - M.setup = function(name, opts) - opts.on_attach = opts.on_attach or on_attach nvim_lsp[name].setup(opts) end