summaryrefslogtreecommitdiff
path: root/cli/lsp/lsp_custom.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2024-01-17 20:22:28 +0000
committerGitHub <noreply@github.com>2024-01-17 20:22:28 +0000
commit2141543105dd9aabc0aca0534abc837f114e5bac (patch)
treee610510204beea26afa2d12178191ec78fcf151d /cli/lsp/lsp_custom.rs
parent7662b056231b6ffa3106be795b9f19ab409543ab (diff)
feat(lsp): send "deno/didChangeDenoConfiguration" on init (#21965)
Diffstat (limited to 'cli/lsp/lsp_custom.rs')
-rw-r--r--cli/lsp/lsp_custom.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/cli/lsp/lsp_custom.rs b/cli/lsp/lsp_custom.rs
index 7abe56125..63f50d39f 100644
--- a/cli/lsp/lsp_custom.rs
+++ b/cli/lsp/lsp_custom.rs
@@ -62,6 +62,25 @@ pub struct DiagnosticBatchNotificationParams {
#[derive(Debug, Eq, Hash, PartialEq, Copy, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
+pub enum DenoConfigurationChangeType {
+ Added,
+ Changed,
+ Removed,
+}
+
+impl DenoConfigurationChangeType {
+ pub fn from_file_change_type(file_event: lsp::FileChangeType) -> Self {
+ match file_event {
+ lsp::FileChangeType::CREATED => Self::Added,
+ lsp::FileChangeType::CHANGED => Self::Changed,
+ lsp::FileChangeType::DELETED => Self::Removed,
+ _ => Self::Changed, // non-exhaustable enum
+ }
+ }
+}
+
+#[derive(Debug, Eq, Hash, PartialEq, Copy, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
pub enum DenoConfigurationType {
DenoJson,
PackageJson,
@@ -70,8 +89,9 @@ pub enum DenoConfigurationType {
#[derive(Debug, Eq, Hash, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DenoConfigurationChangeEvent {
- #[serde(flatten)]
- pub file_event: lsp::FileEvent,
+ pub uri: lsp::Url,
+ #[serde(rename = "type")]
+ pub typ: DenoConfigurationChangeType,
pub configuration_type: DenoConfigurationType,
}