File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
autoload/deoplete/sources
rplugin/python3/deoplete/sources Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ options.
5151| ` g:deoplete#sources#padawan#log_file ` | ` /tmp/padawan-server.log ` |
5252| ` g:deoplete#sources#padawan#server_autostart ` | ` 1 ` |
5353| ` g:deoplete#sources#padawan#add_parentheses ` | ` 0 ` |
54+ | ` g:deoplete#sources#padawan#auto_update ` | ` 0 ` |
5455
5556- ` g:deoplete#sources#padawan#server_addr `
5657
@@ -77,6 +78,9 @@ Any value but `1` will make this option disabled.
7778If set to ` 1 ` parentheses will be added to function (method) completion. If function
7879accepts parameters, only opening parenthesis will be added.
7980
81+ - ` g:deoplete#sources#padawan#auto_update `
82+ If set to ` 1 ` send ` update ` command to server automatically when ` BufWritePost ` event is triggered.
83+
8084## Additional commands
8185
8286By 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 =
1919 \ get (g: , ' deoplete#sources#padawan#server_autostart' , 1 )
2020let g: deoplete #sources#padawan#add_parentheses =
2121 \ 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 )
2324
2425python3 << PYTHON
2526import vim
Original file line number Diff line number Diff line change @@ -41,10 +41,21 @@ def on_init(self, context):
4141 'deoplete#sources#padawan#log_file' )
4242 self .add_parentheses = self .vim .eval (
4343 'deoplete#sources#padawan#add_parentheses' )
44+ self .auto_update = self .vim .eval (
45+ 'deoplete#sources#padawan#auto_update' )
4446
4547 self .server = padawan_server .Server (server_addr , server_command ,
4648 log_file )
4749
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+
4859 def get_complete_position (self , context ):
4960 patterns = [r'[\'"][^\)]*$' , r'[\w\\]*$' ]
5061 input = context ['input' ]
You can’t perform that action at this time.
0 commit comments