| 1 |
use crate::{ |
| 2 |
Command, InsertTextFormat, Range, StaticRegistrationOptions, TextDocumentPositionParams, |
| 3 |
TextDocumentRegistrationOptions, WorkDoneProgressOptions, WorkDoneProgressParams, |
| 4 |
}; |
| 5 |
use serde::{Deserialize, Serialize}; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 11 |
#[serde(rename_all = "camelCase")] |
| 12 |
pub struct InlineCompletionClientCapabilities { |
| 13 |
|
| 14 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 15 |
pub dynamic_registration: Option<bool>, |
| 16 |
} |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 22 |
pub struct InlineCompletionOptions { |
| 23 |
#[serde(flatten)] |
| 24 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 31 |
pub struct InlineCompletionRegistrationOptions { |
| 32 |
#[serde(flatten)] |
| 33 |
pub inline_completion_options: InlineCompletionOptions, |
| 34 |
|
| 35 |
#[serde(flatten)] |
| 36 |
pub text_document_registration_options: TextDocumentRegistrationOptions, |
| 37 |
|
| 38 |
#[serde(flatten)] |
| 39 |
pub static_registration_options: StaticRegistrationOptions, |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 46 |
#[serde(rename_all = "camelCase")] |
| 47 |
pub struct InlineCompletionParams { |
| 48 |
#[serde(flatten)] |
| 49 |
pub work_done_progress_params: WorkDoneProgressParams, |
| 50 |
|
| 51 |
#[serde(flatten)] |
| 52 |
pub text_document_position: TextDocumentPositionParams, |
| 53 |
|
| 54 |
|
| 55 |
pub context: InlineCompletionContext, |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
#[derive(Eq, PartialEq, Clone, Copy, Deserialize, Serialize)] |
| 62 |
pub struct InlineCompletionTriggerKind(i32); |
| 63 |
lsp_enum! { |
| 64 |
impl InlineCompletionTriggerKind { |
| 65 |
|
| 66 |
|
| 67 |
pub const Invoked: InlineCompletionTriggerKind = InlineCompletionTriggerKind(1); |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
pub const Automatic: InlineCompletionTriggerKind = InlineCompletionTriggerKind(2); |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 79 |
pub struct SelectedCompletionInfo { |
| 80 |
|
| 81 |
pub range: Range, |
| 82 |
|
| 83 |
|
| 84 |
pub text: String, |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 92 |
#[serde(rename_all = "camelCase")] |
| 93 |
pub struct InlineCompletionContext { |
| 94 |
|
| 95 |
pub trigger_kind: InlineCompletionTriggerKind, |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 109 |
pub selected_completion_info: Option<SelectedCompletionInfo>, |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] |
| 114 |
#[serde(untagged)] |
| 115 |
pub enum InlineCompletionResponse { |
| 116 |
Array(Vec<InlineCompletionItem>), |
| 117 |
List(InlineCompletionList), |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] |
| 124 |
pub struct InlineCompletionList { |
| 125 |
|
| 126 |
pub items: Vec<InlineCompletionItem>, |
| 127 |
} |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] |
| 134 |
#[serde(rename_all = "camelCase")] |
| 135 |
pub struct InlineCompletionItem { |
| 136 |
|
| 137 |
|
| 138 |
pub insert_text: String, |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 146 |
pub filter_text: Option<String>, |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 153 |
pub range: Option<Range>, |
| 154 |
|
| 155 |
|
| 156 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 157 |
pub command: Option<Command>, |
| 158 |
|
| 159 |
|
| 160 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 161 |
pub insert_text_format: Option<InsertTextFormat>, |
| 162 |
} |