Common/LanguageFeature/DTO/CompletionContextDTO.rs
1//! # CompletionContextDTO
2//!
3//! Defines the Data Transfer Object for the context of a completion request.
4
5use serde::{Deserialize, Serialize};
6
7/// Represents the reason why code completion was triggered.
8#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
9pub enum CompletionTriggerKindDTO {
10 /// Completion was triggered by typing a trigger character.
11 TriggerCharacter = 1,
12
13 /// Completion was triggered explicitly by a command.
14 Invoke = 2,
15}
16
17/// A serializable struct representing the context in which a completion was
18/// requested, analogous to `vscode.CompletionContext`.
19#[derive(Serialize, Deserialize, Debug, Clone)]
20#[serde(rename_all = "PascalCase")]
21pub struct CompletionContextDTO {
22 /// The kind of trigger that initiated the completion request.
23 pub TriggerKind:CompletionTriggerKindDTO,
24
25 /// The character that triggered the completion request, if any.
26 #[serde(skip_serializing_if = "Option::is_none")]
27 pub TriggerCharacter:Option<String>,
28}