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

View File

@ -259,18 +259,18 @@ _: let
action = "<cmd>nohlsearch<cr>"; action = "<cmd>nohlsearch<cr>";
options.desc = "Clear Search Highlights"; options.desc = "Clear Search Highlights";
} }
# {
# mode = "n";
# key = "K";
# action = "<cmd>lua vim.lsp.buf.hover()<cr>";
# options.desc = "LSP Hover";
# }
{ {
mode = "n"; mode = "n";
key = "K"; key = "K";
action = "<cmd>lua require('hover').hover()<cr>"; action = "<cmd>lua vim.lsp.buf.hover()<cr>";
options.desc = "LSP Hover"; options.desc = "LSP Hover";
} }
# {
# mode = "n";
# key = "K";
# action = "<cmd>lua require('hover').hover()<cr>";
# options.desc = "LSP Hover";
# }
{ {
mode = "n"; mode = "n";
key = "/"; key = "/";