summaryrefslogtreecommitdiff
path: root/cli/lsp/client.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-04-01 12:02:44 -0400
committerGitHub <noreply@github.com>2023-04-01 12:02:44 -0400
commitbac8e4f6f25367cf5b6c2095249cf144035a4fbd (patch)
tree75f4c3f2174d1481d95942fd8200bc4fb8475b18 /cli/lsp/client.rs
parentae1ba2af3c0dc45de074285f0e0a8440cf2895ec (diff)
fix(repl): disable language server document preloading in the repl (#18543)
This was an oversight because the repl uses the language server under the hood. Also, never preloads from a root directory. Part of #18538
Diffstat (limited to 'cli/lsp/client.rs')
-rw-r--r--cli/lsp/client.rs20
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,