File tree 3 files changed +17
-1
lines changed
autoload/deoplete/sources
rplugin/python3/deoplete/sources
3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ options.
51
51
| ` g:deoplete#sources#padawan#log_file ` | ` /tmp/padawan-server.log ` |
52
52
| ` g:deoplete#sources#padawan#server_autostart ` | ` 1 ` |
53
53
| ` g:deoplete#sources#padawan#add_parentheses ` | ` 0 ` |
54
+ | ` g:deoplete#sources#padawan#auto_update ` | ` 0 ` |
54
55
55
56
- ` g:deoplete#sources#padawan#server_addr `
56
57
@@ -77,6 +78,9 @@ Any value but `1` will make this option disabled.
77
78
If set to ` 1 ` parentheses will be added to function (method) completion. If function
78
79
accepts parameters, only opening parenthesis will be added.
79
80
81
+ - ` g:deoplete#sources#padawan#auto_update `
82
+ If set to ` 1 ` send ` update ` command to server automatically when ` BufWritePost ` event is triggered.
83
+
80
84
## Additional commands
81
85
82
86
By default, the plugin is not creating any vim commands. However, there are some
Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ let g:deoplete#sources#padawan#server_autostart =
19
19
\ get (g: , ' deoplete#sources#padawan#server_autostart' , 1 )
20
20
let g: deoplete #sources#padawan#add_parentheses =
21
21
\ get (g: , ' deoplete#sources#padawan#add_parentheses' , 0 )
22
-
22
+ let g: deoplete #sources#padawan#auto_update =
23
+ \ get (g: , ' deoplete#sources#padawan#auto_update' , 0 )
23
24
24
25
python3 << PYTHON
25
26
import vim
Original file line number Diff line number Diff line change @@ -41,10 +41,21 @@ def on_init(self, context):
41
41
'deoplete#sources#padawan#log_file' )
42
42
self .add_parentheses = self .vim .eval (
43
43
'deoplete#sources#padawan#add_parentheses' )
44
+ self .auto_update = self .vim .eval (
45
+ 'deoplete#sources#padawan#auto_update' )
44
46
45
47
self .server = padawan_server .Server (server_addr , server_command ,
46
48
log_file )
47
49
50
+ def on_event (self , context ):
51
+ if (context ['event' ] == 'BufWritePost' and self .auto_update == 1 ):
52
+ file_path = self .current .buffer .name
53
+ current_path = self .get_project_root (file_path )
54
+ params = {
55
+ 'path' : current_path
56
+ }
57
+ self .do_request ('update' , params )
58
+
48
59
def get_complete_position (self , context ):
49
60
patterns = [r'[\'"][^\)]*$' , r'[\w\\]*$' ]
50
61
input = context ['input' ]
You can’t perform that action at this time.
0 commit comments