]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
default to true and update tests
authornewtonne <14221622+newtonne@users.noreply.github.com>
Tue, 23 May 2023 20:21:56 +0000 (21:21 +0100)
committernewtonne <14221622+newtonne@users.noreply.github.com>
Tue, 23 May 2023 20:21:56 +0000 (21:21 +0100)
autoload/lsp/options.vim
doc/lsp.txt
test/clangd_tests.vim

index e8438c55953e765857b9345d431e570d5781f394..9631a5365381fd4f9d25dbbff1c9c640b9ef88ba 100644 (file)
@@ -32,9 +32,9 @@ export var lspOptions: dict<any> = {
   # Don't print message when a configured language server is missing.
   ignoreMissingServer: false,
   # Focus on the location list window after LspDiagShow
-  keepFocusInDiags: false,
+  keepFocusInDiags: true,
   # Focus on the location list window after LspShowReferences
-  keepFocusInReferences: false,
+  keepFocusInReferences: true,
   # If true, apply the LSP server supplied text edits after a completion.
   # If a snippet plugin is going to apply the text edits, then set this to
   # false to avoid applying the text edits twice.
index 8312f95ca8ca1d6324ed9b531d0cf82b36adcb2a..47ddad31edd5ba5eaec7b62ead67e928a9460164 100644 (file)
@@ -491,11 +491,11 @@ ignoreMissingServer       |Boolean| option.  Do not print a missing language
                                                *lsp-opt-keepFocusInDiags*
 keepFocusInDiags       |Boolean| option.  Focus on the location list window
                        after LspDiagShow.
-                       By default this is set to false.
+                       By default this is set to true.
                                                *lsp-opt-keepFocusInReferences*
 keepFocusInReferences  |Boolean| option.  Focus on the location list window
                        after LspShowReferences.
-                       By default this is set to false.
+                       By default this is set to true.
                                                *lsp-opt-noDiagHoverOnLine*
 noDiagHoverOnLine      |Boolean| option.  Suppress diagnostic hover from
                        appearing when the mouse is over the line instead of
index bd709ceb81df06e45abcc17bb42910729b69343d..08952c5330610863ffc11338186cb39cc1b0e5c3 100644 (file)
@@ -185,7 +185,7 @@ def g:Test_LspShowReferences()
   assert_equal([4, 6], [loclist[0].lnum, loclist[0].col])
   assert_equal([5, 2], [loclist[1].lnum, loclist[1].col])
   assert_equal([6, 6], [loclist[2].lnum, loclist[2].col])
-  :only
+  :lclose
   cursor(1, 5)
   :LspShowReferences
   assert_equal(1, getloclist(0)->len())
@@ -199,13 +199,13 @@ def g:Test_LspShowReferences()
   :LspShowReferences
   sleep 100m
   assert_equal('quickfix', getwinvar(winnr('$'), '&buftype'))
+  :cclose
   var qfl: list<dict<any>> = getqflist()
   assert_equal(3, qfl->len())
   assert_equal(bufnr(), qfl[0].bufnr)
   assert_equal([4, 6], [qfl[0].lnum, qfl[0].col])
   assert_equal([5, 2], [qfl[1].lnum, qfl[1].col])
   assert_equal([6, 6], [qfl[2].lnum, qfl[2].col])
-  :only
   cursor(1, 5)
   :LspShowReferences
   assert_equal(1, getqflist()->len())
@@ -214,12 +214,12 @@ def g:Test_LspShowReferences()
   :cclose
   g:LspOptionsSet({ useQuickfixForLocations: false })
 
-  # Test for moving buffer focus to loclist
-  g:LspOptionsSet({ keepFocusInReferences: true })
+  # Test for maintaining buffer focus
+  g:LspOptionsSet({ keepFocusInReferences: false })
   :LspShowReferences
-  assert_equal('quickfix', getwinvar(0, '&buftype'))
+  assert_equal('', getwinvar(0, '&buftype'))
   :lclose
-  g:LspOptionsSet({ keepFocusInReferences: false })
+  g:LspOptionsSet({ keepFocusInReferences: true })
 
   # Test for LspPeekReferences
 
@@ -282,7 +282,7 @@ def g:Test_LspDiag()
   assert_equal([3, 14, 'E'], [qfl[0].lnum, qfl[0].col, qfl[0].type])
   assert_equal([5, 2, 'W'], [qfl[1].lnum, qfl[1].col, qfl[1].type])
   assert_equal([7, 2, 'W'], [qfl[2].lnum, qfl[2].col, qfl[2].type])
-  :lclose
+  close
   g:LspOptionsSet({showDiagInPopup: false})
   normal gg
   var output = execute('LspDiagCurrent')->split("\n")
@@ -306,12 +306,12 @@ def g:Test_LspDiag()
   output = execute('LspDiagPrev')->split("\n")
   assert_equal('Warn: No more diagnostics found', output[0])
 
-  # Test for moving buffer focus to loclist
-  g:LspOptionsSet({ keepFocusInDiags: true })
+  # Test for maintaining buffer focus
+  g:LspOptionsSet({ keepFocusInDiags: false })
   :LspDiagShow
-  assert_equal('quickfix', getwinvar(0, '&buftype'))
+  assert_equal('', getwinvar(0, '&buftype'))
   :lclose
-  g:LspOptionsSet({ keepFocusInDiags: false })
+  g:LspOptionsSet({ keepFocusInDiags: true })
 
   # :[count]LspDiagNext
   cursor(3, 1)
@@ -435,7 +435,7 @@ def g:Test_LspDiag_Multi()
   endif
   assert_equal([1, 9, 'E'], [qfl[1].lnum, qfl[1].col, qfl[1].type])
   assert_equal([2, 9, 'E'], [qfl[2].lnum, qfl[2].col, qfl[2].type])
-  :lclose
+  close
 
   :sleep 100m
   cursor(2, 1)
@@ -1363,6 +1363,7 @@ def g:Test_ScanFindIdent()
   cursor(6, 10)
   assert_equal([],
               execute('LspShowReferences')->split("\n"))
+  :lclose
 
   # LspRename
   cursor(6, 10)