@@ -1625,19 +1625,8 @@ def get_all_commands(self) -> List[str]:
16251625
16261626 def get_visible_commands (self ) -> List [str ]:
16271627 """Return a list of commands that have not been hidden or disabled"""
1628- commands = self .get_all_commands ()
1629-
1630- # Remove the hidden commands
1631- for name in self .hidden_commands :
1632- if name in commands :
1633- commands .remove (name )
1634-
1635- # Remove the disabled commands
1636- for name in self .disabled_commands :
1637- if name in commands :
1638- commands .remove (name )
1639-
1640- return commands
1628+ return [command for command in self .get_all_commands ()
1629+ if command not in self .hidden_commands and command not in self .disabled_commands ]
16411630
16421631 def _get_alias_completion_items (self ) -> List [CompletionItem ]:
16431632 """Return list of current alias names and values as CompletionItems"""
@@ -1659,9 +1648,13 @@ def _get_commands_aliases_and_macros_for_completion(self) -> List[str]:
16591648 return list (visible_commands | alias_names | macro_names )
16601649
16611650 def get_help_topics (self ) -> List [str ]:
1662- """ Returns a list of help topics """
1663- return [name [len (HELP_FUNC_PREFIX ):] for name in self .get_names ()
1664- if name .startswith (HELP_FUNC_PREFIX ) and callable (getattr (self , name ))]
1651+ """Return a list of help topics"""
1652+ all_topics = [name [len (HELP_FUNC_PREFIX ):] for name in self .get_names ()
1653+ if name .startswith (HELP_FUNC_PREFIX ) and callable (getattr (self , name ))]
1654+
1655+ # Filter out hidden and disabled commands
1656+ return [topic for topic in all_topics
1657+ if topic not in self .hidden_commands and topic not in self .disabled_commands ]
16651658
16661659 # noinspection PyUnusedLocal
16671660 def sigint_handler (self , signum : int , frame ) -> None :
0 commit comments