deprecate lsp_signature for cmp
This commit is contained in:
parent
e7b64d1347
commit
079f45a54a
3 changed files with 92 additions and 114 deletions
|
@ -3,7 +3,6 @@ return require("packer").startup(function()
|
|||
use("pierreglaser/folding-nvim")
|
||||
use("tjdevries/colorbuddy.vim")
|
||||
use("wbthomason/packer.nvim")
|
||||
use("ray-x/lsp_signature.nvim")
|
||||
use("jose-elias-alvarez/nvim-lsp-ts-utils")
|
||||
use("rafamadriz/friendly-snippets")
|
||||
use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } })
|
||||
|
@ -64,6 +63,7 @@ return require("packer").startup(function()
|
|||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
|
|
|
@ -41,7 +41,6 @@ end
|
|||
|
||||
local on_attach = function()
|
||||
require("folding").on_attach()
|
||||
require("lsp_signature").on_attach() -- Note: add in lsp client on-attach
|
||||
end
|
||||
|
||||
-- simple setups --
|
||||
|
@ -190,30 +189,6 @@ require("lspconfig").tsserver.setup({})
|
|||
-- client.resolved_capabilities.document_formatting = false
|
||||
-- on_attach(client)
|
||||
|
||||
-- require("lsp_signature").on_attach({
|
||||
-- bind = false, -- This is mandatory, otherwise border config won't get registered.
|
||||
-- -- If you want to hook lspsaga or other signature handler, pls set to false
|
||||
-- doc_lines = 2, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated);
|
||||
-- -- set to 0 if you DO NOT want any API comments be shown
|
||||
-- -- This setting only take effect in insert mode, it does not affect signature help in normal
|
||||
-- -- mode, 10 by default
|
||||
|
||||
-- floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
|
||||
-- fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters
|
||||
-- hint_enable = false, -- virtual hint enable
|
||||
-- hint_prefix = "🐼 ", -- Panda for parameter
|
||||
-- hint_scheme = "String",
|
||||
-- use_lspsaga = true, -- set to true if you want to use lspsaga popup
|
||||
-- hi_parameter = "Search", -- how your parameter will be highlight
|
||||
-- max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down
|
||||
-- -- to view the hiding contents
|
||||
-- max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
|
||||
-- handler_opts = {
|
||||
-- border = "single", -- double, single, shadow, none
|
||||
-- },
|
||||
-- extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","}
|
||||
-- })
|
||||
|
||||
-- local ts_utils = require("nvim-lsp-ts-utils")
|
||||
|
||||
-- ts_utils.setup({
|
||||
|
|
|
@ -1,98 +1,101 @@
|
|||
local cmp = require'cmp'
|
||||
local luasnip = require'luasnip'
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
formatting = {
|
||||
format = require('lspkind').cmp_format({
|
||||
with_text = true,
|
||||
menu = {
|
||||
buffer = "[Buffer]",
|
||||
tmux = "[Tmux]",
|
||||
luasnip = "[LuaSnip]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
path = "[Path]",
|
||||
},
|
||||
}),
|
||||
},
|
||||
formatting = {
|
||||
format = require("lspkind").cmp_format({
|
||||
with_text = true,
|
||||
menu = {
|
||||
buffer = "[Buffer]",
|
||||
tmux = "[Tmux]",
|
||||
luasnip = "[LuaSnip]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
path = "[Path]",
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
||||
window = {
|
||||
completion = cmp.config.window.bordered({
|
||||
winhighlight = 'Normal:PMenu,FloatBorder:PMenuBorder,CursorLine:PMenuSel,Search:None',
|
||||
}),
|
||||
documentation = cmp.config.window.bordered({
|
||||
winhighlight = 'Normal:PMenu,FloatBorder:PMenu,CursorLine:PMenuSel,Search:None',
|
||||
}),
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered({
|
||||
winhighlight = "Normal:PMenu,FloatBorder:PMenuBorder,CursorLine:PMenuSel,Search:None",
|
||||
}),
|
||||
documentation = cmp.config.window.bordered({
|
||||
winhighlight = "Normal:PMenu,FloatBorder:PMenu,CursorLine:PMenuSel,Search:None",
|
||||
}),
|
||||
},
|
||||
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = {
|
||||
['<Up>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }),
|
||||
['<Down>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }),
|
||||
['<C-p>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }),
|
||||
['<C-n>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(4),
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
['<CR>'] = cmp.mapping(cmp.mapping.confirm({ select = false }), { 'i', 'c' }),
|
||||
['<C-y>'] = cmp.mapping(cmp.mapping.confirm({ select = false }), { 'i', 'c' }),
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||
["<Down>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||
["<C-p>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||
["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-e>"] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
["<CR>"] = cmp.mapping(cmp.mapping.confirm({ select = false }), { "i", "c" }),
|
||||
["<C-y>"] = cmp.mapping(cmp.mapping.confirm({ select = false }), { "i", "c" }),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
|
||||
sources = cmp.config.sources({
|
||||
{
|
||||
name = 'buffer',
|
||||
priority = 1,
|
||||
|
||||
},
|
||||
{
|
||||
name = 'luasnip',
|
||||
priority = 4,
|
||||
},
|
||||
{
|
||||
name = 'tmux',
|
||||
priority = 2,
|
||||
option = {
|
||||
all_panes = true,
|
||||
trigger_characters = {},
|
||||
}
|
||||
},
|
||||
{
|
||||
name = 'nvim_lsp',
|
||||
priority = 3,
|
||||
},
|
||||
})
|
||||
sources = cmp.config.sources({
|
||||
{
|
||||
name = "buffer",
|
||||
priority = 1,
|
||||
},
|
||||
{
|
||||
name = "luasnip",
|
||||
priority = 4,
|
||||
},
|
||||
{
|
||||
name = "tmux",
|
||||
priority = 2,
|
||||
option = {
|
||||
all_panes = true,
|
||||
trigger_characters = {},
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "nvim_lsp",
|
||||
priority = 3,
|
||||
},
|
||||
{
|
||||
name = "nvim_lsp_signature_help",
|
||||
priority = 4,
|
||||
},
|
||||
}),
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue