update lsp config to use vim.lsp

This commit is contained in:
2025-04-13 00:30:16 -07:00
parent ebbe37bece
commit 8a151a6430
6 changed files with 77 additions and 88 deletions

View File

@@ -67,5 +67,7 @@ local border = {
}
-- set border for floating windows and signature help
l.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
l.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
-- UNSUPPPORTED: https://github.com/neovim/neovim/issues/32242#issuecomment-2777120640
-- l.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
-- l.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
o.winborder = "rounded"

View File

@@ -20,27 +20,34 @@ return {
"ansiblels",
"docker_compose_language_service",
}
-- Define the highlight color for float border
vim.api.nvim_set_hl(0, "FloatBorder", { fg = "#89b4fa", bold = true })
local border = {
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
}
for _, lsp in ipairs(servers) do
if lsp == "lua_ls" then
lspconfig[lsp].setup({
-- on_attach = require("lsp-format").on_attach,
on_attach = function()
vim.notify("Lua LSP attached", nil, { title = "LSP" })
end,
vim.lsp.enable(lsp)
vim.lsp.config("lua_ls", {
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if
path ~= vim.fn.stdpath("config")
and (
vim.loop.fs_stat(path .. "/.luarc.json")
or vim.loop.fs_stat(path .. "/.luarc.jsonc")
)
and (vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc"))
then
return
end
end
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
runtime = {
-- Tell the language server which version of Lua you're using
@@ -53,7 +60,7 @@ return {
library = {
vim.env.VIMRUNTIME,
-- Depending on the usage, you might want to add additional paths here.
-- "${3rd}/luv/library"
-- "${3rd}/luv/library",
-- "${3rd}/busted/library",
},
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
@@ -61,23 +68,22 @@ return {
},
})
end,
callSnippet = "Replace",
settings = {
Lua = {},
},
})
elseif lsp == "docker_compose_language_service" then
lspconfig[lsp].setup({
filetypes = { "dockerfile", "docker-compose", "yaml", "yml" },
on_attach = function()
vim.notify("Docker Compose LSP attached", nil, { title = "LSP" })
end,
handlers = {},
})
else
lspconfig[lsp].setup({
on_attach = function()
vim.notify(lsp .. " LSP attached", nil, { title = "LSP" })
end,
vim.lsp.enable(lsp)
-- vim.lsp.config(lsp, {
-- handlers = {
-- UNNSUUPPORTED
-- ["textDocument/signatureHelp"] = vim.lsp.with(
-- vim.lsp.handlers.signature_help,
-- { border = border }
-- ),
-- ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }),
},
})
end
end

View File

@@ -48,6 +48,39 @@ return {
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = true, -- add a border to hover docs and signature help
},
cmdline = {
enabled = true, -- enables the Noice cmdline UI
view = "cmdline_popup", -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom
opts = {}, -- global options for the cmdline. See section on views
---@type table<string, CmdlineFormat>
format = {
-- conceal: (default=true) This will hide the text in the cmdline that matches the pattern.
-- view: (default is cmdline view)
-- opts: any options passed to the view
-- icon_hl_group: optional hl_group for the icon
-- title: set to anything or empty string to hide
cmdline = { pattern = "^:", icon = "", lang = "vim" },
search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" },
search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" },
filter = { pattern = "^:%s*!", icon = "$", lang = "bash" },
lua = { pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" }, icon = "", lang = "lua" },
help = { pattern = "^:%s*he?l?p?%s+", icon = "" },
input = { view = "cmdline_input", icon = "󰥻 " }, -- Used by input()
-- lua = false, -- to disable a format, set to `false`
},
},
views = {
cmdline_popup = {
border = {
style = "none",
padding = { 0, 0 },
},
filter_options = {},
win_options = {
winhighlight = "NormalFloat:NormalFloat,FloatBorder:FloatBorder",
},
},
},
},
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries

1
lua/plugins/nui.lua Normal file
View File

@@ -0,0 +1 @@
return { "MunifTanjim/nui.nvim" }

View File

@@ -1,52 +0,0 @@
return {
url = "https://gitea.suda.codes/sudacode/odis",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"neovim/nvim-lspconfig",
},
opts = {
opts = {
display = {
default_mode = "vsplit",
picker = true,
float = {
maxwidth = 80,
maxheight = 40,
border = "rounded",
title = true,
style = "minimal",
auto_focus = true,
anchor = "bottom_right",
offset = { row = -2, col = -2 },
},
window = {
width = 0.4,
height = 0.25,
position = "bottom|right",
floating = false,
border = "none",
},
},
integrations = {
treesitter = {
enabled = true, -- Enable Treesitter integration
highlight = true, -- Enable syntax highlighting
langs = { -- Language mapping for different doc types
lsp = "markdown",
man = "man",
help = "vimdoc",
},
},
},
sources = {
lsp = { enabled = true },
vim = { enabled = true },
man = { enabled = true },
},
priority = { "LSP", "Vim", "Man" },
mappings = {
close = "<leader>dc",
},
},
},
}