Skip to content

Commit 705f94f

Browse files
committed
Release v0.0.78
1 parent cae9778 commit 705f94f

File tree

9 files changed

+1035
-756
lines changed

9 files changed

+1035
-756
lines changed

Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
4242
```
4343

4444
in your `.vimrc` or `init.vim`, then restart Vim and run `:PlugInstall`.
45+
4546
Checkout [Install
4647
coc.nvim](https://github.com/neoclide/coc.nvim/wiki/Install-coc.nvim) Wiki for
4748
more info.
@@ -98,8 +99,7 @@ inoremap <silent><expr> <c-space> coc#refresh()
9899
99100
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
100101
" position. Coc only does snippet and additional edit on confirm.
101-
if has('patch8.1.1068')
102-
" Use `complete_info` if your (Neo)Vim version supports it.
102+
if exists('*complete_info')
103103
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
104104
else
105105
imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"

autoload/coc/api.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ function! s:funcs.buf_set_lines(bufnr, start, end, strict, ...) abort
346346
let changeBuffer = 1
347347
exe 'buffer '.a:bufnr
348348
endif
349+
let storeView = winsaveview()
349350
if a:bufnr == curr || changeBuffer
350351
" replace
351352
if delCount == len(replacement)
@@ -361,6 +362,7 @@ function! s:funcs.buf_set_lines(bufnr, start, end, strict, ...) abort
361362
let @" = saved_reg
362363
endif
363364
endif
365+
call winrestview(storeView)
364366
if changeBuffer
365367
exe 'buffer '.curr
366368
endif
@@ -380,6 +382,7 @@ function! s:funcs.buf_set_lines(bufnr, start, end, strict, ...) abort
380382
call deletebufline(a:bufnr, start, start + delCount - 1)
381383
endif
382384
endif
385+
call winrestview(storeView)
383386
endif
384387
endfunction
385388

autoload/coc/util.vim

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,36 @@ function! coc#util#with_callback(method, args, cb)
454454
call timer_start(timeout, {-> s:Cb() })
455455
endfunction
456456

457+
function! coc#util#quickpick(title, items, cb) abort
458+
if exists('*popup_menu')
459+
function! s:QuickpickHandler(id, result) closure
460+
call a:cb(v:null, a:result)
461+
endfunction
462+
function! s:QuickpickFilter(id, key) closure
463+
for i in range(1, len(a:items))
464+
if a:key == string(i)
465+
call popup_close(a:id, i)
466+
return 1
467+
endif
468+
endfor
469+
" No shortcut, pass to generic filter
470+
return popup_filter_menu(a:id, a:key)
471+
endfunction
472+
try
473+
call popup_menu(a:items, #{
474+
\ title: a:title,
475+
\ filter: function('s:QuickpickFilter'),
476+
\ callback: function('s:QuickpickHandler'),
477+
\ })
478+
catch /.*/
479+
call a:cb(v:exception)
480+
endtry
481+
else
482+
let res = inputlist([a:title] + a:items)
483+
call a:cb(v:null, res)
484+
endif
485+
endfunction
486+
457487
function! coc#util#add_matchids(ids)
458488
let w:coc_matchids = get(w:, 'coc_matchids', []) + a:ids
459489
endfunction

0 commit comments

Comments
 (0)