]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Add support for scrolling the symbol popup window
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 16 Nov 2024 16:46:08 +0000 (08:46 -0800)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 16 Nov 2024 16:46:08 +0000 (08:46 -0800)
autoload/lsp/symbol.vim
doc/lsp.txt

index c64e6e64bc5dd1e9cef86c039325ede2fb99453b..f104e203ae6d18a5a1ca3e0f2d1f2405647f1f18 100644 (file)
@@ -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
index c2743c48a2b8cc88fc891c8d5379f3109e4efaca..46318ac707d9040a79d86bdb122fab0490182f13 100644 (file)
@@ -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
@@ -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
@@ -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