diff options
Diffstat (limited to 'cli/lsp/client.rs')
-rw-r--r-- | cli/lsp/client.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cli/lsp/client.rs b/cli/lsp/client.rs index d24d4c2a9..e684dc09f 100644 --- a/cli/lsp/client.rs +++ b/cli/lsp/client.rs @@ -26,6 +26,13 @@ pub enum TestingNotification { Progress(testing_lsp_custom::TestRunProgressParams), } +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub enum LspClientKind { + #[default] + CodeEditor, + Repl, +} + #[derive(Clone)] pub struct Client(Arc<dyn ClientTrait>); @@ -44,6 +51,10 @@ impl Client { Self(Arc::new(ReplClient)) } + pub fn kind(&self) -> LspClientKind { + self.0.kind() + } + /// Gets additional methods that should only be called outside /// the LSP's lock to prevent deadlocking scenarios. pub fn when_outside_lsp_lock(&self) -> OutsideLockClient { @@ -149,6 +160,7 @@ impl OutsideLockClient { #[async_trait] trait ClientTrait: Send + Sync { + fn kind(&self) -> LspClientKind; async fn publish_diagnostics( &self, uri: lsp::Url, @@ -177,6 +189,10 @@ struct TowerClient(tower_lsp::Client); #[async_trait] impl ClientTrait for TowerClient { + fn kind(&self) -> LspClientKind { + LspClientKind::CodeEditor + } + async fn publish_diagnostics( &self, uri: lsp::Url, @@ -296,6 +312,10 @@ struct ReplClient; #[async_trait] impl ClientTrait for ReplClient { + fn kind(&self) -> LspClientKind { + LspClientKind::Repl + } + async fn publish_diagnostics( &self, _uri: lsp::Url, |