Skip to content

Commit df3eeea

Browse files
committed
Inline NotebookDocumentFilter variants.
1 parent 7962ea8 commit df3eeea

File tree

1 file changed

+31
-51
lines changed

1 file changed

+31
-51
lines changed

src/notebook.rs

+31-51
Original file line numberDiff line numberDiff line change
@@ -207,63 +207,43 @@ pub enum Notebook {
207207
NotebookDocumentFilter(NotebookDocumentFilter),
208208
}
209209

210-
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
211-
#[serde(untagged)]
212-
pub enum NotebookDocumentFilter {
213-
ByType(NotebookDocumentFilterByType),
214-
ByScheme(NotebookDocumentFilterByScheme),
215-
ByPattern(NotebookDocumentFilterByPattern),
216-
}
217-
218-
/// A notebook document filter denotes a notebook document by
219-
/// different properties.
220-
///
221-
/// @since 3.17.0
222-
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
223-
#[serde(rename_all = "camelCase")]
224-
pub struct NotebookDocumentFilterByType {
225-
/// The type of the enclosing notebook.
226-
pub notebook_type: String,
227-
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
228-
#[serde(skip_serializing_if = "Option::is_none")]
229-
pub scheme: Option<String>,
230-
/// A glob pattern.
231-
#[serde(skip_serializing_if = "Option::is_none")]
232-
pub pattern: Option<String>,
233-
}
234-
235210
/// A notebook document filter denotes a notebook document by
236211
/// different properties.
237212
///
238213
/// @since 3.17.0
239214
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
240215
#[serde(rename_all = "camelCase")]
241-
pub struct NotebookDocumentFilterByScheme {
242-
/// The type of the enclosing notebook.
243-
#[serde(skip_serializing_if = "Option::is_none")]
244-
pub notebook_type: Option<String>,
245-
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
246-
pub scheme: String,
247-
/// A glob pattern.
248-
#[serde(skip_serializing_if = "Option::is_none")]
249-
pub pattern: Option<String>,
250-
}
251-
252-
/// A notebook document filter denotes a notebook document by
253-
/// different properties.
254-
///
255-
/// @since 3.17.0
256-
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
257-
#[serde(rename_all = "camelCase")]
258-
pub struct NotebookDocumentFilterByPattern {
259-
/// The type of the enclosing notebook.
260-
#[serde(skip_serializing_if = "Option::is_none")]
261-
pub notebook_type: Option<String>,
262-
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
263-
#[serde(skip_serializing_if = "Option::is_none")]
264-
pub scheme: Option<String>,
265-
/// A glob pattern.
266-
pub pattern: String,
216+
pub enum NotebookDocumentFilter {
217+
ByType {
218+
/// The type of the enclosing notebook.
219+
notebook_type: String,
220+
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
221+
#[serde(skip_serializing_if = "Option::is_none")]
222+
scheme: Option<String>,
223+
/// A glob pattern.
224+
#[serde(skip_serializing_if = "Option::is_none")]
225+
pattern: Option<String>,
226+
},
227+
ByScheme {
228+
/// The type of the enclosing notebook.
229+
#[serde(skip_serializing_if = "Option::is_none")]
230+
notebook_type: Option<String>,
231+
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
232+
scheme: String,
233+
/// A glob pattern.
234+
#[serde(skip_serializing_if = "Option::is_none")]
235+
pattern: Option<String>,
236+
},
237+
ByPattern {
238+
/// The type of the enclosing notebook.
239+
#[serde(skip_serializing_if = "Option::is_none")]
240+
notebook_type: Option<String>,
241+
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
242+
#[serde(skip_serializing_if = "Option::is_none")]
243+
scheme: Option<String>,
244+
/// A glob pattern.
245+
pattern: String,
246+
},
267247
}
268248

269249
mod notification_params {

0 commit comments

Comments
 (0)