From 3e85f41c895b2d4b52459e29e4c35595d4bc37d6 Mon Sep 17 00:00:00 2001 From: "shane.xb.qian" Date: Thu, 27 Oct 2022 06:51:59 +0800 Subject: [PATCH] clarify the comment about symbol jump if same buf had in cur win --- autoload/lsp/symbol.vim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/autoload/lsp/symbol.vim b/autoload/lsp/symbol.vim index 1480aad..f4c4ca5 100644 --- a/autoload/lsp/symbol.vim +++ b/autoload/lsp/symbol.vim @@ -103,13 +103,16 @@ def JumpToWorkspaceSymbol(popupID: number, result: number): void else var wid = fname->bufwinid() if wid != -1 + # if had one in cur tab + # and cur win is same buf if bufwinid(bufnr()) == wid - # do nothing if cur one is + # do nothing else - # jump to one in cur tab + # or pick up one in cur tab wid->win_gotoid() endif else + # or pick up one in one tab winList[0]->win_gotoid() endif endif @@ -301,7 +304,10 @@ export def GotoSymbol(lspserver: dict, location: dict, peekSymbol: boo # jump to the file and line containing the symbol var wid = fname->bufwinid() if wid != -1 - # do not jump if cur one is same buf + # `wid` maybe just is one of windows in cur tab which had same buf + # jump to `wid` only if cur one is not same buf or maybe a bit mess + # which should always try to re-use cur one firstly (if it is same) + # otherwise cursor perhaps dumbly jumpped to `wid` though same buf if bufwinid(bufnr()) != wid wid->win_gotoid() endif -- 2.48.1