From: Yegappan Lakshmanan Date: Sat, 24 Sep 2022 01:19:55 +0000 (-0700) Subject: Rename sync option to syncInit and update doc X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=2f8ef07a087c62027467cef4bbe5d427f72150dc;p=vim-lsp.git Rename sync option to syncInit and update doc --- diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index c29f1c4..8fbc9cf 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -497,12 +497,12 @@ export def AddServer(serverList: list>) return endif - if !server->has_key('sync') - server['sync'] = v:false + if !server->has_key('syncInit') + server.syncInit = v:false endif var lspserver: dict = lserver.NewLspServer(server.path, args, - \ server.sync) + server.syncInit) if server.filetype->type() == v:t_string LspAddServer(server.filetype, lspserver) diff --git a/autoload/lsp/lspserver.vim b/autoload/lsp/lspserver.vim index 2c4e257..ad8e9f8 100644 --- a/autoload/lsp/lspserver.vim +++ b/autoload/lsp/lspserver.vim @@ -172,7 +172,7 @@ def InitServer(lspserver: dict) 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, isSync: bool): dict = { path: path, args: args, - sync: isSync, + syncInit: isSync, running: false, ready: false, job: v:none, diff --git a/doc/lsp.txt b/doc/lsp.txt index 3dee5e2..79d09e8 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -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. diff --git a/test/unit_tests.vim b/test/unit_tests.vim index a6603ac..62d9fc5 100644 --- a/test/unit_tests.vim +++ b/test/unit_tests.vim @@ -661,7 +661,7 @@ def Test_LspShowSignature() var expected: dict 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])