summaryrefslogtreecommitdiff
path: root/cli/lsp
diff options
context:
space:
mode:
authorBartek Iwańczuk <biwanczuk@gmail.com>2024-10-16 20:05:47 +0100
committerGitHub <noreply@github.com>2024-10-16 19:05:47 +0000
commit1fd8d092eafc168af779040e93129d14e5a7187d (patch)
tree51f8e7310dd94059cf4a4284a24be22965ab7a70 /cli/lsp
parentf7dba52133904a9e4ca0468e2c98894992ea2e42 (diff)
Revert "feat(lsp): "deno/didRefreshDenoConfigurationTree" notificatio… (#26320)
…ns (#26215)" This reverts commit 06778e4e9b0a856ac39cc01f0813e6076eb150d6 because benchmarks are failing on `main`.
Diffstat (limited to 'cli/lsp')
-rw-r--r--cli/lsp/capabilities.rs4
-rw-r--r--cli/lsp/client.rs35
-rw-r--r--cli/lsp/config.rs48
-rw-r--r--cli/lsp/language_server.rs5
-rw-r--r--cli/lsp/lsp_custom.rs30
5 files changed, 8 insertions, 114 deletions
diff --git a/cli/lsp/capabilities.rs b/cli/lsp/capabilities.rs
index 5cdb1224d..e93d3b7c2 100644
--- a/cli/lsp/capabilities.rs
+++ b/cli/lsp/capabilities.rs
@@ -147,11 +147,11 @@ pub fn server_capabilities(
moniker_provider: None,
experimental: Some(json!({
"denoConfigTasks": true,
- "testingApi": true,
- "didRefreshDenoConfigurationTreeNotifications": true,
+ "testingApi":true,
})),
inlay_hint_provider: Some(OneOf::Left(true)),
position_encoding: None,
+ // TODO(nayeemrmn): Support pull-based diagnostics.
diagnostic_provider: None,
inline_value_provider: None,
inline_completion_provider: None,
diff --git a/cli/lsp/client.rs b/cli/lsp/client.rs
index 65865d5b3..b3f0d64fa 100644
--- a/cli/lsp/client.rs
+++ b/cli/lsp/client.rs
@@ -92,19 +92,6 @@ impl Client {
});
}
- pub fn send_did_refresh_deno_configuration_tree_notification(
- &self,
- params: lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams,
- ) {
- // do on a task in case the caller currently is in the lsp lock
- let client = self.0.clone();
- spawn(async move {
- client
- .send_did_refresh_deno_configuration_tree_notification(params)
- .await;
- });
- }
-
pub fn send_did_change_deno_configuration_notification(
&self,
params: lsp_custom::DidChangeDenoConfigurationNotificationParams,
@@ -182,10 +169,6 @@ trait ClientTrait: Send + Sync {
params: lsp_custom::DiagnosticBatchNotificationParams,
);
async fn send_test_notification(&self, params: TestingNotification);
- async fn send_did_refresh_deno_configuration_tree_notification(
- &self,
- params: lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams,
- );
async fn send_did_change_deno_configuration_notification(
&self,
params: lsp_custom::DidChangeDenoConfigurationNotificationParams,
@@ -266,18 +249,6 @@ impl ClientTrait for TowerClient {
}
}
- async fn send_did_refresh_deno_configuration_tree_notification(
- &self,
- params: lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams,
- ) {
- self
- .0
- .send_notification::<lsp_custom::DidRefreshDenoConfigurationTreeNotification>(
- params,
- )
- .await
- }
-
async fn send_did_change_deno_configuration_notification(
&self,
params: lsp_custom::DidChangeDenoConfigurationNotificationParams,
@@ -395,12 +366,6 @@ impl ClientTrait for ReplClient {
async fn send_test_notification(&self, _params: TestingNotification) {}
- async fn send_did_refresh_deno_configuration_tree_notification(
- &self,
- _params: lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams,
- ) {
- }
-
async fn send_did_change_deno_configuration_notification(
&self,
_params: lsp_custom::DidChangeDenoConfigurationNotificationParams,
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs
index 74f3583d6..07fdd3c65 100644
--- a/cli/lsp/config.rs
+++ b/cli/lsp/config.rs
@@ -50,8 +50,6 @@ use std::sync::Arc;
use tower_lsp::lsp_types as lsp;
use super::logging::lsp_log;
-use super::lsp_custom;
-use super::urls::url_to_uri;
use crate::args::discover_npmrc_from_workspace;
use crate::args::has_flag_env_var;
use crate::args::CliLockfile;
@@ -1718,14 +1716,14 @@ impl ConfigTree {
.unwrap_or_else(|| Arc::new(FmtConfig::new_with_base(PathBuf::from("/"))))
}
- /// Returns (scope_url, type).
+ /// Returns (scope_uri, type).
pub fn watched_file_type(
&self,
specifier: &ModuleSpecifier,
) -> Option<(&ModuleSpecifier, ConfigWatchedFileType)> {
- for (scope_url, data) in self.scopes.iter() {
+ for (scope_uri, data) in self.scopes.iter() {
if let Some(typ) = data.watched_files.get(specifier) {
- return Some((scope_url, *typ));
+ return Some((scope_uri, *typ));
}
}
None
@@ -1749,46 +1747,6 @@ impl ConfigTree {
.any(|data| data.watched_files.contains_key(specifier))
}
- pub fn to_did_refresh_params(
- &self,
- ) -> lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams {
- let data = self
- .scopes
- .values()
- .filter_map(|data| {
- let workspace_root_scope_uri =
- Some(data.member_dir.workspace.root_dir())
- .filter(|s| *s != data.member_dir.dir_url())
- .and_then(|s| url_to_uri(s).ok());
- Some(lsp_custom::DenoConfigurationData {
- scope_uri: url_to_uri(&data.scope).ok()?,
- deno_json: data.maybe_deno_json().and_then(|c| {
- if workspace_root_scope_uri.is_some()
- && Some(&c.specifier)
- == data
- .member_dir
- .workspace
- .root_deno_json()
- .map(|c| &c.specifier)
- {
- return None;
- }
- Some(lsp::TextDocumentIdentifier {
- uri: url_to_uri(&c.specifier).ok()?,
- })
- }),
- package_json: data.maybe_pkg_json().and_then(|p| {
- Some(lsp::TextDocumentIdentifier {
- uri: url_to_uri(&p.specifier()).ok()?,
- })
- }),
- workspace_root_scope_uri,
- })
- })
- .collect();
- lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams { data }
- }
-
pub async fn refresh(
&mut self,
settings: &Settings,
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs
index 908afa165..8269dc851 100644
--- a/cli/lsp/language_server.rs
+++ b/cli/lsp/language_server.rs
@@ -963,11 +963,6 @@ impl Inner {
.tree
.refresh(&self.config.settings, &self.workspace_files, &file_fetcher)
.await;
- self
- .client
- .send_did_refresh_deno_configuration_tree_notification(
- self.config.tree.to_did_refresh_params(),
- );
for config_file in self.config.tree.config_files() {
(|| {
let compiler_options = config_file.to_compiler_options().ok()?.options;
diff --git a/cli/lsp/lsp_custom.rs b/cli/lsp/lsp_custom.rs
index b570b6d0e..5f485db7a 100644
--- a/cli/lsp/lsp_custom.rs
+++ b/cli/lsp/lsp_custom.rs
@@ -46,30 +46,6 @@ pub struct DiagnosticBatchNotificationParams {
pub messages_len: usize,
}
-#[derive(Debug, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DenoConfigurationData {
- pub scope_uri: lsp::Uri,
- pub workspace_root_scope_uri: Option<lsp::Uri>,
- pub deno_json: Option<lsp::TextDocumentIdentifier>,
- pub package_json: Option<lsp::TextDocumentIdentifier>,
-}
-
-#[derive(Debug, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DidRefreshDenoConfigurationTreeNotificationParams {
- pub data: Vec<DenoConfigurationData>,
-}
-
-pub enum DidRefreshDenoConfigurationTreeNotification {}
-
-impl lsp::notification::Notification
- for DidRefreshDenoConfigurationTreeNotification
-{
- type Params = DidRefreshDenoConfigurationTreeNotificationParams;
- const METHOD: &'static str = "deno/didRefreshDenoConfigurationTree";
-}
-
#[derive(Debug, Eq, Hash, PartialEq, Copy, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum DenoConfigurationChangeType {
@@ -112,15 +88,13 @@ pub struct DidChangeDenoConfigurationNotificationParams {
pub changes: Vec<DenoConfigurationChangeEvent>,
}
-// TODO(nayeemrmn): This is being replaced by
-// `DidRefreshDenoConfigurationTreeNotification` for Deno > v2.0.0. Remove it
-// soon.
pub enum DidChangeDenoConfigurationNotification {}
impl lsp::notification::Notification
for DidChangeDenoConfigurationNotification
{
type Params = DidChangeDenoConfigurationNotificationParams;
+
const METHOD: &'static str = "deno/didChangeDenoConfiguration";
}
@@ -128,6 +102,7 @@ pub enum DidUpgradeCheckNotification {}
impl lsp::notification::Notification for DidUpgradeCheckNotification {
type Params = DidUpgradeCheckNotificationParams;
+
const METHOD: &'static str = "deno/didUpgradeCheck";
}
@@ -150,5 +125,6 @@ pub enum DiagnosticBatchNotification {}
impl lsp::notification::Notification for DiagnosticBatchNotification {
type Params = DiagnosticBatchNotificationParams;
+
const METHOD: &'static str = "deno/internalTestDiagnosticBatch";
}