Skip to content

Commit

Permalink
Add support for scrolling the symbol popup window
Browse files Browse the repository at this point in the history
  • Loading branch information
yegappan committed Nov 16, 2024
1 parent c6bd0ec commit 4081088
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
16 changes: 16 additions & 0 deletions autoload/lsp/symbol.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>, id: number, key: string): bool
# Handle the keys for scrolling the symbol popup window
if key == "\<C-E>"
|| key == "\<C-D>"
|| key == "\<C-F>"
|| key == "\<PageDown>"
|| key == "\<C-Y>"
|| key == "\<C-U>"
|| key == "\<C-B>"
|| key == "\<PageUp>"
|| key == "\<C-Home>"
|| key == "\<C-End>"
# scroll the hover popup window
win_execute(id, $'normal! {key}')
return true
endif

if key == "\<Esc>"
lspserver.peekSymbolPopup->popup_close()
return true
Expand Down
23 changes: 20 additions & 3 deletions doc/lsp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
<Esc> 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
Expand All @@ -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 <Esc> will close the
popup window. In the popup window, the following keys
can be used:

CTRL-F - Scroll one page forward
<PageDown> - idem
CTRL-B - Scroll one page backward
<PageUp> - idem
CTRL-Home - Jump to the first entry
CTRL-End - Jump to the last entry
<Esc> - 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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4081088

Please sign in to comment.