]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Rename sync option to syncInit and update doc
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 24 Sep 2022 01:19:55 +0000 (18:19 -0700)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 24 Sep 2022 01:19:55 +0000 (18:19 -0700)
autoload/lsp/lsp.vim
autoload/lsp/lspserver.vim
doc/lsp.txt
test/unit_tests.vim

index c29f1c451bf0bd7347d2103dd4ff6c53cd370c2c..8fbc9cf7386b4a5d13f33bdbbb038fcc7b1785a2 100644 (file)
@@ -497,12 +497,12 @@ export def AddServer(serverList: list<dict<any>>)
       return
     endif
 
-    if !server->has_key('sync')
-      server['sync'] = v:false
+    if !server->has_key('syncInit')
+      server.syncInit = v:false
     endif
 
     var lspserver: dict<any> = lserver.NewLspServer(server.path, args,
-          \ server.sync)
+                                                   server.syncInit)
 
     if server.filetype->type() == v:t_string
       LspAddServer(server.filetype, lspserver)
index 2c4e25724e6d1da9fdab861442a23766924bc611..ad8e9f8fa3bb5fa2edafaa2b8efcf4fb0fe1881a 100644 (file)
@@ -172,7 +172,7 @@ def InitServer(lspserver: dict<any>)
   req.params->extend(initparams)
 
   lspserver.sendMessage(req)
-  if lspserver.sync
+  if lspserver.syncInit
     lspserver.waitForResponse(req)
   endif
 enddef
@@ -1020,7 +1020,7 @@ export def NewLspServer(path: string, args: list<string>, isSync: bool): dict<an
   var lspserver: dict<any> = {
     path: path,
     args: args,
-    sync: isSync,
+    syncInit: isSync,
     running: false,
     ready: false,
     job: v:none,
index 3dee5e256655cb6e656a538f59f5d9f68f7d307f..79d09e89f0171396174cfa6e502d63eec97014f1 100644 (file)
@@ -203,10 +203,13 @@ To add a LSP server, the following information is needed:
                        server. Each argument is a separate List item.
        omnicompl       a boolean value that enables (true) or disables
                        (false) omni-completion for this file type.
-        sync            (Optional) for lsp servers that responds to a 
-                        'initialize'-request with a 'initialzed' response this
-                        should be set to 'v:true'. By default this is set to
-                        'v:false'.
+       syncInit        (Optional) for lsp servers (e.g. rust analyzer, gopls)
+                       that take time to reply to a 'initialize' request
+                       message this should be set to 'v:true'. By default
+                       this is set to 'v:false'.  If this is set to true,
+                       then a synchronous call is used to initialize the LSP
+                       server.  Otherwise the server is initialized
+                       asynchronously.
 
 The LSP servers are added using the LspAddServer() function. This function
 accepts a list of LSP servers with the above information.
index a6603ac8d97d0eada94ad88bb8a426ea8df32a9d..62d9fc54fa05739959d6839d144c36db1055fe7f 100644 (file)
@@ -661,7 +661,7 @@ def Test_LspShowSignature()
   var expected: dict<any>
   expected = {id: 0, col: 8, end: 1, type: 'signature', length: 5, start: 1}
   if has('patch-8.2.3233')
-    expected.type_bufnr = 11
+    expected.type_bufnr = bnr
   endif
   assert_equal([expected], prop_list(1, {bufnr: bnr}))
   popup_close(p[0])
@@ -675,7 +675,7 @@ def Test_LspShowSignature()
   assert_equal(['MyFunc(int a, int b) -> int'], getbufline(bnr, 1, '$'))
   expected = {id: 0, col: 15, end: 1, type: 'signature', length: 5, start: 1}
   if has('patch-8.2.3233')
-    expected.type_bufnr = 11
+    expected.type_bufnr = bnr
   endif
   assert_equal([expected], prop_list(1, {bufnr: bnr}))
   popup_close(p[0])