pub struct LspClientRegistry { /* private fields */ }Expand description
LSP 客户端注册表
Implementations§
Source§impl LspClientRegistry
impl LspClientRegistry
Sourcepub async fn register(
&self,
config: &LspServerConfig,
project_root: &Path,
) -> Result<()>
pub async fn register( &self, config: &LspServerConfig, project_root: &Path, ) -> Result<()>
启动并注册 LSP 客户端
Sourcepub async fn register_with_progress(
&self,
config: &LspServerConfig,
project_root: &Path,
progress_callback: Arc<dyn LspProgressCallback>,
) -> Result<()>
pub async fn register_with_progress( &self, config: &LspServerConfig, project_root: &Path, progress_callback: Arc<dyn LspProgressCallback>, ) -> Result<()>
启动并注册 LSP 客户端(带进度回调)
使用异步初始化 + 进度回调,适合 TUI 环境显示进度条。
§Arguments
config: LSP 服务器配置project_root: 项目根目录progress_callback: 进度回调(可以使用NoOpProgressCallback如果不需要进度显示)
§Progress Flow
- 0.1: Starting process…
- 0.3: Process started, initializing server…
- 0.5-0.9: Loading workspace…
- 1.0: Ready
§Timeouts
- 进程启动:5 秒(快速失败)
- 服务器初始化:60 秒(大型项目可能需要)
Sourcepub async fn get_client_or_wait(&self, language: &str) -> Result<Arc<LspClient>>
pub async fn get_client_or_wait(&self, language: &str) -> Result<Arc<LspClient>>
获取指定语言的客户端,等待启动完成(最多 30 秒)
Sourcepub async fn has_active_clients(&self) -> bool
pub async fn has_active_clients(&self) -> bool
是否有活跃客户端
Sourcepub async fn active_languages(&self) -> Vec<String>
pub async fn active_languages(&self) -> Vec<String>
获取所有活跃语言
Sourcepub async fn shutdown_all(&self) -> Result<()>
pub async fn shutdown_all(&self) -> Result<()>
关闭所有客户端
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LspClientRegistry
impl !UnwindSafe for LspClientRegistry
impl Freeze for LspClientRegistry
impl Send for LspClientRegistry
impl Sync for LspClientRegistry
impl Unpin for LspClientRegistry
impl UnsafeUnpin for LspClientRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more