From ac6be59e681b6af72d1e303fee808cd1c55079f8 Mon Sep 17 00:00:00 2001 From: FollieHiyuki Date: Sat, 4 Sep 2021 07:46:49 +0700 Subject: [PATCH] neovim: configure lsp_signature.nvim --- home/.config/nvim/lua/modules/lsp.lua | 42 +++++++++++++++++++++++++++ home/.config/nvim/lua/plugins.lua | 10 +++---- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/home/.config/nvim/lua/modules/lsp.lua b/home/.config/nvim/lua/modules/lsp.lua index f73c289..85f7b7d 100644 --- a/home/.config/nvim/lua/modules/lsp.lua +++ b/home/.config/nvim/lua/modules/lsp.lua @@ -32,10 +32,37 @@ function M.lsp_conf() elseif client.resolved_capabilities.document_range_formatting then buf_set_keymap('n', 'lo', 'lua vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})', opts) end + + -- Attach lsp_signature.nvim + require('lsp_signature').on_attach({ + bind = true, -- This is mandatory, otherwise border config doesn't work + floating_window = true, + fix_pos = true, + hint_prefix = '🐬 ', + transpancy = 5, + handler_opts = {border = 'none'}, + zindex = 50, -- set to 200 to make the float window on top of others + toggle_key = '' + }, bufnr) end + -- Add additional capabilities supported by nvim-cmp local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities.textDocument.completion.completionItem.documentationFormat = {'markdown', 'plaintext'} capabilities.textDocument.completion.completionItem.snippetSupport = true + capabilities.textDocument.completion.completionItem.preselectSupport = true + capabilities.textDocument.completion.completionItem.insertReplaceSupport = true + capabilities.textDocument.completion.completionItem.labelDetailsSupport = true + capabilities.textDocument.completion.completionItem.deprecatedSupport = true + capabilities.textDocument.completion.completionItem.commitCharactersSupport = true + capabilities.textDocument.completion.completionItem.tagSupport = {valueSet = {1}} + capabilities.textDocument.completion.completionItem.resolveSupport = { + properties = { + 'documentation', + 'detail', + 'additionalTextEdits', + }, + } --------------------------- -- Server configurations -- @@ -104,6 +131,21 @@ function M.lsp_conf() } } + -- Emmet + if not lspconf.emmet_ls then + require('lspconfig/configs').emmet_ls = { + default_config = { + cmd = {'emmet-ls', '--stdio'}, + filetypes = {'html', 'css'}, + root_dir = function(fname) + return vim.loop.cwd() + end, + settings = {} + } + } + end + lspconf.emmet_ls.setup {capabilities = capabilities} + -- Others local servers = { 'dockerls', diff --git a/home/.config/nvim/lua/plugins.lua b/home/.config/nvim/lua/plugins.lua index 0376271..5056cc8 100644 --- a/home/.config/nvim/lua/plugins.lua +++ b/home/.config/nvim/lua/plugins.lua @@ -134,6 +134,8 @@ return require('packer').startup( use { -- TODO: scripts to install/update lsp servers 'neovim/nvim-lspconfig', event = 'BufReadPre', + wants = 'lsp_signature.nvim', + requires = {{'ray-x/lsp_signature.nvim', opt = true}}, config = lsp.lsp_conf } use { @@ -142,10 +144,6 @@ return require('packer').startup( wants = 'nvim-lspconfig', config = lsp.sqls_conf } - use { -- TODO: config - 'ray-x/lsp_signature.nvim', - after = 'nvim-lspconfig' - } use { 'ahmedkhalf/lsp-rooter.nvim', after = 'nvim-lspconfig' @@ -165,7 +163,7 @@ return require('packer').startup( event = 'BufRead', config = lsp.lint_conf } - use { -- TODO: config + use { -- TODO: config, scripts to install/update dap servers 'rcarriga/nvim-dap-ui', keys = 'd', wants = 'nvim-dap', @@ -305,7 +303,7 @@ return require('packer').startup( } use { -- shouldn't be lazy-loaded (global bindings don't work) 'kristijanhusak/orgmode.nvim', - ft = {'org'}, + ft = 'org', config = tools.orgmode_conf } use { -- TODO: config