Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Fix #471 Parallel #602

Merged
merged 41 commits into from
Feb 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
eed738a
Improve merge_results()
Shougo Dec 17, 2017
a91ea6a
WIP: add child.py
Shougo Dec 17, 2017
19431f6
Splitted to child.py
Shougo Dec 24, 2017
4565218
Add max_children
Shougo Dec 24, 2017
1858a75
Fix logging
Shougo Dec 27, 2017
0c786bf
Fix ignorecase
Shougo Dec 27, 2017
167fe7f
Remove profile flag
Shougo Dec 27, 2017
79c2d23
Add duplicated sources/filters check
Shougo Dec 27, 2017
89793ba
Add the debug messages
Shougo Dec 27, 2017
c94a488
Add thread
Shougo Dec 27, 2017
c6d8bc6
Improve add_source()
Shougo Jan 1, 2018
4fbe097
WIP: add main loop
Shougo Jan 1, 2018
b299e7d
WIP: attach Vim
Shougo Jan 1, 2018
389b625
Improve gather_async_results()
Shougo Jan 1, 2018
dedcb83
Add _start_thread()/_stop_thread()
Shougo Jan 1, 2018
700b7f8
Add daemon flag
Shougo Jan 7, 2018
ce51f0c
Add dp_main.py
Shougo Jan 7, 2018
38b9a65
WIP: multi process
Shougo Jan 8, 2018
ab9d231
WIP: multi process
Shougo Jan 8, 2018
572fa2c
WIP: main_loop()
Shougo Jan 8, 2018
f3663f1
WIP: Implement multi process
Shougo Jan 8, 2018
4d7f09e
Clear child_in variable
Shougo Jan 8, 2018
e913bb1
Fix error check
Shougo Jan 28, 2018
933df0f
Fix import error
Shougo Jan 28, 2018
b988887
Use msgpack instead
Shougo Jan 28, 2018
e1560dd
Change private attributes
Shougo Jan 28, 2018
e320da6
[RFC] parallel feature
Shougo Jan 28, 2018
bc5deb9
Fix sorting problem
Shougo Jan 28, 2018
e832f25
Fix surrogate pair errors
Shougo Jan 28, 2018
b317482
Improve main loop
Shougo Jan 28, 2018
1ea0d5f
Optimized
Shougo Jan 30, 2018
2d2e101
Fix debug feature
Shougo Jan 30, 2018
2e29bb6
Update README
Shougo Jan 30, 2018
1783e4a
Fix the documentation
Shougo Jan 30, 2018
3c02a2f
wait to kill python processes.
RyoSusami Feb 4, 2018
bb05c65
wait to kill python processes use only nvim.
RyoSusami Feb 4, 2018
27a8872
use ==# to pass the Travis CI.
RyoSusami Feb 4, 2018
7652c94
Merge pull request #625 from RyoSusami/parallel
Shougo Feb 4, 2018
0a073d4
Fix logging error
Shougo Feb 4, 2018
6cac264
Fix documentation
Shougo Feb 4, 2018
e37de74
Fix start_process() error
Shougo Feb 4, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@ To view the current options, please consult the
## Installation

