From 408108855d241a9144ca9358659ebe7b700e464e Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Sat, 16 Nov 2024 08:46:08 -0800 Subject: [PATCH] Add support for scrolling the symbol popup window --- autoload/lsp/symbol.vim | 16 ++++++++++++++++ doc/lsp.txt | 23 ++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/autoload/lsp/symbol.vim b/autoload/lsp/symbol.vim index c64e6e64..f104e203 100644 --- a/autoload/lsp/symbol.vim +++ b/autoload/lsp/symbol.vim @@ -457,6 +457,22 @@ enddef # Vim doesn't close the popup window when the escape key is pressed. # This is function supports that. def SymbolFilterCB(lspserver: dict, id: number, key: string): bool + # Handle the keys for scrolling the symbol popup window + if key == "\" + || key == "\" + || key == "\" + || key == "\" + || key == "\" + || key == "\" + || key == "\" + || key == "\" + || key == "\" + || key == "\" + # scroll the hover popup window + win_execute(id, $'normal! {key}') + return true + endif + if key == "\" lspserver.peekSymbolPopup->popup_close() return true diff --git a/doc/lsp.txt b/doc/lsp.txt index c2743c48..46318ac7 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -1010,8 +1010,7 @@ can map these commands to keys and make it easier to invoke them. :[count]LspPeekDefinition Displays the line where the symbol under the cursor is defined in a popup window. The symbol is highlighted - in the popup window. Moving the cursor or pressing - will close the popup window. + in the popup window. When more than one symbol is found all of them will be shown. The corresponding file for the symbol is displayed in another popup window. As the selection @@ -1020,6 +1019,24 @@ can map these commands to keys and make it easier to invoke them. When [count] is provided only the [count] symbol will be shown. + *lsp-symbol-window* + Moving the cursor or pressing will close the + popup window. In the popup window, the following keys + can be used: + + CTRL-F - Scroll one page forward + - idem + CTRL-B - Scroll one page backward + - idem + CTRL-Home - Jump to the first entry + CTRL-End - Jump to the last entry + - Close the popup window + CTRL-C - idem + CTRL-E - Scroll one line forward + CTRL-D - Scroll half page forward + CTRL-Y - Scroll one line backward + CTRL-U - Scroll half page backward + *:LspPeekImpl* :[count]LspPeekImpl Displays the implementation of the symbol under the cursor in a popup window. The behavior of this @@ -1988,7 +2005,7 @@ workspaceSymbol Used by the |:LspSymbolSearch| command. ============================================================================== *lsp-license* License: MIT License -Copyright (c) 2020-2023 Yegappan Lakshmanan +Copyright (c) 2020-2024 Yegappan Lakshmanan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to