Common/LanguageFeature/DTO/CompletionItemDTO.rs
1//! # CompletionItemDTO
2//!
3//! Defines the Data Transfer Object for a single completion suggestion item.
4
5use serde::{Deserialize, Serialize};
6use serde_json::Value;
7
8/// A serializable struct representing a single completion item, analogous to
9/// `vscode.CompletionItem`.
10#[derive(Serialize, Deserialize, Debug, Clone)]
11#[serde(rename_all = "PascalCase")]
12pub struct CompletionItemDTO {
13 /// The label of this completion item.
14 // Can be string or a CompletionItemLabel object
15 pub Label: Value,
16
17 /// The kind of this completion item.
18 // Corresponds to vscode.CompletionItemKind enum
19 pub Kind: u32,
20
21 /// A human-readable string with additional information about this item.
22 #[serde(skip_serializing_if = "Option::is_none")]
23 pub Detail:Option<String>,
24
25 /// A human-readable string that represents a doc-comment.
26 #[serde(skip_serializing_if = "Option::is_none")]
27 // string or IMarkdownStringDTO
28 pub Documentation: Option<Value>,
29
30 /// A string that should be used when comparing this item with other items.
31 #[serde(skip_serializing_if = "Option::is_none")]
32 pub SortText:Option<String>,
33
34 /// A string that should be used when filtering a set of completion items.
35 #[serde(skip_serializing_if = "Option::is_none")]
36 pub FilterText:Option<String>,
37
38 /// A string or snippet that should be inserted in a document when selecting
39 /// this completion.
40 #[serde(skip_serializing_if = "Option::is_none")]
41 // string or SnippetString DTO
42 pub InsertText: Option<Value>,
43
44 /// A range of text that should be replaced by this completion item.
45 #[serde(skip_serializing_if = "Option::is_none")]
46 // RangeDTO or { inserting: RangeDTO, replacing: RangeDTO }
47 pub Range: Option<Value>,
48
49 /// An optional array of additional text edits that are applied when
50 /// selecting this completion.
51 #[serde(skip_serializing_if = "Option::is_none")]
52 // Vec<TextEditDTO>
53 pub AdditionalTextEdits: Option<Vec<Value>>,
54
55 /// A command that should be executed after inserting this completion.
56 #[serde(skip_serializing_if = "Option::is_none")]
57 // CommandDTO
58 pub Command: Option<Value>,
59}