[Lldb-commits] [lldb] [lldb] Add completions for plugin list/enable/disable (PR #147775)
David Peixotto via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 10 10:25:46 PDT 2025
================
@@ -2473,3 +2474,35 @@ bool PluginManager::SetUnwindAssemblyPluginEnabled(llvm::StringRef name,
bool enable) {
return GetUnwindAssemblyInstances().SetInstanceEnabled(name, enable);
}
+
+void PluginManager::AutoCompletePluginName(llvm::StringRef name,
+ CompletionRequest &request) {
+ // Split the name into the namespace and the plugin name.
+ // If there is no dot then the ns_name will be equal to name and
+ // plugin_prefix will be empty.
+ llvm::StringRef ns_name, plugin_prefix;
+ std::tie(ns_name, plugin_prefix) = name.split('.');
+
+ for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
+ // If the plugin namespace matches exactly then
+ // add all the plugins in this namespace as completions if the
+ // plugin names starts with the plugin_prefix. If the plugin_prefix
+ // is empty then it will match all the plugins (empty string is a
+ // prefix of everything).
+ if (plugin_ns.name == ns_name) {
+ for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
+ llvm::SmallString<128> buf;
+ if (plugin.name.starts_with(plugin_prefix))
+ request.AddCompletion(
+ (plugin_ns.name + "." + plugin.name).toStringRef(buf));
+ }
+ }
+ // Otherwise check if the namespace is a prefix of the full name.
+ // Use a partial completion here so that we can either operate on the full
+ // namespace or tab-complete to the next level.
+ else if (plugin_ns.name.starts_with(name) &&
+ !plugin_ns.get_info().empty()) {
----------------
dmpots wrote:
Moved it inside the else as suggested.
https://github.com/llvm/llvm-project/pull/147775
More information about the lldb-commits
mailing list