Skip to content

Commit

Permalink
workaround(lsp-signature)!: fix input delay of nvim-cmp (#840)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jint-lzxy authored Jul 6, 2023
1 parent 0b42a0c commit be6f6f7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 36 deletions.
15 changes: 15 additions & 0 deletions lua/modules/configs/completion/lsp-signature.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
return function()
require("lsp_signature").setup({
bind = true,
-- TODO: Remove the following line when nvim-cmp#1613 gets resolved
check_completion_visible = false,
floating_window = true,
floating_window_above_cur_line = true,
hi_parameter = "Search",
hint_enable = true,
transparency = nil, -- disabled by default, allow floating win transparent value 1~100
wrap = true,
zindex = 45, -- avoid overlap with nvim.cmp
handler_opts = { border = "single" },
})
end
19 changes: 1 addition & 18 deletions lua/modules/configs/completion/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ return function()
ensure_installed = require("core.settings").lsp_deps,
})

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)

vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
signs = true,
underline = true,
Expand All @@ -111,22 +108,8 @@ return function()
})

local opts = {
on_attach = function()
require("lsp_signature").on_attach({
bind = true,
use_lspsaga = false,
floating_window = true,
fix_pos = true,
hint_enable = true,
hi_parameter = "Search",
handler_opts = {
border = "single",
},
})
end,
capabilities = capabilities,
capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
}

---A handler to setup all servers defined under `completion/servers/*.lua`
---@param lsp_name string
local function mason_lsp_handler(lsp_name)
Expand Down
18 changes: 1 addition & 17 deletions lua/modules/configs/lang/rust-tools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,7 @@ return function()

-- how to execute terminal commands
-- options right now: termopen / quickfix
executor = require("rust-tools/executors").termopen,

-- callback to execute once rust-analyzer is done initializing the workspace
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
on_initialized = function()
require("lsp_signature").on_attach({
bind = true,
use_lspsaga = false,
floating_window = true,
fix_pos = true,
hint_enable = true,
hi_parameter = "Search",
handler_opts = {
border = "rounded",
},
})
end,
executor = require("rust-tools.executors").termopen,

-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
reload_workspace_from_cargo_toml = true,
Expand Down
5 changes: 4 additions & 1 deletion lua/modules/plugins/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ completion["neovim/nvim-lspconfig"] = {
dependencies = {
{ "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" },
{ "ray-x/lsp_signature.nvim" },
{
"ray-x/lsp_signature.nvim",
config = require("completion.lsp-signature"),
},
},
}
completion["nvimdev/lspsaga.nvim"] = {
Expand Down

0 comments on commit be6f6f7

Please sign in to comment.