Skip to content

Commit

Permalink
Fix for msgpack breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Feb 19, 2020
1 parent eeb067c commit 901d19d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 10 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ not fixed anymore
Denite requires Neovim 0.3.0+ or Vim 8.0+ with `if_python3`.
If `:echo has("python3")` returns `1`, then you're done.

Note: You need to install Python3.6.1+.
Note: Please install/upgrade msgpack package (1.0.0+).
https://github.com/msgpack/msgpack-python

Note: You need to install Python 3.6.1+.

For neovim:

Expand Down
13 changes: 13 additions & 0 deletions autoload/denite/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ function! denite#init#_initialize() abort
call denite#util#print_error(v:exception)
call denite#util#print_error(v:throwpoint)

if !denite#init#_msgpack_version_check()
call denite#util#print_error('denite requires msgpack 1.0.0+.')
endif

if denite#util#has_yarp()
if !has('nvim') && !exists('*neovim_rpc#serveraddr')
call denite#util#print_error(
Expand Down Expand Up @@ -160,3 +164,12 @@ vim.vars['denite#_python_version_check'] = (
EOF
return g:denite#_python_version_check
endfunction

function! denite#init#_msgpack_version_check() abort
python3 << EOF
import vim
import msgpack
vim.vars['denite#_msgpack_version_check'] = msgpack.version < (1, 0, 0)
EOF
return get(g:, 'denite#_msgpack_version_check', 0)
endfunction
17 changes: 14 additions & 3 deletions autoload/health/denite.vim
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,27 @@ function! s:check_required_python() abort
endif

if !denite#init#_python_version_check()
call health#report_ok('Python3.6.1+ was successful')
call health#report_ok('Python 3.6.1+ was successful')
else
call health#report_error(
\ 'Python3.6.1+ was not successful',
\ 'Please use Python3.6.1+.')
\ 'Python 3.6.1+ was not successful',
\ 'Please use Python 3.6.1+.')
endif
endfunction

function! s:check_required_msgpack() abort
if !denite#init#_msgpack_version_check()
call health#report_ok('Require msgpack 1.0.0+ was successful')
else
call health#report_error(
\ 'Require msgpack 1.0.0+ was not successful',
\ 'Please install/upgrade msgpack 1.0.0+.')
endif
endfunction

function! health#denite#check() abort
call health#report_start('denite.nvim')

call s:check_required_python()
call s:check_required_msgpack()
endfunction
11 changes: 9 additions & 2 deletions doc/denite.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*denite.txt* Dark powered asynchronous unite all interfaces for NeoVim/Vim.

Version: 3.1
Version: 3.2
Author: Shougo <Shougo.Matsu at gmail.com>
License: MIT license

Expand Down Expand Up @@ -86,7 +86,10 @@ INSTALL *denite-install*

Note: denite requires Neovim 0.3.0+ or Vim 8.0+ with |:python3| enabled.

Note: You need to install Python3.6.1+.
Note: Please install/upgrade msgpack package (1.0.0+).
https://github.com/msgpack/msgpack-python

Note: You need to install Python 3.6.1+.

For neovim:

Expand Down Expand Up @@ -2059,6 +2062,10 @@ A:
==============================================================================
COMPATIBILITY *denite-compatibility*

2020.02.19
* msgpack 1.0.0+ is required
https://github.com/msgpack/msgpack-python#major-breaking-changes-in-msgpack-10

2020.02.17
* Rename "-previewheight" option to "-preview-height".

Expand Down
2 changes: 0 additions & 2 deletions rplugin/python3/denite/child.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ def __init__(self, vim: Nvim) -> None:
self._runtimepath = ''
self._current_sources: typing.List[typing.Any] = []
self._unpacker = msgpack.Unpacker(
encoding='utf-8',
unicode_errors='surrogateescape')
self._packer = msgpack.Packer(
use_bin_type=True,
encoding='utf-8',
unicode_errors='surrogateescape')

def main_loop(self, stdout: typing.Any) -> None:
Expand Down
2 changes: 0 additions & 2 deletions rplugin/python3/denite/parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ def _start_process(self) -> None:
self._queue_out: Queue[str] = Queue()
self._packer = msgpack.Packer(
use_bin_type=True,
encoding='utf-8',
unicode_errors='surrogateescape')
self._unpacker = msgpack.Unpacker(
encoding='utf-8',
unicode_errors='surrogateescape')

info = None
Expand Down

0 comments on commit 901d19d

Please sign in to comment.