summaryrefslogtreecommitdiff
path: root/cli/lsp/lsp_custom.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-10-12 16:07:27 +0100
committerGitHub <noreply@github.com>2023-10-12 16:07:27 +0100
commit5dd010a4fbeb0602891ea537b98216b8ad7d27a7 (patch)
tree00686cddbe5de68262b9c4348e02df0c86bf8fc3 /cli/lsp/lsp_custom.rs
parenteaeb10cee123b8184148c957151be226fb865bd2 (diff)
feat(lsp): send "deno/didChangeDenoConfiguration" notifications (#20827)
Diffstat (limited to 'cli/lsp/lsp_custom.rs')
-rw-r--r--cli/lsp/lsp_custom.rs43
1 files changed, 42 insertions, 1 deletions
diff --git a/cli/lsp/lsp_custom.rs b/cli/lsp/lsp_custom.rs
index d9dbae8a4..685da6b14 100644
--- a/cli/lsp/lsp_custom.rs
+++ b/cli/lsp/lsp_custom.rs
@@ -6,7 +6,7 @@ use tower_lsp::lsp_types as lsp;
pub const CACHE_REQUEST: &str = "deno/cache";
pub const PERFORMANCE_REQUEST: &str = "deno/performance";
-pub const TASK_REQUEST: &str = "deno/task";
+pub const TASK_REQUEST: &str = "deno/taskDefinitions";
pub const RELOAD_IMPORT_REGISTRIES_REQUEST: &str =
"deno/reloadImportRegistries";
pub const VIRTUAL_TEXT_DOCUMENT: &str = "deno/virtualTextDocument";
@@ -25,6 +25,16 @@ pub struct CacheParams {
}
#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TaskDefinition {
+ pub name: String,
+ // TODO(nayeemrmn): Rename this to `command` in vscode_deno.
+ #[serde(rename = "detail")]
+ pub command: String,
+ pub source_uri: lsp::Url,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
pub struct RegistryStateNotificationParams {
pub origin: String,
pub suggestions: bool,
@@ -50,6 +60,37 @@ pub struct DiagnosticBatchNotificationParams {
pub messages_len: usize,
}
+#[derive(Debug, Eq, Hash, PartialEq, Copy, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub enum DenoConfigurationType {
+ DenoJson,
+ PackageJson,
+}
+
+#[derive(Debug, Eq, Hash, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DenoConfigurationChangeEvent {
+ #[serde(flatten)]
+ pub file_event: lsp::FileEvent,
+ pub configuration_type: DenoConfigurationType,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DidChangeDenoConfigurationNotificationParams {
+ pub changes: Vec<DenoConfigurationChangeEvent>,
+}
+
+pub enum DidChangeDenoConfigurationNotification {}
+
+impl lsp::notification::Notification
+ for DidChangeDenoConfigurationNotification
+{
+ type Params = DidChangeDenoConfigurationNotificationParams;
+
+ const METHOD: &'static str = "deno/didChangeDenoConfiguration";
+}
+
/// This notification is only sent for testing purposes
/// in order to know what the latest diagnostics are.
pub enum DiagnosticBatchNotification {}