Skip to content

Commit e71ae18

Browse files
committed
Renamed variable of preview window id
1 parent b242af3 commit e71ae18

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

autoload/lsp/ui/vim/output.vim

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
let s:supports_floating = exists('*nvim_open_win') || has('patch-8.1.1517')
2-
let s:win = v:false
2+
let s:winid = v:false
33
let s:prevwin = v:false
44

55
function! lsp#ui#vim#output#closepreview() abort
6-
if win_getid() == s:win
6+
if win_getid() == s:winid
77
" Don't close if window got focus
88
return
99
endif
1010
"closing floats in vim8.1 must use popup_close() (nvim could use nvim_win_close but pclose
1111
"works)
12-
if s:supports_floating && s:win && g:lsp_preview_float && !has('nvim')
12+
if s:supports_floating && s:winid && g:lsp_preview_float && !has('nvim')
1313
" TODO:
14-
call popup_close(s:win)
14+
call popup_close(s:winid)
1515
else
1616
pclose
1717
endif
18-
let s:win = v:false
18+
let s:winid = v:false
1919
autocmd! lsp_float_preview_close CursorMoved,CursorMovedI,VimResized *
2020
endfunction
2121

2222
function! lsp#ui#vim#output#focuspreview() abort
2323
" This does not work for vim8.1 popup but will work for nvim and old preview
24-
if s:win
25-
if win_getid() != s:win
24+
if s:winid
25+
if win_getid() != s:winid
2626
let s:prevwin = win_getid()
27-
call win_gotoid(s:win)
27+
call win_gotoid(s:winid)
2828
elseif s:prevwin
2929
" Temporarily disable hooks
3030
" TODO: remove this when closing logic is able to distinguish different move directions
@@ -98,30 +98,30 @@ function! lsp#ui#vim#output#floatingpreview(data) abort
9898

9999
let l:opts = s:get_float_positioning(l:height, l:width)
100100

101-
let s:win = nvim_open_win(buf, v:true, l:opts)
102-
call nvim_win_set_option(s:win, 'winhl', 'Normal:Pmenu,NormalNC:Pmenu')
103-
call nvim_win_set_option(s:win, 'foldenable', v:false)
104-
call nvim_win_set_option(s:win, 'wrap', v:true)
105-
call nvim_win_set_option(s:win, 'statusline', '')
106-
call nvim_win_set_option(s:win, 'number', v:false)
107-
call nvim_win_set_option(s:win, 'relativenumber', v:false)
108-
call nvim_win_set_option(s:win, 'cursorline', v:false)
101+
let s:winid = nvim_open_win(buf, v:true, l:opts)
102+
call nvim_win_set_option(s:winid, 'winhl', 'Normal:Pmenu,NormalNC:Pmenu')
103+
call nvim_win_set_option(s:winid, 'foldenable', v:false)
104+
call nvim_win_set_option(s:winid, 'wrap', v:true)
105+
call nvim_win_set_option(s:winid, 'statusline', '')
106+
call nvim_win_set_option(s:winid, 'number', v:false)
107+
call nvim_win_set_option(s:winid, 'relativenumber', v:false)
108+
call nvim_win_set_option(s:winid, 'cursorline', v:false)
109109
" Enable closing the preview with esc, but map only in the scratch buffer
110110
nmap <buffer><silent> <esc> :pclose<cr>
111111
else
112-
let s:win = popup_atcursor('...', {
112+
let s:winid = popup_atcursor('...', {
113113
\ 'moved': 'any',
114114
\ 'border': [1, 1, 1, 1],
115115
\})
116116
endif
117-
return s:win
117+
return s:winid
118118
endfunction
119119

120120
function! s:setcontent(lines, ft) abort
121121
if s:supports_floating && g:lsp_preview_float && !has('nvim')
122122
" vim popup
123-
call setbufline(winbufnr(s:win), 1, a:lines)
124-
call win_execute(s:win, 'setlocal filetype=' . a:ft . '.lsp-hover')
123+
call setbufline(winbufnr(s:winid), 1, a:lines)
124+
call win_execute(s:winid, 'setlocal filetype=' . a:ft . '.lsp-hover')
125125
else
126126
" nvim floating
127127
call setline(1, a:lines)
@@ -133,10 +133,10 @@ endfunction
133133
function! s:adjust_float_placement(bufferlines, maxwidth) abort
134134
if has('nvim')
135135
let l:win_config = {}
136-
let l:height = min([winheight(s:win), a:bufferlines])
137-
let l:width = min([winwidth(s:win), a:maxwidth])
136+
let l:height = min([winheight(s:winid), a:bufferlines])
137+
let l:width = min([winwidth(s:winid), a:maxwidth])
138138
let l:win_config = s:get_float_positioning(l:height, l:width)
139-
call nvim_win_set_config(s:win, l:win_config )
139+
call nvim_win_set_config(s:winid, l:win_config )
140140
endif
141141
endfunction
142142

@@ -156,10 +156,10 @@ function! lsp#ui#vim#output#preview(data) abort
156156
let l:current_window_id = win_getid()
157157

158158
if s:supports_floating && g:lsp_preview_float
159-
let s:win = lsp#ui#vim#output#floatingpreview(a:data)
159+
let s:winid = lsp#ui#vim#output#floatingpreview(a:data)
160160
else
161161
execute &previewheight.'new'
162-
let s:win = win_getid()
162+
let s:winid = win_getid()
163163
endif
164164

165165
let l:lines = []
@@ -177,7 +177,7 @@ function! lsp#ui#vim#output#preview(data) abort
177177

178178
echo ''
179179

180-
if s:supports_floating && s:win && g:lsp_preview_float && has('nvim')
180+
if s:supports_floating && s:winid && g:lsp_preview_float && has('nvim')
181181
call s:adjust_float_placement(l:bufferlines, l:maxwidth)
182182
call s:add_float_closing_hooks()
183183
endif

0 commit comments

Comments
 (0)