MCPcopy Create free account
hub / github.com/GCWing/BitFun / load_all_plugins

Method load_all_plugins

src/crates/services/services-core/src/lsp/plugin_loader.rs:56–94  ·  view source on GitHub ↗

Loads all installed plugins.

(&self)

Source from the content-addressed store, hash-verified

54
55 /// Loads all installed plugins.
56 pub async fn load_all_plugins(&self) -> Result<Vec<LspPlugin>> {
57 if !self.plugins_dir.exists() {
58 fs::create_dir_all(&self.plugins_dir).await?;
59 info!("Created plugins directory: {:?}", self.plugins_dir);
60 return Ok(vec![]);
61 }
62
63 let mut plugins = Vec::new();
64 let mut entries = fs::read_dir(&self.plugins_dir).await?;
65
66 while let Some(entry) = entries.next_entry().await? {
67 let path = entry.path();
68
69 if path.is_dir() {
70 if let Some(plugin_id) = path.file_name().and_then(|n| n.to_str()) {
71 if plugin_id.starts_with('.') {
72 continue;
73 }
74
75 if plugin_id == "temp" || plugin_id == "cache" || plugin_id == "backup" {
76 continue;
77 }
78
79 match self.load_plugin(plugin_id).await {
80 Ok(plugin) => {
81 plugins.push(plugin);
82 }
83 Err(e) => {
84 error!("Failed to load plugin '{}': {}", plugin_id, e);
85 }
86 }
87 }
88 }
89 }
90
91 info!("Successfully loaded {} plugin(s)", plugins.len());
92
93 Ok(plugins)
94 }
95
96 /// Installs a plugin package (a `.vcpkg` file).
97 pub async fn install_plugin_package(&self, package_path: &Path) -> Result<String> {

Callers 1

initializeMethod · 0.80

Calls 6

create_dir_allFunction · 0.85
load_pluginMethod · 0.80
existsMethod · 0.45
pathMethod · 0.45
is_dirMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected