1

Modules/Neovim: Disable hover plugin + enable web LSPs

This commit is contained in:
2025-08-31 19:37:21 +02:00
parent 879378f39d
commit 6d61a62d36
2 changed files with 99 additions and 96 deletions

View File

@ -42,7 +42,7 @@ in {
jdt-language-server
ltex-ls # TODO: Only enable on-demand
lua-language-server
nil
# nil
nixd
basedpyright
pyrefly
@ -53,7 +53,7 @@ in {
tex-fmt
texlab
typescript
# vscode-langservers-extracted # includes nodejs
vscode-langservers-extracted # includes nodejs
# Linters
checkstyle # java
@ -581,89 +581,89 @@ in {
# Don't call setup!
};
hover = let
# Display LSP information and Diagnostics at the same time
# https://github.com/lewis6991/hover.nvim/issues/34#issuecomment-1625662866
lspWithDiag = ''
{
name = "LSP",
priority = 1000,
enabled = function()
return true
end,
execute = function(opts, done)
local params = vim.lsp.util.make_position_params()
local ___ = "\n\n"
vim.lsp.buf_request_all(0, 'textDocument/hover', params, function(responses)
local value = ""
for _, response in pairs(responses) do
local result = response.result
if result and result.contents and result.contents.value then
if value ~= "" then
value = value .. ___
end
value = value .. result.contents.value
end
end
local _, row = unpack(vim.fn.getpos("."))
local lineDiag = vim.diagnostic.get(0, { lnum = row - 1 })
for _, d in pairs(lineDiag) do
if d.message then
if value ~= "" then
value = value .. ___
end
value = value .. string.format("*%s* %s", d.source, d.message)
end
end
value = value:gsub("\r", "")
if value ~= "" then
done({ lines = vim.split(value, "\n", true), filetype = "markdown" })
else
done()
end
end)
end,
}
'';
in rec {
name = "hover";
pkg = pkgs.vimPlugins.hover-nvim;
lazy = true;
event = ["BufReadPost" "BufNewFile"];
config = mkDefaultConfig name;
opts = {
init.__raw = ''
function()
-- Register custom providers
require('hover').register(${lspWithDiag})
-- Require providers
-- require("hover.providers.lsp")
-- require('hover.providers.diagnostic')
require('hover.providers.fold_preview')
require('hover.providers.man')
-- require('hover.providers.gh')
-- require('hover.providers.gh_user')
-- require('hover.providers.jira')
-- require('hover.providers.dap')
-- require('hover.providers.dictionary')
-- require('hover.providers.highlight')
end
'';
preview_opts = {
border = "rounded";
};
# Whether the contents of a currently open hover window should be moved
# to a :h preview-window when pressing the hover keymap.
preview_window = false;
title = false;
};
};
# hover = let
# # Display LSP information and Diagnostics at the same time
# # https://github.com/lewis6991/hover.nvim/issues/34#issuecomment-1625662866
# lspWithDiag = ''
# {
# name = "LSP",
# priority = 1000,
# enabled = function()
# return true
# end,
#
# execute = function(opts, done)
# local params = vim.lsp.util.make_position_params()
# local ___ = "\n─────────────────────────────────────────────────────────────────────────────\n"
#
# vim.lsp.buf_request_all(0, 'textDocument/hover', params, function(responses)
# local value = ""
# for _, response in pairs(responses) do
# local result = response.result
# if result and result.contents and result.contents.value then
# if value ~= "" then
# value = value .. ___
# end
# value = value .. result.contents.value
# end
# end
#
# local _, row = unpack(vim.fn.getpos("."))
# local lineDiag = vim.diagnostic.get(0, { lnum = row - 1 })
# for _, d in pairs(lineDiag) do
# if d.message then
# if value ~= "" then
# value = value .. ___
# end
# value = value .. string.format("*%s* %s", d.source, d.message)
# end
# end
# value = value:gsub("\r", "")
#
# if value ~= "" then
# done({ lines = vim.split(value, "\n", true), filetype = "markdown" })
# else
# done()
# end
# end)
# end,
# }
# '';
# in rec {
# name = "hover";
# pkg = pkgs.vimPlugins.hover-nvim;
# lazy = true;
# event = ["BufReadPost" "BufNewFile"];
# config = mkDefaultConfig name;
# opts = {
# init.__raw = ''
# function()
# -- Register custom providers
# require('hover').register(${lspWithDiag})
#
# -- Require providers
# -- require("hover.providers.lsp")
# -- require('hover.providers.diagnostic')
# require('hover.providers.fold_preview')
# require('hover.providers.man')
#
# -- require('hover.providers.gh')
# -- require('hover.providers.gh_user')
# -- require('hover.providers.jira')
# -- require('hover.providers.dap')
# -- require('hover.providers.dictionary')
# -- require('hover.providers.highlight')
# end
# '';
# preview_opts = {
# border = "rounded";
# };
# # Whether the contents of a currently open hover window should be moved
# # to a :h preview-window when pressing the hover keymap.
# preview_window = false;
# title = false;
# };
# };
illuminate = rec {
name = "illuminate";
@ -872,7 +872,7 @@ in {
{name = "clojure_lsp";}
{name = "cmake";}
{name = "cssls";}
# {name = "html";} # vscode-langservers-extracted
{name = "html";} # vscode-langservers-extracted
{name = "lua_ls";}
{
name = "ltex";
@ -883,7 +883,7 @@ in {
};
};
}
{name = "nil_ls";}
# {name = "nil_ls";}
{
name = "nixd";
extraOptions.cmd = [
@ -2057,7 +2057,9 @@ in {
flash # Highlight f/F search results
gitsigns # Show git line additions/deletions/changes in the gutter
haskell-tools # Haskell integration
hover # Multiple hover providers
# hover # Multiple hover providers
illuminate # Highlight usages of word under cursor
intellitab # Indent to the correct level on blanklines # TODO: Behaves bit fishy sometimes
@ -2106,7 +2108,8 @@ in {
window-picker # Jump to window without multiple <leader-hjkl>
winshift # Move windows around
yanky # Clipboard history
yazi
yazi # File manager: TODO: Theming
];
};
};