neovim: configure lsp_signature.nvim

This commit is contained in:
FollieHiyuki 2021-09-04 07:46:49 +07:00
parent 78b6d2bf54
commit ac6be59e68
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
2 changed files with 46 additions and 6 deletions

View File

@ -32,10 +32,37 @@ function M.lsp_conf()
elseif client.resolved_capabilities.document_range_formatting then
buf_set_keymap('n', '<leader>lo', '<Cmd>lua vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})<CR>', 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 = '<M-x>'
}, 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',

View File

@ -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 = '<Leader>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