nvim: replace signature help
This commit is contained in:
parent
cc34940c06
commit
8557936586
@ -45,7 +45,6 @@ if cmp and luasnip then
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
|
@ -53,38 +53,47 @@ local on_attach = function(client, bufnr)
|
||||
vim.bo.formatoptions = vim.o.formatoptions:gsub('t', '')
|
||||
-- Let LSP autoformat on save
|
||||
require('lsp-format').on_attach(client)
|
||||
|
||||
-- virtual text hint for parameters
|
||||
require ('lsp_signature').on_attach({
|
||||
bind = true,
|
||||
handler_opts = {
|
||||
border = 'rounded'
|
||||
},
|
||||
floating_window = false
|
||||
}, bufnr)
|
||||
end
|
||||
|
||||
-- -- show help on hover -- cursor ends up in popup
|
||||
-- if client.resolved_capabilities.hover then
|
||||
-- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
-- group = 'config_lsp',
|
||||
-- buffer = bufnr,
|
||||
-- callback = function()
|
||||
-- vim.lsp.buf.hover({ focusable = false })
|
||||
-- end
|
||||
-- })
|
||||
-- end
|
||||
-- show help on hover -- cursor ends up in popup
|
||||
if client.resolved_capabilities.hover then
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
group = 'config_lsp',
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.hover({ focusable = false })
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- update client capabilities with completion plugin stuff
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(
|
||||
vim.lsp.protocol.make_client_capabilities())
|
||||
vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, {
|
||||
vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
width = 60,
|
||||
})
|
||||
|
||||
-- setup servers
|
||||
if vim.fn.executable('clangd') > 0 then
|
||||
require'lspconfig'.clangd.setup{
|
||||
require 'lspconfig'.clangd.setup {
|
||||
cmd = {
|
||||
'clangd',
|
||||
'--compile-commands-dir=build',
|
||||
'--clang-tidy', -- needs >=clangd-9
|
||||
'--ranking-model=decision_forest' -- needs >=clangd-12
|
||||
'--clang-tidy', -- needs >=clangd-9
|
||||
'--ranking-model=decision_forest' -- needs >=clangd-12
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
@ -92,17 +101,17 @@ if vim.fn.executable('clangd') > 0 then
|
||||
end
|
||||
|
||||
if vim.fn.executable('lua-language-server') > 0 then
|
||||
require'lspconfig'.sumneko_lua.setup {
|
||||
require 'lspconfig'.sumneko_lua.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
globals = {'vim'},
|
||||
globals = { 'vim' },
|
||||
},
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
library = vim.api.nvim_get_runtime_file('', true),
|
||||
},
|
||||
telemetry = {
|
||||
enable = false,
|
||||
@ -115,56 +124,56 @@ if vim.fn.executable('lua-language-server') > 0 then
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
if vim.fn.executable('pylsp') > 0 then
|
||||
require'lspconfig'.pylsp.setup{
|
||||
require 'lspconfig'.pylsp.setup({
|
||||
settings = {
|
||||
pylsp = {
|
||||
}
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
if vim.fn.executable('lemminx') > 0 then
|
||||
require'lspconfig'.lemminx.setup{
|
||||
require 'lspconfig'.lemminx.setup({
|
||||
filetypes = {
|
||||
'xml', 'xsd', 'xsl', 'xslt', 'svg', 'gentoo-metadata'
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-html-language-server') > 0 then
|
||||
require'lspconfig'.html.setup{
|
||||
require 'lspconfig'.html.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-css-language-server') > 0 then
|
||||
require'lspconfig'.cssls.setup{
|
||||
require 'lspconfig'.cssls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-eslint-language-server') > 0 then
|
||||
require'lspconfig'.eslint.setup{
|
||||
require 'lspconfig'.eslint.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-json-language-server') > 0 then
|
||||
require'lspconfig'.jsonls.setup{
|
||||
require 'lspconfig'.jsonls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
require("lsp-format").setup({
|
||||
|
@ -48,7 +48,6 @@ require('packer').startup(function(use)
|
||||
requires = 'https://github.com/L3MON4D3/LuaSnip'
|
||||
},
|
||||
'https://github.com/hrsh7th/cmp-nvim-lua',
|
||||
'https://github.com/hrsh7th/cmp-nvim-lsp-signature-help',
|
||||
'https://github.com/uga-rosa/cmp-dictionary',
|
||||
}
|
||||
}
|
||||
@ -63,6 +62,7 @@ require('packer').startup(function(use)
|
||||
'https://github.com/lukas-reineke/lsp-format.nvim',
|
||||
tag = '*'
|
||||
}
|
||||
use { 'https://github.com/ray-x/lsp_signature.nvim' }
|
||||
|
||||
-- tools
|
||||
use {
|
||||
|
Loading…
x
Reference in New Issue
Block a user