From: newtonne <14221622+newtonne@users.noreply.github.com> Date: Tue, 23 May 2023 20:21:56 +0000 (+0100) Subject: default to true and update tests X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=4badbf55add534be9984e52984418164cba16044;p=vim-lsp.git default to true and update tests --- diff --git a/autoload/lsp/options.vim b/autoload/lsp/options.vim index e8438c5..9631a53 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -32,9 +32,9 @@ export var lspOptions: dict = { # 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 8312f95..47ddad3 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -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 diff --git a/test/clangd_tests.vim b/test/clangd_tests.vim index bd709ce..08952c5 100644 --- a/test/clangd_tests.vim +++ b/test/clangd_tests.vim @@ -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> = 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)