autoload/lsp/options.vim | 4 ++-- doc/lsp.txt | 4 ++-- test/clangd_tests.vim | 25 +++++++++++++------------ diff --git a/autoload/lsp/options.vim b/autoload/lsp/options.vim index e8438c55953e765857b9345d431e570d5781f394..9631a5365381fd4f9d25dbbff1c9c640b9ef88ba 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -32,9 +32,9 @@ hoverInPreview: false, # 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. diff --git a/doc/lsp.txt b/doc/lsp.txt index 8312f95ca8ca1d6324ed9b531d0cf82b36adcb2a..47ddad31edd5ba5eaec7b62ead67e928a9460164 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -491,11 +491,11 @@ server executable. By default this is set to false. *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 diff --git a/test/clangd_tests.vim b/test/clangd_tests.vim index bd709ceb81df06e45abcc17bb42910729b69343d..08952c5330610863ffc11338186cb39cc1b0e5c3 100644 --- a/test/clangd_tests.vim +++ b/test/clangd_tests.vim @@ -185,7 +185,7 @@ assert_equal(3, loclist->len()) 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 @@ cursor(5, 2) :LspShowReferences sleep 100m assert_equal('quickfix', getwinvar(winnr('$'), '&buftype')) + :cclose var qfl: list> = 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 @@ assert_equal([1, 5], [qfl[0].lnum, qfl[0].col]) :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 @@ assert_equal(3, qfl->len()) 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 @@ :LspDiagPrev 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 @@ assert_equal([1, 5, 'W'], [qfl[0].lnum, qfl[0].col, qfl[0].type]) 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 @@ # LspShowReferences cursor(6, 10) assert_equal([], execute('LspShowReferences')->split("\n")) + :lclose # LspRename cursor(6, 10)