]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Use global functions instead of funcref variables for LspOptionsSet() and LspServerTr...
authorYegappan Lakshmanan <yegappan@yahoo.com>
Thu, 3 Feb 2022 17:07:39 +0000 (09:07 -0800)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Thu, 3 Feb 2022 17:07:39 +0000 (09:07 -0800)
README.md
autoload/handlers.vim
autoload/lspoptions.vim
doc/lsp.txt
plugin/lsp.vim

index 29bbb170eec72be882df97e894d0fcfb80ace53f..08631d583bbee82620cfe04a25a0b84874d1853f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -99,8 +99,8 @@ Command|Description
 :LspOutline|Show the list of symbols defined in the current file in a separate window.
 :LspFormat|Format the current file using the LSP server.
 :{range}LspFormat|Format the specified range of lines.
-:LspCalledBy|Display the list of symbols called by the current symbol.
-:LspCalling|Display the list of symbols calling the current symbol.
+:LspIncomingCalls|Display the list of symbols calling the current symbol.
+:LspOutgoingCalls|Display the list of symbols called by the current symbol.
 :LspRename|Rename the current symbol
 :LspCodeAction|Apply the code action supplied by the LSP server to the diagnostic in the current line.
 :LspSymbolSearch|Perform a workspace wide search for a symbol
