def menu_items(self): # self.menu_data comes in the way of [datum, mod, alias, # secondary_datum, type_datum], where (mod, alias, secondary_datum) # and type_datum are mutually exclusive. datum, mod, alias, crate, urls, typ = self.menu_data menu = [] if mod: if 'file_name' in mod: menu.append(jump_to_target_from_decl(jump_to_alias_definition_menu_item, self.tree, mod)) if crate: # Add references to extern mods via aliases (known local crates) menu.append(jump_to_crate_menu_item(self.tree, crate['file_name'], 1)) menu.append(find_references_menu_item(self.tree, alias['qualname'], "module-alias-ref", "alias")) if urls: # Add references to extern mods via aliases (standard library crates) menu = [find_references_menu_item(self.tree, alias['qualname'], "module-alias-ref", "alias")] menu.extend(std_lib_links_menu(urls)) elif alias and 'location' in alias: # Add references to extern mods via aliases (unknown local crates) menu = [find_references_menu_item(self.tree, alias['qualname'], "module-alias-ref", "alias")] elif 'file_name' in mod: menu.insert(0, jump_to_target_from_decl(jump_to_module_definition_menu_item, self.tree, mod)) else: if 'file_name' in mod and 'def_file' in mod and mod['def_file'] == mod['file_name']: menu.insert(0, jump_to_target_from_decl(jump_to_definition_menu_item, self.tree, mod)) else: menu.insert(0, jump_to_target_from_decl(jump_to_module_declaration_menu_item, self.tree, mod)) menu.insert(0, jump_to_module_definition_menu_item(self.tree, mod['def_file'], 1)) menu.extend(generic_module_menu(mod, self.tree)) elif typ: menu = [jump_to_target_from_decl(jump_to_definition_menu_item, self.tree, typ)] menu.extend(generic_type_menu(typ, self.tree)) return menu
def menu_items(self): menu = [] if self.menu_data['def_file'] != self.menu_data['file_name']: menu.append( jump_to_module_definition_menu_item(self.tree, self.menu_data['def_file'], 1)) menu.extend(generic_module_menu(self.menu_data, self.tree)) return menu
def menu_items(self): # self.menu_data comes in the way of [datum, mod, alias, # secondary_datum, type_datum], where (mod, alias, secondary_datum) # and type_datum are mutually exclusive. datum, mod, alias, crate, urls, typ = self.menu_data menu = [] if mod: if 'file_name' in mod: menu.append( jump_to_target_from_decl( jump_to_alias_definition_menu_item, self.tree, mod)) if crate: # Add references to extern mods via aliases (known local crates) menu.append( jump_to_crate_menu_item(self.tree, crate['file_name'], 1)) menu.append( find_references_menu_item(self.tree, alias['qualname'], "module-alias-ref", "alias")) if urls: # Add references to extern mods via aliases (standard library crates) menu = [ find_references_menu_item(self.tree, alias['qualname'], "module-alias-ref", "alias") ] menu.extend(std_lib_links_menu(urls)) elif alias and 'location' in alias: # Add references to extern mods via aliases (unknown local crates) menu = [ find_references_menu_item(self.tree, alias['qualname'], "module-alias-ref", "alias") ] elif 'file_name' in mod: menu.insert( 0, jump_to_target_from_decl( jump_to_module_definition_menu_item, self.tree, mod)) else: if 'file_name' in mod and 'def_file' in mod and mod[ 'def_file'] == mod['file_name']: menu.insert( 0, jump_to_target_from_decl(jump_to_definition_menu_item, self.tree, mod)) else: menu.insert( 0, jump_to_target_from_decl( jump_to_module_declaration_menu_item, self.tree, mod)) menu.insert( 0, jump_to_module_definition_menu_item( self.tree, mod['def_file'], 1)) menu.extend(generic_module_menu(mod, self.tree)) elif typ: menu = [ jump_to_target_from_decl(jump_to_definition_menu_item, self.tree, typ) ] menu.extend(generic_type_menu(typ, self.tree)) return menu
def menu_items(self): menu = [] if self.menu_data['def_file'] != self.menu_data['file_name']: menu.append(jump_to_module_definition_menu_item(self.tree, self.menu_data['def_file'], 1)) menu.extend(generic_module_menu(self.menu_data, self.tree)) return menu