Esempio n. 1
0
 def get_completions(self, document: Document,
                     complete_event: CompleteEvent) -> Completion:
     """ Get Completions
     This will function will provide the completions for param types and function name
     :param document:
     :param complete_event:
     :return:
     """
     word = document.get_word_before_cursor()
     if document.find_previous_word_ending() is None:
         for _command in safe_commands:
             # note: force lower() to function as ignore_case.
             if _command.startswith(word.lower()):
                 if _command in safe_commands_arguments:
                     safe_command = safe_commands_arguments[_command]
                     safe_argument_color = safe_color_arguments.get(
                         safe_command, 'default')
                     display = HTML('<b><ansired> &gt; </ansired>%s</b> <' +
                                    safe_argument_color + '>%s</' +
                                    safe_argument_color +
                                    '>') % (_command, safe_command)
                     yield Completion(_command,
                                      start_position=-len(word),
                                      display=display,
                                      display_meta=meta.get(_command))