index 43cf2650ea04aa760d867b8d1df705670b027b20..85a067b1dcf6365b5ae19095cb8d706373496f50 100644 (file)
@@ -705,9 +705,9 @@ def s:processPrepareCallHierarchy(lspserver: dict<any>, req: dict<any>, reply: d
   endif
 
   if lspserver.callHierarchyType == 'incoming'
-    LspGetIncomingCalls(reply.result[choice - 1])
+    g:LspGetIncomingCalls(reply.result[choice - 1])
   else
-    LspGetOutgoingCalls(reply.result[choice - 1])
+    g:LspGetOutgoingCalls(reply.result[choice - 1])
   endif
 enddef
 
index b8ac3f24b1470e8e6a6d557cd341424fb2972ecc..b5bc6ce16b55913f6cc0cce29f623eef350dc145 100644 (file)
@@ -1,7 +1,7 @@
 vim9script
 
 # LSP plugin options
-# User can override these by calling the LspOptionsSet() function.
+# User can override these by calling the OptionsSet() function.
 export var lspOptions: dict<any> = {
   # In insert mode, complete the current symbol automatically
   # Otherwise, use omni-completion
@@ -35,7 +35,7 @@ export var lspOptions: dict<any> = {
 }
 
 # set LSP options from user provided options
-export def LspOptionsSet(opts: dict<any>)
+export def OptionsSet(opts: dict<any>)
   for key in opts->keys()
     lspOptions[key] = opts[key]
   endfor
index 8bbce823147b58bfd6c0e85ff6c56292b7c60fe3..63e6e9950b18c58467ee14aa8bf6fea9173ae6f4 100644 (file)
@@ -107,10 +107,10 @@ The following commands are provided:
                        in a separate window.
 :LspFormat             Format the current file using the LSP server.
 :{range}LspFormat      Format the specified range of lines.
-:LspCalledBy           Display the list of symbols called by the current
-                       symbol in a new location list.
-:LspCalling            Display the list of symbols calling the current symbol
+:LspIncomingCalls      Display the list of symbols calling the current symbol
                        in a new location list.
+:LspOutgoingCalls      Display the list of symbols called by the current
+                       symbol in a new location list.
 :LspRename             Rename the current symbol
 :LspCodeAction         Apply the code action supplied by the LSP server to
                        the diagnostic in the current line.
@@ -383,14 +383,14 @@ diagnostic messages, you can add the following line to your .vimrc file:
 :{range}LspFormat      Format the specified range of lines in the current
                        file using the LSP server.
 
-                                               *:LspCalledBy*
-:LspCalledBy           Creates a new location list with the location of
-                       the list of symbols called by the current symbol.
-
-                                               *:LspCalling*
-:LspCalling            Creates a new location list with the location of the
+                                               *:LspIncomingCalls*
+:LspIncomingCalls      Creates a new location list with the location of the
                        list of symbols calling the current symbol.
 
+                                               *:LspOutoingCalls*
+:LspOutoingCalls       Creates a new location list with the location of
+                       the list of symbols called by the current symbol.
+
                                                *:LspRename*
 :LspRename             Rename the current symbol. You will be prompted to
                        enter the new name for the symbol. You can press <Esc>
index c358d4946a09b148e4ba4ade159d29b274b358cb..c9ef725bff2ab9ee99bc52a57bd8b141bb42c032 100644 (file)
@@ -12,7 +12,7 @@ if has('patch-8.2.4257')
   import '../autoload/lspoptions.vim' as lspoptions
   import '../autoload/lsp.vim'
 
-  opt.LspOptionsSet = lspoptions.LspOptionsSet
+  opt.LspOptionsSet = lspoptions.OptionsSet
   opt.lspOptions = lspoptions.lspOptions
   lspf.enableServerTrace = lsp.EnableServerTrace
   lspf.addServer = lsp.AddServer
@@ -57,7 +57,7 @@ elseif has('patch-8.2.4019')
   import '../autoload/lspoptions.vim' as opt_import
   import '../autoload/lsp.vim' as lsp_import
 
-  opt.LspOptionsSet = opt_import.LspOptionsSet
+  opt.LspOptionsSet = opt_import.OptionsSet
   opt.lspOptions = opt_import.lspOptions
   lspf.enableServerTrace = lsp_import.EnableServerTrace
   lspf.addServer = lsp_import.AddServer
@@ -99,7 +99,7 @@ elseif has('patch-8.2.4019')
   lspf.addWorkspaceFolder = lsp_import.AddWorkspaceFolder
   lspf.removeWorkspaceFolder = lsp_import.RemoveWorkspaceFolder
 else
-  import {lspOptions, LspOptionsSet} from '../autoload/lspoptions.vim'
+  import {lspOptions, OptionsSet} from '../autoload/lspoptions.vim'
   import {EnableServerTrace,
          AddServer,
          ServerReady,
@@ -133,7 +133,7 @@ else
          AddWorkspaceFolder,
          RemoveWorkspaceFolder} from '../autoload/lsp.vim'
 
-  opt.LspOptionsSet = LspOptionsSet
+  opt.LspOptionsSet = OptionsSet
   opt.lspOptions = lspOptions
   lspf.enableServerTrace = EnableServerTrace
   lspf.addServer = AddServer
@@ -176,8 +176,13 @@ else
   lspf.removeWorkspaceFolder = RemoveWorkspaceFolder
 endif
 
-g:LspOptionsSet = s:opt.LspOptionsSet
-g:LspServerTraceEnable = s:lspf.enableServerTrace
+def g:LspOptionsSet(opts: dict<any>)
+  opt.LspOptionsSet(opts)
+enddef
+
+def g:LspServerTraceEnable()
+  lspf.enableServerTrace()
+enddef
 
 def g:LspAddServer(serverList: list<dict<any>>)
   lspf.addServer(serverList)
@@ -258,8 +263,8 @@ command! -nargs=0 -bar LspHighlight call LspDocHighlight()
 command! -nargs=0 -bar LspHighlightClear call LspDocHighlightClear()
 command! -nargs=0 -bar LspOutline call Toutline()
 command! -nargs=0 -bar -range=% LspFormat call TtextDocFormat(<range>, <line1>, <line2>)
-command! -nargs=0 -bar LspCalledBy call TincomingCalls()
-command! -nargs=0 -bar LspCalling call ToutgoingCalls()
+command! -nargs=0 -bar LspOutgoingCalls call ToutgoingCalls()
+command! -nargs=0 -bar LspIncomingCalls call TincomingCalls()
 command! -nargs=0 -bar LspRename call Trename()
 command! -nargs=0 -bar LspCodeAction call TcodeAction()
 command! -nargs=? -bar LspSymbolSearch call TsymbolSearch(<q-args>)
@@ -283,8 +288,8 @@ if has('gui_running')
   anoremenu <silent> L&sp.Outline :LspOutline<CR>
 
   anoremenu <silent> L&sp.Symbol\ Search :LspSymbolSearch<CR>
-  anoremenu <silent> L&sp.CalledBy :LspCalledBy<CR>
-  anoremenu <silent> L&sp.Calling :LspCalling<CR>
+  anoremenu <silent> L&sp.Outgoing\ Calls :LspOutgoingCalls<CR>
+  anoremenu <silent> L&sp.Incoming\ Calls :LspIncomingCalls<CR>
   anoremenu <silent> L&sp.Rename :LspRename<CR>
   anoremenu <silent> L&sp.Code\ Action :LspCodeAction<CR>