Ticket #148: pidacomplete.patch
| File pidacomplete.patch, 2.2 KB (added by ali, 17 months ago) |
|---|
-
pida/utils/vim/vimcom.py
680 680 681 681 def set_path(self, server, path): 682 682 self.send_ex(server, 'cd %s' % path) 683 684 def add_completion(self, server, s): 685 self.send_expr(server, 'complete_add("%s")' % s, lambda *a: None) 686 687 def finish_completion(self, server): 688 self.send_ex(server, 'call Pida_Stop_Completing()') 683 689 684 690 def cb_notify(self, *a): 685 691 win, ev = a … … 768 774 :silent au pida CursorMovedI * silent call Async_event(v:servername.":cursor_move,".line('.')) 769 775 :silent au pida CursorMoved * silent call Async_event(v:servername.":cursor_move,".line('.')) 770 776 777 :silent function! Pida_Complete(findstart, base) 778 " locate the start of the word 779 let line = getline('.') 780 let start = col('.') - 1 781 while start > 0 && line[start - 1] =~ '\a' 782 let start -= 1 783 endwhile 784 if a:findstart 785 let g:completing = 1 786 return start 787 else 788 call Async_event(v:servername.":complete".a:findstart."".a:base."".line."".start) 789 let completion_time = 0 790 while g:completing && completion_time < 1000 791 echo g:completing 792 sleep 100m 793 let completion_time = completion_time + 100 794 endwhile 795 endif 796 :endfunction 797 798 :silent function! Pida_Stop_Completing() 799 let g:completing = 0 800 :endfunction 801 set completefunc=Pida_Complete 771 802 ''' 772 803 -
pida/editors/vim/vim.py
87 87 if server == self.svc.server: 88 88 self.svc.boss.stop(force=True) 89 89 90 def vim_complete(self, server, findstart, base, line, start): 91 print server, findstart, base, line, start 92 self.svc._com.add_completion(server, 'banana') 93 self.svc._com.add_completion(server, 'banana2') 94 self.svc._com.add_completion(server, 'banana3') 90 95 96 91 97 # Service class 92 98 class Vim(EditorService): 93 99 """Describe your Service Here"""
