def on_query_completions(self, view, prefix, operand): completions = [] name_of_source = None if not is_robot_language_file(view.file_name(), settings.associated_file_extensions): return completions, sublime.INHIBIT_EXPLICIT_COMPLETIONS # ignore 'prefix' argument, instead get text under cursor using custom method text_under_cursor = get_text_under_cursor(view) if not text_under_cursor: return completions, sublime.INHIBIT_EXPLICIT_COMPLETIONS result = re.split('\.', text_under_cursor, maxsplit=1) if len(result) == 2: name_of_source = result[0] text_under_cursor = result[1] completions = self.autocomplete_owner.get_autocomplete_list( text_under_cursor, name_of_source=name_of_source) completions_dynamic = self.autocomplete_dynamic_owner.get_autocomplete_list( text_under_cursor) completions.extend(completions_dynamic) # The event listeners works for every file in scope(for all opened .txt and .robot files) # in a separate thread, thus result may have duplicates. # Clean it. completions = list(set(completions)) completions.sort() return completions, sublime.INHIBIT_EXPLICIT_COMPLETIONS
def on_query_completions(self, view, prefix, operand): completions = [] name_of_source = None if not is_robot_language_file(view.file_name(), settings.associated_file_extensions): return completions, sublime.INHIBIT_EXPLICIT_COMPLETIONS # ignore 'prefix' argument, instead get text under cursor using custom method text_under_cursor = get_text_under_cursor(view) if not text_under_cursor: return completions, sublime.INHIBIT_EXPLICIT_COMPLETIONS result = re.split('\.', text_under_cursor, maxsplit=1) if len(result) == 2: name_of_source = result[0] text_under_cursor = result[1] completions = self.autocomplete_owner.get_autocomplete_list(text_under_cursor, name_of_source=name_of_source) completions_dynamic = self.autocomplete_dynamic_owner.get_autocomplete_list( text_under_cursor) completions.extend(completions_dynamic) # The event listeners works for every file in scope(for all opened .txt and .robot files) # in a separate thread, thus result may have duplicates. # Clean it. completions = list(set(completions)) completions.sort() return completions, sublime.INHIBIT_EXPLICIT_COMPLETIONS
def run(self, edit): if not is_robot_format(self.view): return name_of_source = None text_under_cursor = get_text_under_cursor(self.view) result = re.split('\.', text_under_cursor, maxsplit=1) if len(result) == 2: name_of_source = result[0] text_under_cursor = result[1] if not text_under_cursor: return self.go_to_item_thread(text_under_cursor, name_of_source=name_of_source)