floating window style configuration #391
-
Since the recent update, my floating window style preferences are no longer being honoured: Should look more like this: This only applies to rust LSP, so I'm assuming its a rustacean issue, and these new changes look like they might be related. Relevant config snippets: local function setup_rust()
vim.g.rustaceanvim = {
server = {
on_attach = function(_, bufnr)
vim.lsp.inlay_hint.enable(bufnr, true)
set_keybinds(bufnr)
require("which-key").register({
["<Leader>l"] = {
a = { "<Cmd>RustLsp codeAction<CR>", "Code Actions" },
c = { "<Cmd>RustLsp openCargo<CR>", "Open Cargo.toml" },
p = { "<Cmd>RustLsp parentModule<CR>", "Parent Module" },
R = { "<Cmd>RustLsp runnables<CR>", "Runnables" },
D = { "<Cmd>RustLsp debuggables<CR>", "Debuggables" },
j = { "<Cmd>RustLsp joinLines<CR>", "Join Lines" },
l = { "<Cmd>RustLsp renderDiagnostic<CR>", "Line Info" },
i = {
name = "Inlay Hints",
e = { function() vim.lsp.inlay_hint.enable(bufnr, true) end, "Enable" },
d = { function() vim.lsp.inlay_hint.enable(bufnr, false) end, "Disable" },
},
},
["<A-k>"] = { "<Cmd>RustLsp moveItem up<CR>", "Move item up" },
["<A-j>"] = { "<Cmd>RustLsp moveItem down<CR>", "Move item down" },
K = { "<Cmd>RustLsp hover actions<CR>", "Documentation" },
}, { buffer = bufnr })
end,
},
}
end local function setup()
local signs = {
{ name = "DiagnosticSignError", text = "" },
{ name = "DiagnosticSignWarn", text = "" },
{ name = "DiagnosticSignHint", text = "" },
{ name = "DiagnosticSignInfo", text = "" },
}
for _, sign in ipairs(signs) do
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
end
local config = {
virtual_text = true,
signs = {
active = signs,
},
update_in_insert = true,
underline = true,
float = {
focusable = false,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
}
vim.diagnostic.config(config)
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
width = 80,
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "rounded",
width = 80,
})
end local function config()
require("mason-lspconfig").setup()
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local opts = {
on_attach = function(_, bufnr)
set_keybinds(bufnr)
end,
capabilities = capabilities
}
require("mason-lspconfig").setup_handlers {
function(server_name)
require("lspconfig")[server_name].setup(opts)
end,
["lua_ls"] = function()
require("neodev").setup {
library = { plugins = { "nvim-dap-ui" }, types = true },
}
require("lspconfig").lua_ls.setup(opts)
end,
["rust_analyzer"] = function() end, -- overwrite lspconfig
}
require("mason-null-ls").setup({
automatic_installation = false,
handlers = {}
})
require("null-ls").setup {
on_attach = function(_, bufnr)
set_keybinds(bufnr)
end,
capabilities = capabilities
}
setup_rust()
setup()
end |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey 👋 Rustaceanvim (and previously rust-tools.nvim) never honoured your floating window style preferences. It you want to have rounded borders, you can set By default, rustaceanvim overrides the |
Beta Was this translation helpful? Give feedback.
Hey 👋
Rustaceanvim (and previously rust-tools.nvim) never honoured your floating window style preferences.
It used to override Neovim's default, and the override just happened to align with your preference 😅
It you want to have rounded borders, you can set
vim.g.rustaceanvim.tools.float_win_config.border = 'rounded'
(see:h rustaceanvim.config
).By default, rustaceanvim overrides the
textDocument/hover
handler to use the hover actions.I'd have to check and see if it's possible to default to the built-in hover handler's border if one is set...Edit: It's not possible, afaict.