Loads all installed plugins.
(&self)
| 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> { |
no test coverage detected