From: Andreas Louv Date: Sun, 16 Apr 2023 07:40:12 +0000 (+0200) Subject: Add to ":LspOutline" X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=110870ef30dbf2f49e8f4a579a6067aabd99d7aa;p=vim-lsp.git Add to ":LspOutline" This will allow you to add command modifiers to the created Outline window. The option "outlineOnRight" is still respected but can be overridden by explicitly setting another modifier. --- diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index 7c86f8f..3f364bd 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -801,8 +801,8 @@ def g:LspRequestDocSymbols() enddef # open a window and display all the symbols in a file (outline) -export def Outline() - outline.OpenOutlineWindow() +export def Outline(cmdmods: string) + outline.OpenOutlineWindow(cmdmods) g:LspRequestDocSymbols() enddef diff --git a/autoload/lsp/outline.vim b/autoload/lsp/outline.vim index 266fc55..eb91ea1 100644 --- a/autoload/lsp/outline.vim +++ b/autoload/lsp/outline.vim @@ -218,7 +218,7 @@ def OutlineCleanup() enddef # open the symbol outline window -export def OpenOutlineWindow() +export def OpenOutlineWindow(cmdmods: string) var wid: number = bufwinid('LSP-Outline') if wid != -1 return @@ -226,11 +226,16 @@ export def OpenOutlineWindow() var prevWinID: number = win_getid() - if opt.lspOptions.outlineOnRight - execute $':botright :{opt.lspOptions.outlineWinSize}vnew LSP-Outline' - else - execute $':topleft :{opt.lspOptions.outlineWinSize}vnew LSP-Outline' + var mods = cmdmods + if mods == '' + if opt.lspOptions.outlineOnRight + mods = ':botright' + else + mods = ':topleft' + endif endif + + execute $'{mods} :{opt.lspOptions.outlineWinSize}vnew LSP-Outline' :setlocal modifiable :setlocal noreadonly :silent! :%d _ diff --git a/plugin/lsp.vim b/plugin/lsp.vim index 3aaf201..cc2a496 100644 --- a/plugin/lsp.vim +++ b/plugin/lsp.vim @@ -78,7 +78,7 @@ command! -nargs=0 -bar LspHighlightClear call LspDocHighlightClear() command! -nargs=0 -bar LspHover lsp.Hover() command! -nargs=0 -bar LspIncomingCalls lsp.IncomingCalls() command! -nargs=0 -bar LspOutgoingCalls lsp.OutgoingCalls() -command! -nargs=0 -bar LspOutline lsp.Outline() +command! -nargs=0 -bar LspOutline lsp.Outline() command! -nargs=0 -bar LspPeekDeclaration lsp.GotoDeclaration(v:true, ) command! -nargs=0 -bar LspPeekDefinition lsp.GotoDefinition(v:true, ) command! -nargs=0 -bar LspPeekImpl lsp.GotoImplementation(v:true, )