**Note:** deoplete requires Neovim(latest is recommended) or Vim8 with Python3 and
timers(neovim ver.0.1.5+) enabled. See [requirements](#requirements) if you
aren't sure whether you have this.

1. Extract the files and put them in your Neovim or .vim directory
(usually `$XDG_CONFIG_HOME/nvim/`).
2. Write `call deoplete#enable()` or `let g:deoplete#enable_at_startup = 1` in
your `init.vim`
timers enabled. See [requirements](#requirements) if you aren't sure whether
you have this.


For vim-plug
Expand All @@ -34,6 +29,7 @@ else
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
let g:deoplete#enable_at_startup = 1
```

For dein.vim
Expand All @@ -44,13 +40,22 @@ if !has('nvim')
call dein#add('roxma/nvim-yarp')
call dein#add('roxma/vim-hug-neovim-rpc')
endif
let g:deoplete#enable_at_startup = 1
```

For manual installation(not recommended)

1. Extract the files and put them in your Neovim or .vim directory
(usually `$XDG_CONFIG_HOME/nvim/`).

2. Write `call deoplete#enable()` or `let g:deoplete#enable_at_startup = 1` in
your `init.vim`


## Requirements

deoplete requires Neovim or Vim8 with if\_python3.
If `:echo has("python3")` returns `1`, then you have python 3 support; otherwise, see below.
deoplete requires Neovim or Vim8 with if\_python3. If `:echo has("python3")`
returns `1`, then you have python 3 support; otherwise, see below.

You can enable Python3 interface with pip:

Expand All @@ -76,6 +81,7 @@ auto-completion.
let g:deoplete#enable_at_startup = 1
```


## Sources

deoplete will display completions via `complete()` by default.
Expand Down Expand Up @@ -122,5 +128,4 @@ https://www.youtube.com/watch?v=oanoPTpiSF4

[Register/Extract list completions](https://camo.githubusercontent.com/6a6df993ad0e05c014c72c8f8702447f9b34ad90/68747470733a2f2f692e696d6775722e636f6d2f5131663731744a2e676966)

### deoplete-fsharp sample ( Enjoy! )
![FSharp completion using deopletefs](https://github.com/callmekohei/deoplete-fsharp/blob/master/pic/sample.gif)
23 changes: 13 additions & 10 deletions autoload/deoplete/handler.vim
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ function! s:do_complete(timer) abort
return
endif

let prev = g:deoplete#_prev_completion
if context.event !=# 'Manual'
\ && s:prev_completion.complete_position == getpos('.')
\ && s:prev_completion.candidates ==# context.candidates
\ && prev.complete_position == getpos('.')
\ && prev.candidates ==# context.candidates
return
endif

let s:prev_completion.event = context.event
let s:prev_completion.candidates = context.candidates
let s:prev_completion.complete_position = getpos('.')
let prev.event = context.event
let prev.candidates = context.candidates
let prev.complete_position = getpos('.')

if context.event ==# 'Manual'
let context.event = ''
Expand All @@ -83,11 +84,13 @@ function! deoplete#handler#_completion_timer_start() abort
call s:completion_timer_stop()
endif

let delay = max([50, g:deoplete#auto_complete_delay])
let delay = max([20, g:deoplete#auto_complete_delay])
let s:completion_timer = timer_start(delay, function('s:do_complete'))

let s:prev_completion = {
\ 'complete_position': [], 'candidates': [], 'event': ''
let g:deoplete#_prev_completion = {
\ 'complete_position': [],
\ 'candidates': [],
\ 'event': '',
\ }
endfunction
function! s:completion_timer_stop() abort
Expand All @@ -106,7 +109,7 @@ function! deoplete#handler#_async_timer_start() abort

let s:async_timer = { 'event': 'Async', 'changedtick': b:changedtick }
let s:async_timer.id = timer_start(
\ max([50, g:deoplete#auto_refresh_delay]),
\ max([20, g:deoplete#auto_refresh_delay]),
\ function('s:completion_async'), {'repeat': -1})
endfunction
function! deoplete#handler#_async_timer_stop() abort
Expand All @@ -132,7 +135,7 @@ function! s:completion_begin(event) abort
return
endif

if exists('s:prev_completion') && s:prev_completion.event !=# 'Manual'
if g:deoplete#_prev_completion.event !=# 'Manual'
" Call omni completion
for filetype in context.filetypes
for pattern in deoplete#util#convert2list(
Expand Down
16 changes: 15 additions & 1 deletion autoload/deoplete/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
" License: MIT license
"=============================================================================

let s:dp_main = fnamemodify(expand('<sfile>'), ':h:h:h')
\ . '/rplugin/python3/deoplete/dp_main.py'

if !exists('s:is_enabled')
let s:is_enabled = 0
endif
Expand Down Expand Up @@ -100,6 +103,11 @@ function! deoplete#init#_disable() abort
endfunction

function! deoplete#init#_variables() abort
let g:deoplete#_prev_completion = {
\ 'complete_position': [],
\ 'candidates': [],
\ 'event': '',
\ }
let g:deoplete#_context = {}
let g:deoplete#_rank = {}
if !exists('g:deoplete#_logging')
Expand Down Expand Up @@ -135,7 +143,7 @@ function! deoplete#init#_variables() abort
call deoplete#util#set_default(
\ 'g:deoplete#auto_complete_delay', 50)
call deoplete#util#set_default(
\ 'g:deoplete#auto_refresh_delay', 500)
\ 'g:deoplete#auto_refresh_delay', 50)
call deoplete#util#set_default(
\ 'g:deoplete#max_abbr_width', 80)
call deoplete#util#set_default(
Expand All @@ -144,6 +152,8 @@ function! deoplete#init#_variables() abort
\ 'g:deoplete#skip_chars', [])
call deoplete#util#set_default(
\ 'g:deoplete#complete_method', 'complete')
call deoplete#util#set_default(
\ 'g:deoplete#max_processes', 4)

call deoplete#util#set_default(
\ 'g:deoplete#keyword_patterns', {})
Expand Down Expand Up @@ -221,6 +231,10 @@ function! deoplete#init#_context(event, sources) abort

return {
\ 'changedtick': b:changedtick,
\ 'serveraddr': (has('nvim') ?
\ v:servername : neovim_rpc#serveraddr()),
\ 'python3': get(g:, 'python3_host_prog', 'python3'),
\ 'dp_main': s:dp_main,
\ 'event': event,
\ 'input': input,
\ 'is_windows': ((has('win32') || has('win64')) ? v:true : v:false),
Expand Down
5 changes: 5 additions & 0 deletions autoload/deoplete/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ function! deoplete#util#rpcnotify(event, context) abort
return ''
endif
call s:notify(a:event, a:context)
if has('nvim') && a:event ==# 'deoplete_on_event' && a:context['event'] ==# 'VimLeavePre'
while !exists('g:deoplete#_process_stopped')
sleep 50m
endwhile
endif
return ''
endfunction

Expand Down
20 changes: 14 additions & 6 deletions doc/deoplete.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ g:deoplete#max_list

Default value: 100

*g:deoplete#max_processes*
g:deoplete#max_processes
The max number of processes used for the asynchronous
completion.
If it is less than equal 1, this feature is disabled.

Default value: 4

*g:deoplete#max_abbr_width*
g:deoplete#max_abbr_width
If the candidate abbr length exceeds the length it will be cut
Expand Down Expand Up @@ -222,7 +230,7 @@ g:deoplete#auto_complete_delay
g:deoplete#auto_refresh_delay
Delay the refresh when asynchronous.

Default value: 500
Default value: 50

*g:deoplete#skip_chars*
g:deoplete#skip_chars
Expand Down Expand Up @@ -1281,9 +1289,9 @@ phpcd.vim: another PHP omnifunc. Faster.
https://github.com/php-vim/phpcd.vim

==============================================================================
FREQUENTLY ASKED QUESTIONS (FAQ) *deoplete-faq*
FREQUENTLY ASKED QUESTIONS (FAQ) *deoplete-faq*

*deoplete-faq-trouble*
*deoplete-faq-trouble*
1. Troubleshooting~

Q: deoplete does not work.
Expand Down Expand Up @@ -1370,7 +1378,7 @@ A: Please enable logging feature like this. >
call deoplete#enable_logging('DEBUG', 'deoplete.log')
call deoplete#custom#source('jedi', 'is_debug_enabled', 1)
<
*deoplete-faq-config*
*deoplete-faq-config*
2. Configuration~

Q: I want to silence the |ins-completion-menu| messages in the command line
Expand Down Expand Up @@ -1515,7 +1523,7 @@ Q: What does each part of a line on the pop up mean? For example I see:
A: It is the source mark. [~] is from around source. A is from
|deoplete-source-around|.

*deoplete-faq-ft-specific*
*deoplete-faq-ft-specific*
3. Filetype Specific Questions~

Q: I want to disable the auto completion for certain filetypes.
Expand Down Expand Up @@ -1579,7 +1587,7 @@ Q: I want to complete AAA using deoplete.

A: You can create the source for it. Why don't create the source if you need?

*deoplete-faq-general*
*deoplete-faq-general*
4. General Questions~

Q: How to donate money to you?
Expand Down
4 changes: 2 additions & 2 deletions rplugin/python3/deoplete/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def init_channel(self, args):
self._deoplete = Deoplete(self._vim)

@neovim.rpc_export('deoplete_enable_logging')
def enable_logging(self):
def enable_logging(self, context):
self._deoplete.enable_logging()

@neovim.rpc_export('deoplete_auto_completion_begin')
Expand All @@ -51,7 +51,7 @@ def on_event(self, context):
def deoplete_init():
pass

def deoplete_enable_logging():
def deoplete_enable_logging(context):
global_deoplete.enable_logging()

def deoplete_auto_completion_begin(context):
Expand Down
Loading