def check_word(): """ Check the current word and try to push a help message and a completion """ line = lisp.buffer_substring(lisp.line_beginning_position(),lisp.point()) lines= lisp.buffer_substring(1,lisp.point()).splitlines() lines.reverse() d = find_completion(line,lines) if d[0]: f,completions,target = d #lisp.message("Found %d completions\n%s"%(len(completions),curType)) help_str = make_help_message(completions) # make sure we're probably running X: if lisp.window_system() is not None and \ lisp.pos_tip_show is not None: # make sure extension is installed lisp.pos_tip_show(help_str,None,None,None,0) else: lisp.message(help_str) # just use the emacs mini-buffer if len(completions)==1:#if there's only one completion, just insert it d = completions[0].data['name'][len(target):] if len(d):lisp.insert(d) else: lisp.message(d[1])
def complete_type(): """ UI attempt to grab completions for a class """ c = lisp.completing_read("Type to complete:",cpp.CppObject.classes) lisp.message("Looking for:"+str(c)) try: t = cpp.CppObject.getByName(c) completions = t.getChildrenByWeakName("") lisp.pos_tip_show(make_help_message(completions),None,None,None,0) except: lisp.message("Couldn't find class "+c)