| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#![allow(non_upper_case_globals)] |
| 18 |
#![forbid(unsafe_code)] |
| 19 |
|
| 20 |
use bitflags::bitflags; |
| 21 |
|
| 22 |
use std::{collections::HashMap, fmt::Debug}; |
| 23 |
|
| 24 |
pub use helix_stdx::Url; |
| 25 |
use serde::{de, de::Error as Error_, Deserialize, Serialize}; |
| 26 |
use serde_json::Value; |
| 27 |
|
| 28 |
|
| 29 |
type PascalCaseBuf = [u8; 32]; |
| 30 |
const fn fmt_pascal_case_const(name: &str) -> (PascalCaseBuf, usize) { |
| 31 |
let mut buf = [0; 32]; |
| 32 |
let mut buf_i = 0; |
| 33 |
let mut name_i = 0; |
| 34 |
let name = name.as_bytes(); |
| 35 |
while name_i < name.len() { |
| 36 |
let first = name[name_i]; |
| 37 |
name_i += 1; |
| 38 |
|
| 39 |
buf[buf_i] = first; |
| 40 |
buf_i += 1; |
| 41 |
|
| 42 |
while name_i < name.len() { |
| 43 |
let rest = name[name_i]; |
| 44 |
name_i += 1; |
| 45 |
if rest == b'_' { |
| 46 |
break; |
| 47 |
} |
| 48 |
|
| 49 |
buf[buf_i] = rest.to_ascii_lowercase(); |
| 50 |
buf_i += 1; |
| 51 |
} |
| 52 |
} |
| 53 |
(buf, buf_i) |
| 54 |
} |
| 55 |
|
| 56 |
fn fmt_pascal_case(f: &mut std::fmt::Formatter<'_>, name: &str) -> std::fmt::Result { |
| 57 |
for word in name.split('_') { |
| 58 |
let mut chars = word.chars(); |
| 59 |
let first = chars.next().unwrap(); |
| 60 |
write!(f, "{}", first)?; |
| 61 |
for rest in chars { |
| 62 |
write!(f, "{}", rest.to_lowercase())?; |
| 63 |
} |
| 64 |
} |
| 65 |
Ok(()) |
| 66 |
} |
| 67 |
|
| 68 |
macro_rules! lsp_enum { |
| 69 |
(impl $typ: ident { $( $(#[$attr:meta])* pub const $name: ident : $enum_type: ty = $value: expr; )* }) => { |
| 70 |
impl $typ { |
| 71 |
$( |
| 72 |
$(#[$attr])* |
| 73 |
pub const $name: $enum_type = $value; |
| 74 |
)* |
| 75 |
} |
| 76 |
|
| 77 |
impl std::fmt::Debug for $typ { |
| 78 |
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 79 |
match *self { |
| 80 |
$( |
| 81 |
Self::$name => crate::fmt_pascal_case(f, stringify!($name)), |
| 82 |
)* |
| 83 |
_ => write!(f, "{}({})", stringify!($typ), self.0), |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
impl std::convert::TryFrom<&str> for $typ { |
| 89 |
type Error = &'static str; |
| 90 |
fn try_from(value: &str) -> Result<Self, Self::Error> { |
| 91 |
match () { |
| 92 |
$( |
| 93 |
_ if { |
| 94 |
const X: (crate::PascalCaseBuf, usize) = crate::fmt_pascal_case_const(stringify!($name)); |
| 95 |
let (buf, len) = X; |
| 96 |
&buf[..len] == value.as_bytes() |
| 97 |
} => Ok(Self::$name), |
| 98 |
)* |
| 99 |
_ => Err("unknown enum variant"), |
| 100 |
} |
| 101 |
} |
| 102 |
} |
| 103 |
|
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
pub mod error_codes; |
| 108 |
pub mod notification; |
| 109 |
pub mod request; |
| 110 |
|
| 111 |
mod call_hierarchy; |
| 112 |
pub use call_hierarchy::*; |
| 113 |
|
| 114 |
mod code_action; |
| 115 |
pub use code_action::*; |
| 116 |
|
| 117 |
mod code_lens; |
| 118 |
pub use code_lens::*; |
| 119 |
|
| 120 |
mod color; |
| 121 |
pub use color::*; |
| 122 |
|
| 123 |
mod completion; |
| 124 |
pub use completion::*; |
| 125 |
|
| 126 |
mod document_diagnostic; |
| 127 |
pub use document_diagnostic::*; |
| 128 |
|
| 129 |
mod document_highlight; |
| 130 |
pub use document_highlight::*; |
| 131 |
|
| 132 |
mod document_link; |
| 133 |
pub use document_link::*; |
| 134 |
|
| 135 |
mod document_symbols; |
| 136 |
pub use document_symbols::*; |
| 137 |
|
| 138 |
mod file_operations; |
| 139 |
pub use file_operations::*; |
| 140 |
|
| 141 |
mod folding_range; |
| 142 |
pub use folding_range::*; |
| 143 |
|
| 144 |
mod formatting; |
| 145 |
pub use formatting::*; |
| 146 |
|
| 147 |
mod hover; |
| 148 |
pub use hover::*; |
| 149 |
|
| 150 |
mod inlay_hint; |
| 151 |
pub use inlay_hint::*; |
| 152 |
|
| 153 |
mod inline_value; |
| 154 |
pub use inline_value::*; |
| 155 |
|
| 156 |
#[cfg(feature = "proposed")] |
| 157 |
mod inline_completion; |
| 158 |
#[cfg(feature = "proposed")] |
| 159 |
pub use inline_completion::*; |
| 160 |
|
| 161 |
mod moniker; |
| 162 |
pub use moniker::*; |
| 163 |
|
| 164 |
mod progress; |
| 165 |
pub use progress::*; |
| 166 |
|
| 167 |
mod references; |
| 168 |
pub use references::*; |
| 169 |
|
| 170 |
mod rename; |
| 171 |
pub use rename::*; |
| 172 |
|
| 173 |
pub mod selection_range; |
| 174 |
pub use selection_range::*; |
| 175 |
|
| 176 |
mod semantic_tokens; |
| 177 |
pub use semantic_tokens::*; |
| 178 |
|
| 179 |
mod signature_help; |
| 180 |
pub use signature_help::*; |
| 181 |
|
| 182 |
mod type_hierarchy; |
| 183 |
pub use type_hierarchy::*; |
| 184 |
|
| 185 |
mod linked_editing; |
| 186 |
pub use linked_editing::*; |
| 187 |
|
| 188 |
mod window; |
| 189 |
pub use window::*; |
| 190 |
|
| 191 |
mod workspace_diagnostic; |
| 192 |
pub use workspace_diagnostic::*; |
| 193 |
|
| 194 |
mod workspace_folders; |
| 195 |
pub use workspace_folders::*; |
| 196 |
|
| 197 |
mod workspace_symbols; |
| 198 |
pub use workspace_symbols::*; |
| 199 |
|
| 200 |
pub mod lsif; |
| 201 |
|
| 202 |
mod trace; |
| 203 |
pub use trace::*; |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
#[derive(Debug, Eq, Hash, PartialEq, Clone, Deserialize, Serialize)] |
| 208 |
#[serde(untagged)] |
| 209 |
pub enum NumberOrString { |
| 210 |
Number(i32), |
| 211 |
String(String), |
| 212 |
} |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 217 |
pub struct CancelParams { |
| 218 |
|
| 219 |
pub id: NumberOrString, |
| 220 |
} |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
pub type LSPAny = serde_json::Value; |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
pub type LSPObject = serde_json::Map<String, serde_json::Value>; |
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
pub type LSPArray = Vec<serde_json::Value>; |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
#[derive( |
| 242 |
Debug, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Default, Deserialize, Serialize, Hash, |
| 243 |
)] |
| 244 |
pub struct Position { |
| 245 |
|
| 246 |
pub line: u32, |
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
pub character: u32, |
| 253 |
} |
| 254 |
|
| 255 |
impl Position { |
| 256 |
pub fn new(line: u32, character: u32) -> Position { |
| 257 |
Position { line, character } |
| 258 |
} |
| 259 |
} |
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
#[derive(Debug, Eq, PartialEq, Copy, Clone, Default, Deserialize, Serialize, Hash)] |
| 264 |
pub struct Range { |
| 265 |
|
| 266 |
pub start: Position, |
| 267 |
|
| 268 |
pub end: Position, |
| 269 |
} |
| 270 |
|
| 271 |
impl Range { |
| 272 |
pub fn new(start: Position, end: Position) -> Range { |
| 273 |
Range { start, end } |
| 274 |
} |
| 275 |
} |
| 276 |
|
| 277 |
|
| 278 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize, Hash)] |
| 279 |
pub struct Location { |
| 280 |
pub uri: Url, |
| 281 |
pub range: Range, |
| 282 |
} |
| 283 |
|
| 284 |
impl Location { |
| 285 |
pub fn new(uri: Url, range: Range) -> Location { |
| 286 |
Location { uri, range } |
| 287 |
} |
| 288 |
} |
| 289 |
|
| 290 |
|
| 291 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 292 |
#[serde(rename_all = "camelCase")] |
| 293 |
pub struct LocationLink { |
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 299 |
pub origin_selection_range: Option<Range>, |
| 300 |
|
| 301 |
|
| 302 |
pub target_uri: Url, |
| 303 |
|
| 304 |
|
| 305 |
pub target_range: Range, |
| 306 |
|
| 307 |
|
| 308 |
pub target_selection_range: Range, |
| 309 |
} |
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Clone, Deserialize, Serialize)] |
| 316 |
pub struct PositionEncodingKind(std::borrow::Cow<'static, str>); |
| 317 |
|
| 318 |
impl PositionEncodingKind { |
| 319 |
|
| 320 |
pub const UTF8: PositionEncodingKind = PositionEncodingKind::new("utf-8"); |
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
pub const UTF16: PositionEncodingKind = PositionEncodingKind::new("utf-16"); |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
pub const UTF32: PositionEncodingKind = PositionEncodingKind::new("utf-32"); |
| 334 |
|
| 335 |
pub const fn new(tag: &'static str) -> Self { |
| 336 |
PositionEncodingKind(std::borrow::Cow::Borrowed(tag)) |
| 337 |
} |
| 338 |
|
| 339 |
pub fn as_str(&self) -> &str { |
| 340 |
&self.0 |
| 341 |
} |
| 342 |
} |
| 343 |
|
| 344 |
impl From<String> for PositionEncodingKind { |
| 345 |
fn from(from: String) -> Self { |
| 346 |
PositionEncodingKind(std::borrow::Cow::from(from)) |
| 347 |
} |
| 348 |
} |
| 349 |
|
| 350 |
impl From<&'static str> for PositionEncodingKind { |
| 351 |
fn from(from: &'static str) -> Self { |
| 352 |
PositionEncodingKind::new(from) |
| 353 |
} |
| 354 |
} |
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 359 |
#[serde(rename_all = "camelCase")] |
| 360 |
pub struct Diagnostic { |
| 361 |
|
| 362 |
pub range: Range, |
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 367 |
pub severity: Option<DiagnosticSeverity>, |
| 368 |
|
| 369 |
|
| 370 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 371 |
pub code: Option<NumberOrString>, |
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 377 |
pub code_description: Option<CodeDescription>, |
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 382 |
pub source: Option<String>, |
| 383 |
|
| 384 |
|
| 385 |
pub message: String, |
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 390 |
pub related_information: Option<Vec<DiagnosticRelatedInformation>>, |
| 391 |
|
| 392 |
|
| 393 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 394 |
pub tags: Option<Vec<DiagnosticTag>>, |
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 401 |
pub data: Option<serde_json::Value>, |
| 402 |
} |
| 403 |
|
| 404 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 405 |
#[serde(rename_all = "camelCase")] |
| 406 |
pub struct CodeDescription { |
| 407 |
pub href: Url, |
| 408 |
} |
| 409 |
|
| 410 |
impl Diagnostic { |
| 411 |
pub fn new( |
| 412 |
range: Range, |
| 413 |
severity: Option<DiagnosticSeverity>, |
| 414 |
code: Option<NumberOrString>, |
| 415 |
source: Option<String>, |
| 416 |
message: String, |
| 417 |
related_information: Option<Vec<DiagnosticRelatedInformation>>, |
| 418 |
tags: Option<Vec<DiagnosticTag>>, |
| 419 |
) -> Diagnostic { |
| 420 |
Diagnostic { |
| 421 |
range, |
| 422 |
severity, |
| 423 |
code, |
| 424 |
source, |
| 425 |
message, |
| 426 |
related_information, |
| 427 |
tags, |
| 428 |
..Diagnostic::default() |
| 429 |
} |
| 430 |
} |
| 431 |
|
| 432 |
pub fn new_simple(range: Range, message: String) -> Diagnostic { |
| 433 |
Self::new(range, None, None, None, message, None, None) |
| 434 |
} |
| 435 |
|
| 436 |
pub fn new_with_code_number( |
| 437 |
range: Range, |
| 438 |
severity: DiagnosticSeverity, |
| 439 |
code_number: i32, |
| 440 |
source: Option<String>, |
| 441 |
message: String, |
| 442 |
) -> Diagnostic { |
| 443 |
let code = Some(NumberOrString::Number(code_number)); |
| 444 |
Self::new(range, Some(severity), code, source, message, None, None) |
| 445 |
} |
| 446 |
} |
| 447 |
|
| 448 |
|
| 449 |
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Deserialize, Serialize)] |
| 450 |
#[serde(transparent)] |
| 451 |
pub struct DiagnosticSeverity(i32); |
| 452 |
lsp_enum! { |
| 453 |
impl DiagnosticSeverity { |
| 454 |
|
| 455 |
pub const ERROR: DiagnosticSeverity = DiagnosticSeverity(1); |
| 456 |
|
| 457 |
pub const WARNING: DiagnosticSeverity = DiagnosticSeverity(2); |
| 458 |
|
| 459 |
pub const INFORMATION: DiagnosticSeverity = DiagnosticSeverity(3); |
| 460 |
|
| 461 |
pub const HINT: DiagnosticSeverity = DiagnosticSeverity(4); |
| 462 |
} |
| 463 |
} |
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 469 |
pub struct DiagnosticRelatedInformation { |
| 470 |
|
| 471 |
pub location: Location, |
| 472 |
|
| 473 |
|
| 474 |
pub message: String, |
| 475 |
} |
| 476 |
|
| 477 |
|
| 478 |
#[derive(Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 479 |
#[serde(transparent)] |
| 480 |
pub struct DiagnosticTag(i32); |
| 481 |
lsp_enum! { |
| 482 |
impl DiagnosticTag { |
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
pub const UNNECESSARY: DiagnosticTag = DiagnosticTag(1); |
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
pub const DEPRECATED: DiagnosticTag = DiagnosticTag(2); |
| 491 |
} |
| 492 |
} |
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
s. |
| 499 |
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 500 |
pub struct Command { |
| 501 |
|
| 502 |
pub title: String, |
| 503 |
|
| 504 |
pub command: String, |
| 505 |
|
| 506 |
|
| 507 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 508 |
pub arguments: Option<Vec<Value>>, |
| 509 |
} |
| 510 |
|
| 511 |
impl Command { |
| 512 |
pub fn new(title: String, command: String, arguments: Option<Vec<Value>>) -> Command { |
| 513 |
Command { |
| 514 |
title, |
| 515 |
command, |
| 516 |
arguments, |
| 517 |
} |
| 518 |
} |
| 519 |
} |
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 527 |
#[serde(rename_all = "camelCase")] |
| 528 |
pub struct TextEdit { |
| 529 |
|
| 530 |
|
| 531 |
pub range: Range, |
| 532 |
|
| 533 |
|
| 534 |
pub new_text: String, |
| 535 |
} |
| 536 |
|
| 537 |
impl TextEdit { |
| 538 |
pub fn new(range: Range, new_text: String) -> TextEdit { |
| 539 |
TextEdit { range, new_text } |
| 540 |
} |
| 541 |
} |
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
pub type ChangeAnnotationIdentifier = String; |
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 553 |
#[serde(rename_all = "camelCase")] |
| 554 |
pub struct AnnotatedTextEdit { |
| 555 |
#[serde(flatten)] |
| 556 |
pub text_edit: TextEdit, |
| 557 |
|
| 558 |
|
| 559 |
pub annotation_id: ChangeAnnotationIdentifier, |
| 560 |
} |
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 568 |
#[serde(rename_all = "camelCase")] |
| 569 |
pub struct TextDocumentEdit { |
| 570 |
|
| 571 |
pub text_document: OptionalVersionedTextDocumentIdentifier, |
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
pub edits: Vec<OneOf<TextEdit, AnnotatedTextEdit>>, |
| 578 |
} |
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 584 |
#[serde(rename_all = "camelCase")] |
| 585 |
pub struct ChangeAnnotation { |
| 586 |
|
| 587 |
|
| 588 |
pub label: String, |
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 593 |
pub needs_confirmation: Option<bool>, |
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 598 |
pub description: Option<String>, |
| 599 |
} |
| 600 |
|
| 601 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 602 |
#[serde(rename_all = "camelCase")] |
| 603 |
pub struct ChangeAnnotationWorkspaceEditClientCapabilities { |
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 608 |
pub groups_on_label: Option<bool>, |
| 609 |
} |
| 610 |
|
| 611 |
|
| 612 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 613 |
#[serde(rename_all = "camelCase")] |
| 614 |
pub struct CreateFileOptions { |
| 615 |
|
| 616 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 617 |
pub overwrite: Option<bool>, |
| 618 |
|
| 619 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 620 |
pub ignore_if_exists: Option<bool>, |
| 621 |
} |
| 622 |
|
| 623 |
|
| 624 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 625 |
#[serde(rename_all = "camelCase")] |
| 626 |
pub struct CreateFile { |
| 627 |
|
| 628 |
pub uri: Url, |
| 629 |
|
| 630 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 631 |
pub options: Option<CreateFileOptions>, |
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 637 |
pub annotation_id: Option<ChangeAnnotationIdentifier>, |
| 638 |
} |
| 639 |
|
| 640 |
|
| 641 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 642 |
#[serde(rename_all = "camelCase")] |
| 643 |
pub struct RenameFileOptions { |
| 644 |
|
| 645 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 646 |
pub overwrite: Option<bool>, |
| 647 |
|
| 648 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 649 |
pub ignore_if_exists: Option<bool>, |
| 650 |
} |
| 651 |
|
| 652 |
|
| 653 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 654 |
#[serde(rename_all = "camelCase")] |
| 655 |
pub struct RenameFile { |
| 656 |
|
| 657 |
pub old_uri: Url, |
| 658 |
|
| 659 |
pub new_uri: Url, |
| 660 |
|
| 661 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 662 |
pub options: Option<RenameFileOptions>, |
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 668 |
pub annotation_id: Option<ChangeAnnotationIdentifier>, |
| 669 |
} |
| 670 |
|
| 671 |
|
| 672 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 673 |
#[serde(rename_all = "camelCase")] |
| 674 |
pub struct DeleteFileOptions { |
| 675 |
|
| 676 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 677 |
pub recursive: Option<bool>, |
| 678 |
|
| 679 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 680 |
pub ignore_if_not_exists: Option<bool>, |
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 686 |
pub annotation_id: Option<ChangeAnnotationIdentifier>, |
| 687 |
} |
| 688 |
|
| 689 |
|
| 690 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 691 |
#[serde(rename_all = "camelCase")] |
| 692 |
pub struct DeleteFile { |
| 693 |
|
| 694 |
pub uri: Url, |
| 695 |
|
| 696 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 697 |
pub options: Option<DeleteFileOptions>, |
| 698 |
} |
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 705 |
#[serde(rename_all = "camelCase")] |
| 706 |
pub struct WorkspaceEdit { |
| 707 |
|
| 708 |
#[serde(with = "url_map")] |
| 709 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 710 |
#[serde(default)] |
| 711 |
pub changes: Option<HashMap<Url, Vec<TextEdit>>>, |
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 724 |
pub document_changes: Option<DocumentChanges>, |
| 725 |
|
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 735 |
pub change_annotations: Option<HashMap<ChangeAnnotationIdentifier, ChangeAnnotation>>, |
| 736 |
} |
| 737 |
|
| 738 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 739 |
#[serde(untagged)] |
| 740 |
pub enum DocumentChanges { |
| 741 |
Edits(Vec<TextDocumentEdit>), |
| 742 |
Operations(Vec<DocumentChangeOperation>), |
| 743 |
} |
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 761 |
#[serde(untagged, rename_all = "lowercase")] |
| 762 |
pub enum DocumentChangeOperation { |
| 763 |
Op(ResourceOp), |
| 764 |
Edit(TextDocumentEdit), |
| 765 |
} |
| 766 |
|
| 767 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 768 |
#[serde(tag = "kind", rename_all = "lowercase")] |
| 769 |
pub enum ResourceOp { |
| 770 |
Create(CreateFile), |
| 771 |
Rename(RenameFile), |
| 772 |
Delete(DeleteFile), |
| 773 |
} |
| 774 |
|
| 775 |
pub type DidChangeConfigurationClientCapabilities = DynamicRegistrationClientCapabilities; |
| 776 |
|
| 777 |
#[derive(Debug, Default, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 778 |
#[serde(rename_all = "camelCase")] |
| 779 |
pub struct ConfigurationParams { |
| 780 |
pub items: Vec<ConfigurationItem>, |
| 781 |
} |
| 782 |
|
| 783 |
#[derive(Debug, Default, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 784 |
#[serde(rename_all = "camelCase")] |
| 785 |
pub struct ConfigurationItem { |
| 786 |
|
| 787 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 788 |
pub scope_uri: Option<Url>, |
| 789 |
|
| 790 |
|
| 791 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 792 |
pub section: Option<String>, |
| 793 |
} |
| 794 |
|
| 795 |
mod url_map { |
| 796 |
use std::fmt; |
| 797 |
use std::marker::PhantomData; |
| 798 |
|
| 799 |
use super::*; |
| 800 |
|
| 801 |
pub fn deserialize<'de, D, V>(deserializer: D) -> Result<Option<HashMap<Url, V>>, D::Error> |
| 802 |
where |
| 803 |
D: serde::Deserializer<'de>, |
| 804 |
V: de::DeserializeOwned, |
| 805 |
{ |
| 806 |
struct UrlMapVisitor<V> { |
| 807 |
_marker: PhantomData<V>, |
| 808 |
} |
| 809 |
|
| 810 |
impl<V: de::DeserializeOwned> Default for UrlMapVisitor<V> { |
| 811 |
fn default() -> Self { |
| 812 |
UrlMapVisitor { |
| 813 |
_marker: PhantomData, |
| 814 |
} |
| 815 |
} |
| 816 |
} |
| 817 |
impl<'de, V: de::DeserializeOwned> de::Visitor<'de> for UrlMapVisitor<V> { |
| 818 |
type Value = HashMap<Url, V>; |
| 819 |
|
| 820 |
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
| 821 |
formatter.write_str("map") |
| 822 |
} |
| 823 |
|
| 824 |
fn visit_map<M>(self, mut visitor: M) -> Result<Self::Value, M::Error> |
| 825 |
where |
| 826 |
M: de::MapAccess<'de>, |
| 827 |
{ |
| 828 |
let mut values = HashMap::with_capacity(visitor.size_hint().unwrap_or(0)); |
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
while let Some((key, value)) = visitor.next_entry::<Url, _>()? { |
| 833 |
values.insert(key, value); |
| 834 |
} |
| 835 |
|
| 836 |
Ok(values) |
| 837 |
} |
| 838 |
} |
| 839 |
|
| 840 |
struct OptionUrlMapVisitor<V> { |
| 841 |
_marker: PhantomData<V>, |
| 842 |
} |
| 843 |
impl<V: de::DeserializeOwned> Default for OptionUrlMapVisitor<V> { |
| 844 |
fn default() -> Self { |
| 845 |
OptionUrlMapVisitor { |
| 846 |
_marker: PhantomData, |
| 847 |
} |
| 848 |
} |
| 849 |
} |
| 850 |
impl<'de, V: de::DeserializeOwned> de::Visitor<'de> for OptionUrlMapVisitor<V> { |
| 851 |
type Value = Option<HashMap<Url, V>>; |
| 852 |
|
| 853 |
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
| 854 |
formatter.write_str("option") |
| 855 |
} |
| 856 |
|
| 857 |
#[inline] |
| 858 |
fn visit_unit<E>(self) -> Result<Self::Value, E> |
| 859 |
where |
| 860 |
E: serde::de::Error, |
| 861 |
{ |
| 862 |
Ok(None) |
| 863 |
} |
| 864 |
|
| 865 |
#[inline] |
| 866 |
fn visit_none<E>(self) -> Result<Self::Value, E> |
| 867 |
where |
| 868 |
E: serde::de::Error, |
| 869 |
{ |
| 870 |
Ok(None) |
| 871 |
} |
| 872 |
|
| 873 |
#[inline] |
| 874 |
fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error> |
| 875 |
where |
| 876 |
D: serde::Deserializer<'de>, |
| 877 |
{ |
| 878 |
deserializer |
| 879 |
.deserialize_map(UrlMapVisitor::<V>::default()) |
| 880 |
.map(Some) |
| 881 |
} |
| 882 |
} |
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
deserializer.deserialize_option(OptionUrlMapVisitor::default()) |
| 887 |
} |
| 888 |
|
| 889 |
pub fn serialize<S, V>( |
| 890 |
changes: &Option<HashMap<Url, V>>, |
| 891 |
serializer: S, |
| 892 |
) -> Result<S::Ok, S::Error> |
| 893 |
where |
| 894 |
S: serde::Serializer, |
| 895 |
V: serde::Serialize, |
| 896 |
{ |
| 897 |
use serde::ser::SerializeMap; |
| 898 |
|
| 899 |
match *changes { |
| 900 |
Some(ref changes) => { |
| 901 |
let mut map = serializer.serialize_map(Some(changes.len()))?; |
| 902 |
for (k, v) in changes { |
| 903 |
map.serialize_entry(k.as_str(), v)?; |
| 904 |
} |
| 905 |
map.end() |
| 906 |
} |
| 907 |
None => serializer.serialize_none(), |
| 908 |
} |
| 909 |
} |
| 910 |
} |
| 911 |
|
| 912 |
impl WorkspaceEdit { |
| 913 |
pub fn new(changes: HashMap<Url, Vec<TextEdit>>) -> WorkspaceEdit { |
| 914 |
WorkspaceEdit { |
| 915 |
changes: Some(changes), |
| 916 |
document_changes: None, |
| 917 |
..Default::default() |
| 918 |
} |
| 919 |
} |
| 920 |
} |
| 921 |
|
| 922 |
|
| 923 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 924 |
pub struct TextDocumentIdentifier { |
| 925 |
|
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
|
| 930 |
pub uri: Url, |
| 931 |
} |
| 932 |
|
| 933 |
impl TextDocumentIdentifier { |
| 934 |
pub fn new(uri: Url) -> TextDocumentIdentifier { |
| 935 |
TextDocumentIdentifier { uri } |
| 936 |
} |
| 937 |
} |
| 938 |
|
| 939 |
|
| 940 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 941 |
#[serde(rename_all = "camelCase")] |
| 942 |
pub struct TextDocumentItem { |
| 943 |
|
| 944 |
pub uri: Url, |
| 945 |
|
| 946 |
|
| 947 |
pub language_id: String, |
| 948 |
|
| 949 |
|
| 950 |
|
| 951 |
pub version: i32, |
| 952 |
|
| 953 |
|
| 954 |
pub text: String, |
| 955 |
} |
| 956 |
|
| 957 |
impl TextDocumentItem { |
| 958 |
pub fn new(uri: Url, language_id: String, version: i32, text: String) -> TextDocumentItem { |
| 959 |
TextDocumentItem { |
| 960 |
uri, |
| 961 |
language_id, |
| 962 |
version, |
| 963 |
text, |
| 964 |
} |
| 965 |
} |
| 966 |
} |
| 967 |
|
| 968 |
|
| 969 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 970 |
pub struct VersionedTextDocumentIdentifier { |
| 971 |
|
| 972 |
|
| 973 |
pub uri: Url, |
| 974 |
|
| 975 |
|
| 976 |
|
| 977 |
|
| 978 |
|
| 979 |
pub version: i32, |
| 980 |
} |
| 981 |
|
| 982 |
impl VersionedTextDocumentIdentifier { |
| 983 |
pub fn new(uri: Url, version: i32) -> VersionedTextDocumentIdentifier { |
| 984 |
VersionedTextDocumentIdentifier { uri, version } |
| 985 |
} |
| 986 |
} |
| 987 |
|
| 988 |
|
| 989 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 990 |
pub struct OptionalVersionedTextDocumentIdentifier { |
| 991 |
|
| 992 |
|
| 993 |
pub uri: Url, |
| 994 |
|
| 995 |
|
| 996 |
|
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
|
| 1004 |
pub version: Option<i32>, |
| 1005 |
} |
| 1006 |
|
| 1007 |
impl OptionalVersionedTextDocumentIdentifier { |
| 1008 |
pub fn new(uri: Url, version: i32) -> OptionalVersionedTextDocumentIdentifier { |
| 1009 |
OptionalVersionedTextDocumentIdentifier { |
| 1010 |
uri, |
| 1011 |
version: Some(version), |
| 1012 |
} |
| 1013 |
} |
| 1014 |
} |
| 1015 |
|
| 1016 |
|
| 1017 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 1018 |
#[serde(rename_all = "camelCase")] |
| 1019 |
pub struct TextDocumentPositionParams { |
| 1020 |
|
| 1021 |
|
| 1022 |
|
| 1023 |
|
| 1024 |
|
| 1025 |
pub text_document: TextDocumentIdentifier, |
| 1026 |
|
| 1027 |
|
| 1028 |
pub position: Position, |
| 1029 |
} |
| 1030 |
|
| 1031 |
impl TextDocumentPositionParams { |
| 1032 |
pub fn new( |
| 1033 |
text_document: TextDocumentIdentifier, |
| 1034 |
position: Position, |
| 1035 |
) -> TextDocumentPositionParams { |
| 1036 |
TextDocumentPositionParams { |
| 1037 |
text_document, |
| 1038 |
position, |
| 1039 |
} |
| 1040 |
} |
| 1041 |
} |
| 1042 |
|
| 1043 |
|
| 1044 |
|
| 1045 |
|
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 1050 |
pub struct DocumentFilter { |
| 1051 |
|
| 1052 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1053 |
pub language: Option<String>, |
| 1054 |
|
| 1055 |
|
| 1056 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1057 |
pub scheme: Option<String>, |
| 1058 |
|
| 1059 |
|
| 1060 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1061 |
pub pattern: Option<String>, |
| 1062 |
} |
| 1063 |
|
| 1064 |
|
| 1065 |
pub type DocumentSelector = Vec<DocumentFilter>; |
| 1066 |
|
| 1067 |
|
| 1068 |
|
| 1069 |
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize, Default)] |
| 1070 |
#[serde(rename_all = "camelCase")] |
| 1071 |
pub struct InitializeParams { |
| 1072 |
|
| 1073 |
|
| 1074 |
|
| 1075 |
pub process_id: Option<u32>, |
| 1076 |
|
| 1077 |
|
| 1078 |
|
| 1079 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1080 |
#[deprecated(note = "Use `root_uri` instead when possible")] |
| 1081 |
pub root_path: Option<String>, |
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 |
|
| 1086 |
#[serde(default)] |
| 1087 |
#[deprecated(note = "Use `workspace_folders` instead when possible")] |
| 1088 |
pub root_uri: Option<Url>, |
| 1089 |
|
| 1090 |
|
| 1091 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1092 |
pub initialization_options: Option<Value>, |
| 1093 |
|
| 1094 |
|
| 1095 |
pub capabilities: ClientCapabilities, |
| 1096 |
|
| 1097 |
|
| 1098 |
#[serde(default)] |
| 1099 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1100 |
pub trace: Option<TraceValue>, |
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
|
| 1105 |
|
| 1106 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1107 |
pub workspace_folders: Option<Vec<WorkspaceFolder>>, |
| 1108 |
|
| 1109 |
|
| 1110 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1111 |
pub client_info: Option<ClientInfo>, |
| 1112 |
|
| 1113 |
|
| 1114 |
|
| 1115 |
|
| 1116 |
|
| 1117 |
|
| 1118 |
|
| 1119 |
|
| 1120 |
|
| 1121 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1122 |
pub locale: Option<String>, |
| 1123 |
|
| 1124 |
|
| 1125 |
|
| 1126 |
#[serde(flatten)] |
| 1127 |
pub work_done_progress_params: WorkDoneProgressParams, |
| 1128 |
} |
| 1129 |
|
| 1130 |
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] |
| 1131 |
pub struct ClientInfo { |
| 1132 |
|
| 1133 |
pub name: String, |
| 1134 |
|
| 1135 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1136 |
pub version: Option<String>, |
| 1137 |
} |
| 1138 |
|
| 1139 |
#[derive(Debug, PartialEq, Clone, Copy, Deserialize, Serialize)] |
| 1140 |
pub struct InitializedParams {} |
| 1141 |
|
| 1142 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 1143 |
pub struct GenericRegistrationOptions { |
| 1144 |
#[serde(flatten)] |
| 1145 |
pub text_document_registration_options: TextDocumentRegistrationOptions, |
| 1146 |
|
| 1147 |
#[serde(flatten)] |
| 1148 |
pub options: GenericOptions, |
| 1149 |
|
| 1150 |
#[serde(flatten)] |
| 1151 |
pub static_registration_options: StaticRegistrationOptions, |
| 1152 |
} |
| 1153 |
|
| 1154 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 1155 |
pub struct GenericOptions { |
| 1156 |
#[serde(flatten)] |
| 1157 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 1158 |
} |
| 1159 |
|
| 1160 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 1161 |
pub struct GenericParams { |
| 1162 |
#[serde(flatten)] |
| 1163 |
pub text_document_position_params: TextDocumentPositionParams, |
| 1164 |
|
| 1165 |
#[serde(flatten)] |
| 1166 |
pub work_done_progress_params: WorkDoneProgressParams, |
| 1167 |
|
| 1168 |
#[serde(flatten)] |
| 1169 |
pub partial_result_params: PartialResultParams, |
| 1170 |
} |
| 1171 |
|
| 1172 |
#[derive(Debug, Eq, PartialEq, Clone, Copy, Default, Deserialize, Serialize)] |
| 1173 |
#[serde(rename_all = "camelCase")] |
| 1174 |
pub struct DynamicRegistrationClientCapabilities { |
| 1175 |
|
| 1176 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1177 |
pub dynamic_registration: Option<bool>, |
| 1178 |
} |
| 1179 |
|
| 1180 |
#[derive(Debug, Eq, PartialEq, Clone, Copy, Default, Deserialize, Serialize)] |
| 1181 |
#[serde(rename_all = "camelCase")] |
| 1182 |
pub struct GotoCapability { |
| 1183 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1184 |
pub dynamic_registration: Option<bool>, |
| 1185 |
|
| 1186 |
|
| 1187 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1188 |
pub link_support: Option<bool>, |
| 1189 |
} |
| 1190 |
|
| 1191 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1192 |
#[serde(rename_all = "camelCase")] |
| 1193 |
pub struct WorkspaceEditClientCapabilities { |
| 1194 |
|
| 1195 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1196 |
pub document_changes: Option<bool>, |
| 1197 |
|
| 1198 |
|
| 1199 |
|
| 1200 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1201 |
pub resource_operations: Option<Vec<ResourceOperationKind>>, |
| 1202 |
|
| 1203 |
|
| 1204 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1205 |
pub failure_handling: Option<FailureHandlingKind>, |
| 1206 |
|
| 1207 |
|
| 1208 |
|
| 1209 |
|
| 1210 |
|
| 1211 |
|
| 1212 |
|
| 1213 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1214 |
pub normalizes_line_endings: Option<bool>, |
| 1215 |
|
| 1216 |
|
| 1217 |
|
| 1218 |
|
| 1219 |
|
| 1220 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1221 |
pub change_annotation_support: Option<ChangeAnnotationWorkspaceEditClientCapabilities>, |
| 1222 |
} |
| 1223 |
|
| 1224 |
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Copy, Clone)] |
| 1225 |
#[serde(rename_all = "lowercase")] |
| 1226 |
pub enum ResourceOperationKind { |
| 1227 |
Create, |
| 1228 |
Rename, |
| 1229 |
Delete, |
| 1230 |
} |
| 1231 |
|
| 1232 |
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Copy, Clone)] |
| 1233 |
#[serde(rename_all = "camelCase")] |
| 1234 |
pub enum FailureHandlingKind { |
| 1235 |
Abort, |
| 1236 |
Transactional, |
| 1237 |
TextOnlyTransactional, |
| 1238 |
Undo, |
| 1239 |
} |
| 1240 |
|
| 1241 |
|
| 1242 |
#[derive(Eq, PartialEq, Copy, Clone, Serialize, Deserialize)] |
| 1243 |
#[serde(transparent)] |
| 1244 |
pub struct SymbolKind(i32); |
| 1245 |
lsp_enum! { |
| 1246 |
impl SymbolKind { |
| 1247 |
pub const FILE: SymbolKind = SymbolKind(1); |
| 1248 |
pub const MODULE: SymbolKind = SymbolKind(2); |
| 1249 |
pub const NAMESPACE: SymbolKind = SymbolKind(3); |
| 1250 |
pub const PACKAGE: SymbolKind = SymbolKind(4); |
| 1251 |
pub const CLASS: SymbolKind = SymbolKind(5); |
| 1252 |
pub const METHOD: SymbolKind = SymbolKind(6); |
| 1253 |
pub const PROPERTY: SymbolKind = SymbolKind(7); |
| 1254 |
pub const FIELD: SymbolKind = SymbolKind(8); |
| 1255 |
pub const CONSTRUCTOR: SymbolKind = SymbolKind(9); |
| 1256 |
pub const ENUM: SymbolKind = SymbolKind(10); |
| 1257 |
pub const INTERFACE: SymbolKind = SymbolKind(11); |
| 1258 |
pub const FUNCTION: SymbolKind = SymbolKind(12); |
| 1259 |
pub const VARIABLE: SymbolKind = SymbolKind(13); |
| 1260 |
pub const CONSTANT: SymbolKind = SymbolKind(14); |
| 1261 |
pub const STRING: SymbolKind = SymbolKind(15); |
| 1262 |
pub const NUMBER: SymbolKind = SymbolKind(16); |
| 1263 |
pub const BOOLEAN: SymbolKind = SymbolKind(17); |
| 1264 |
pub const ARRAY: SymbolKind = SymbolKind(18); |
| 1265 |
pub const OBJECT: SymbolKind = SymbolKind(19); |
| 1266 |
pub const KEY: SymbolKind = SymbolKind(20); |
| 1267 |
pub const NULL: SymbolKind = SymbolKind(21); |
| 1268 |
pub const ENUM_MEMBER: SymbolKind = SymbolKind(22); |
| 1269 |
pub const STRUCT: SymbolKind = SymbolKind(23); |
| 1270 |
pub const EVENT: SymbolKind = SymbolKind(24); |
| 1271 |
pub const OPERATOR: SymbolKind = SymbolKind(25); |
| 1272 |
pub const TYPE_PARAMETER: SymbolKind = SymbolKind(26); |
| 1273 |
} |
| 1274 |
} |
| 1275 |
|
| 1276 |
impl SymbolKind { |
| 1277 |
pub fn all() -> Vec<Self> { |
| 1278 |
(1..=26).map(Self).collect() |
| 1279 |
} |
| 1280 |
} |
| 1281 |
|
| 1282 |
|
| 1283 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1284 |
#[serde(rename_all = "camelCase")] |
| 1285 |
pub struct SymbolKindCapability { |
| 1286 |
|
| 1287 |
|
| 1288 |
|
| 1289 |
|
| 1290 |
|
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
pub value_set: Option<Vec<SymbolKind>>, |
| 1295 |
} |
| 1296 |
|
| 1297 |
|
| 1298 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1299 |
#[serde(rename_all = "camelCase")] |
| 1300 |
pub struct WorkspaceClientCapabilities { |
| 1301 |
|
| 1302 |
|
| 1303 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1304 |
pub apply_edit: Option<bool>, |
| 1305 |
|
| 1306 |
|
| 1307 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1308 |
pub workspace_edit: Option<WorkspaceEditClientCapabilities>, |
| 1309 |
|
| 1310 |
|
| 1311 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1312 |
pub did_change_configuration: Option<DidChangeConfigurationClientCapabilities>, |
| 1313 |
|
| 1314 |
|
| 1315 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1316 |
pub did_change_watched_files: Option<DidChangeWatchedFilesClientCapabilities>, |
| 1317 |
|
| 1318 |
|
| 1319 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1320 |
pub symbol: Option<WorkspaceSymbolClientCapabilities>, |
| 1321 |
|
| 1322 |
|
| 1323 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1324 |
pub execute_command: Option<ExecuteCommandClientCapabilities>, |
| 1325 |
|
| 1326 |
|
| 1327 |
|
| 1328 |
|
| 1329 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1330 |
pub workspace_folders: Option<bool>, |
| 1331 |
|
| 1332 |
|
| 1333 |
|
| 1334 |
|
| 1335 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1336 |
pub configuration: Option<bool>, |
| 1337 |
|
| 1338 |
|
| 1339 |
|
| 1340 |
|
| 1341 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1342 |
pub semantic_tokens: Option<SemanticTokensWorkspaceClientCapabilities>, |
| 1343 |
|
| 1344 |
|
| 1345 |
|
| 1346 |
|
| 1347 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1348 |
pub code_lens: Option<CodeLensWorkspaceClientCapabilities>, |
| 1349 |
|
| 1350 |
|
| 1351 |
|
| 1352 |
|
| 1353 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1354 |
pub file_operations: Option<WorkspaceFileOperationsClientCapabilities>, |
| 1355 |
|
| 1356 |
|
| 1357 |
|
| 1358 |
|
| 1359 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1360 |
pub inline_value: Option<InlineValueWorkspaceClientCapabilities>, |
| 1361 |
|
| 1362 |
|
| 1363 |
|
| 1364 |
|
| 1365 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1366 |
pub inlay_hint: Option<InlayHintWorkspaceClientCapabilities>, |
| 1367 |
|
| 1368 |
|
| 1369 |
|
| 1370 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1371 |
pub diagnostic: Option<DiagnosticWorkspaceClientCapabilities>, |
| 1372 |
} |
| 1373 |
|
| 1374 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1375 |
#[serde(rename_all = "camelCase")] |
| 1376 |
pub struct TextDocumentSyncClientCapabilities { |
| 1377 |
|
| 1378 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1379 |
pub dynamic_registration: Option<bool>, |
| 1380 |
|
| 1381 |
|
| 1382 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1383 |
pub will_save: Option<bool>, |
| 1384 |
|
| 1385 |
|
| 1386 |
|
| 1387 |
|
| 1388 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1389 |
pub will_save_wait_until: Option<bool>, |
| 1390 |
|
| 1391 |
|
| 1392 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1393 |
pub did_save: Option<bool>, |
| 1394 |
} |
| 1395 |
|
| 1396 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1397 |
#[serde(rename_all = "camelCase")] |
| 1398 |
pub struct PublishDiagnosticsClientCapabilities { |
| 1399 |
|
| 1400 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1401 |
pub related_information: Option<bool>, |
| 1402 |
|
| 1403 |
|
| 1404 |
|
| 1405 |
#[serde( |
| 1406 |
default, |
| 1407 |
skip_serializing_if = "Option::is_none", |
| 1408 |
deserialize_with = "TagSupport::deserialize_compat" |
| 1409 |
)] |
| 1410 |
pub tag_support: Option<TagSupport<DiagnosticTag>>, |
| 1411 |
|
| 1412 |
|
| 1413 |
|
| 1414 |
|
| 1415 |
|
| 1416 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1417 |
pub version_support: Option<bool>, |
| 1418 |
|
| 1419 |
|
| 1420 |
|
| 1421 |
|
| 1422 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1423 |
pub code_description_support: Option<bool>, |
| 1424 |
|
| 1425 |
|
| 1426 |
|
| 1427 |
|
| 1428 |
|
| 1429 |
|
| 1430 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1431 |
pub data_support: Option<bool>, |
| 1432 |
} |
| 1433 |
|
| 1434 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1435 |
#[serde(rename_all = "camelCase")] |
| 1436 |
pub struct TagSupport<T> { |
| 1437 |
|
| 1438 |
pub value_set: Vec<T>, |
| 1439 |
} |
| 1440 |
|
| 1441 |
impl<T> TagSupport<T> { |
| 1442 |
|
| 1443 |
|
| 1444 |
|
| 1445 |
fn deserialize_compat<'de, S>(serializer: S) -> Result<Option<TagSupport<T>>, S::Error> |
| 1446 |
where |
| 1447 |
S: serde::Deserializer<'de>, |
| 1448 |
T: serde::Deserialize<'de>, |
| 1449 |
{ |
| 1450 |
Ok( |
| 1451 |
match Option::<Value>::deserialize(serializer).map_err(serde::de::Error::custom)? { |
| 1452 |
Some(Value::Bool(false)) => None, |
| 1453 |
Some(Value::Bool(true)) => Some(TagSupport { value_set: vec![] }), |
| 1454 |
Some(other) => { |
| 1455 |
Some(TagSupport::<T>::deserialize(other).map_err(serde::de::Error::custom)?) |
| 1456 |
} |
| 1457 |
None => None, |
| 1458 |
}, |
| 1459 |
) |
| 1460 |
} |
| 1461 |
} |
| 1462 |
|
| 1463 |
|
| 1464 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1465 |
#[serde(rename_all = "camelCase")] |
| 1466 |
pub struct TextDocumentClientCapabilities { |
| 1467 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1468 |
pub synchronization: Option<TextDocumentSyncClientCapabilities>, |
| 1469 |
|
| 1470 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1471 |
pub completion: Option<CompletionClientCapabilities>, |
| 1472 |
|
| 1473 |
|
| 1474 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1475 |
pub hover: Option<HoverClientCapabilities>, |
| 1476 |
|
| 1477 |
|
| 1478 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1479 |
pub signature_help: Option<SignatureHelpClientCapabilities>, |
| 1480 |
|
| 1481 |
|
| 1482 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1483 |
pub references: Option<ReferenceClientCapabilities>, |
| 1484 |
|
| 1485 |
|
| 1486 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1487 |
pub document_highlight: Option<DocumentHighlightClientCapabilities>, |
| 1488 |
|
| 1489 |
|
| 1490 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1491 |
pub document_symbol: Option<DocumentSymbolClientCapabilities>, |
| 1492 |
|
| 1493 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1494 |
pub formatting: Option<DocumentFormattingClientCapabilities>, |
| 1495 |
|
| 1496 |
|
| 1497 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1498 |
pub range_formatting: Option<DocumentRangeFormattingClientCapabilities>, |
| 1499 |
|
| 1500 |
|
| 1501 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1502 |
pub on_type_formatting: Option<DocumentOnTypeFormattingClientCapabilities>, |
| 1503 |
|
| 1504 |
|
| 1505 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1506 |
pub declaration: Option<GotoCapability>, |
| 1507 |
|
| 1508 |
|
| 1509 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1510 |
pub definition: Option<GotoCapability>, |
| 1511 |
|
| 1512 |
|
| 1513 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1514 |
pub type_definition: Option<GotoCapability>, |
| 1515 |
|
| 1516 |
|
| 1517 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1518 |
pub implementation: Option<GotoCapability>, |
| 1519 |
|
| 1520 |
|
| 1521 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1522 |
pub code_action: Option<CodeActionClientCapabilities>, |
| 1523 |
|
| 1524 |
|
| 1525 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1526 |
pub code_lens: Option<CodeLensClientCapabilities>, |
| 1527 |
|
| 1528 |
|
| 1529 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1530 |
pub document_link: Option<DocumentLinkClientCapabilities>, |
| 1531 |
|
| 1532 |
|
| 1533 |
|
| 1534 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1535 |
pub color_provider: Option<DocumentColorClientCapabilities>, |
| 1536 |
|
| 1537 |
|
| 1538 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1539 |
pub rename: Option<RenameClientCapabilities>, |
| 1540 |
|
| 1541 |
|
| 1542 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1543 |
pub publish_diagnostics: Option<PublishDiagnosticsClientCapabilities>, |
| 1544 |
|
| 1545 |
|
| 1546 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1547 |
pub folding_range: Option<FoldingRangeClientCapabilities>, |
| 1548 |
|
| 1549 |
|
| 1550 |
|
| 1551 |
|
| 1552 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1553 |
pub selection_range: Option<SelectionRangeClientCapabilities>, |
| 1554 |
|
| 1555 |
|
| 1556 |
|
| 1557 |
|
| 1558 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1559 |
pub linked_editing_range: Option<LinkedEditingRangeClientCapabilities>, |
| 1560 |
|
| 1561 |
|
| 1562 |
|
| 1563 |
|
| 1564 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1565 |
pub call_hierarchy: Option<CallHierarchyClientCapabilities>, |
| 1566 |
|
| 1567 |
|
| 1568 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1569 |
pub semantic_tokens: Option<SemanticTokensClientCapabilities>, |
| 1570 |
|
| 1571 |
|
| 1572 |
|
| 1573 |
|
| 1574 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1575 |
pub moniker: Option<MonikerClientCapabilities>, |
| 1576 |
|
| 1577 |
|
| 1578 |
|
| 1579 |
|
| 1580 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1581 |
pub type_hierarchy: Option<TypeHierarchyClientCapabilities>, |
| 1582 |
|
| 1583 |
|
| 1584 |
|
| 1585 |
|
| 1586 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1587 |
pub inline_value: Option<InlineValueClientCapabilities>, |
| 1588 |
|
| 1589 |
|
| 1590 |
|
| 1591 |
|
| 1592 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1593 |
pub inlay_hint: Option<InlayHintClientCapabilities>, |
| 1594 |
|
| 1595 |
|
| 1596 |
|
| 1597 |
|
| 1598 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1599 |
pub diagnostic: Option<DiagnosticClientCapabilities>, |
| 1600 |
|
| 1601 |
|
| 1602 |
|
| 1603 |
|
| 1604 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1605 |
#[cfg(feature = "proposed")] |
| 1606 |
pub inline_completion: Option<InlineCompletionClientCapabilities>, |
| 1607 |
} |
| 1608 |
|
| 1609 |
|
| 1610 |
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1611 |
#[serde(rename_all = "camelCase")] |
| 1612 |
pub struct ClientCapabilities { |
| 1613 |
|
| 1614 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1615 |
pub workspace: Option<WorkspaceClientCapabilities>, |
| 1616 |
|
| 1617 |
|
| 1618 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1619 |
pub text_document: Option<TextDocumentClientCapabilities>, |
| 1620 |
|
| 1621 |
|
| 1622 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1623 |
pub window: Option<WindowClientCapabilities>, |
| 1624 |
|
| 1625 |
|
| 1626 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1627 |
pub general: Option<GeneralClientCapabilities>, |
| 1628 |
|
| 1629 |
|
| 1630 |
|
| 1631 |
|
| 1632 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1633 |
#[cfg(feature = "proposed")] |
| 1634 |
pub offset_encoding: Option<Vec<String>>, |
| 1635 |
|
| 1636 |
|
| 1637 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1638 |
pub experimental: Option<Value>, |
| 1639 |
} |
| 1640 |
|
| 1641 |
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1642 |
#[serde(rename_all = "camelCase")] |
| 1643 |
pub struct GeneralClientCapabilities { |
| 1644 |
|
| 1645 |
|
| 1646 |
|
| 1647 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1648 |
pub regular_expressions: Option<RegularExpressionsClientCapabilities>, |
| 1649 |
|
| 1650 |
|
| 1651 |
|
| 1652 |
|
| 1653 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1654 |
pub markdown: Option<MarkdownClientCapabilities>, |
| 1655 |
|
| 1656 |
|
| 1657 |
|
| 1658 |
|
| 1659 |
|
| 1660 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1661 |
pub stale_request_support: Option<StaleRequestSupportClientCapabilities>, |
| 1662 |
|
| 1663 |
|
| 1664 |
|
| 1665 |
|
| 1666 |
|
| 1667 |
|
| 1668 |
|
| 1669 |
|
| 1670 |
|
| 1671 |
|
| 1672 |
|
| 1673 |
|
| 1674 |
|
| 1675 |
|
| 1676 |
|
| 1677 |
|
| 1678 |
|
| 1679 |
|
| 1680 |
|
| 1681 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1682 |
pub position_encodings: Option<Vec<PositionEncodingKind>>, |
| 1683 |
} |
| 1684 |
|
| 1685 |
|
| 1686 |
|
| 1687 |
|
| 1688 |
|
| 1689 |
|
| 1690 |
|
| 1691 |
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1692 |
#[serde(rename_all = "camelCase")] |
| 1693 |
pub struct StaleRequestSupportClientCapabilities { |
| 1694 |
|
| 1695 |
pub cancel: bool, |
| 1696 |
|
| 1697 |
|
| 1698 |
|
| 1699 |
|
| 1700 |
pub retry_on_content_modified: Vec<String>, |
| 1701 |
} |
| 1702 |
|
| 1703 |
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1704 |
#[serde(rename_all = "camelCase")] |
| 1705 |
pub struct RegularExpressionsClientCapabilities { |
| 1706 |
|
| 1707 |
pub engine: String, |
| 1708 |
|
| 1709 |
|
| 1710 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1711 |
pub version: Option<String>, |
| 1712 |
} |
| 1713 |
|
| 1714 |
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1715 |
#[serde(rename_all = "camelCase")] |
| 1716 |
pub struct MarkdownClientCapabilities { |
| 1717 |
|
| 1718 |
pub parser: String, |
| 1719 |
|
| 1720 |
|
| 1721 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1722 |
pub version: Option<String>, |
| 1723 |
|
| 1724 |
|
| 1725 |
|
| 1726 |
|
| 1727 |
|
| 1728 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1729 |
pub allowed_tags: Option<Vec<String>>, |
| 1730 |
} |
| 1731 |
|
| 1732 |
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1733 |
#[serde(rename_all = "camelCase")] |
| 1734 |
pub struct InitializeResult { |
| 1735 |
|
| 1736 |
pub capabilities: ServerCapabilities, |
| 1737 |
|
| 1738 |
|
| 1739 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1740 |
pub server_info: Option<ServerInfo>, |
| 1741 |
|
| 1742 |
|
| 1743 |
|
| 1744 |
|
| 1745 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1746 |
#[cfg(feature = "proposed")] |
| 1747 |
pub offset_encoding: Option<String>, |
| 1748 |
} |
| 1749 |
|
| 1750 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1751 |
pub struct ServerInfo { |
| 1752 |
|
| 1753 |
pub name: String, |
| 1754 |
|
| 1755 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1756 |
pub version: Option<String>, |
| 1757 |
} |
| 1758 |
|
| 1759 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1760 |
pub struct InitializeError { |
| 1761 |
|
| 1762 |
|
| 1763 |
|
| 1764 |
|
| 1765 |
|
| 1766 |
pub retry: bool, |
| 1767 |
} |
| 1768 |
|
| 1769 |
|
| 1770 |
|
| 1771 |
|
| 1772 |
#[derive(Eq, PartialEq, Clone, Copy, Deserialize, Serialize)] |
| 1773 |
#[serde(transparent)] |
| 1774 |
pub struct TextDocumentSyncKind(i32); |
| 1775 |
lsp_enum! { |
| 1776 |
impl TextDocumentSyncKind { |
| 1777 |
|
| 1778 |
pub const NONE: TextDocumentSyncKind = TextDocumentSyncKind(0); |
| 1779 |
|
| 1780 |
|
| 1781 |
pub const FULL: TextDocumentSyncKind = TextDocumentSyncKind(1); |
| 1782 |
|
| 1783 |
|
| 1784 |
|
| 1785 |
pub const INCREMENTAL: TextDocumentSyncKind = TextDocumentSyncKind(2); |
| 1786 |
} |
| 1787 |
} |
| 1788 |
|
| 1789 |
pub type ExecuteCommandClientCapabilities = DynamicRegistrationClientCapabilities; |
| 1790 |
|
| 1791 |
|
| 1792 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1793 |
pub struct ExecuteCommandOptions { |
| 1794 |
|
| 1795 |
pub commands: Vec<String>, |
| 1796 |
|
| 1797 |
#[serde(flatten)] |
| 1798 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 1799 |
} |
| 1800 |
|
| 1801 |
|
| 1802 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1803 |
#[serde(rename_all = "camelCase")] |
| 1804 |
pub struct SaveOptions { |
| 1805 |
|
| 1806 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1807 |
pub include_text: Option<bool>, |
| 1808 |
} |
| 1809 |
|
| 1810 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 1811 |
#[serde(untagged)] |
| 1812 |
pub enum TextDocumentSyncSaveOptions { |
| 1813 |
Supported(bool), |
| 1814 |
SaveOptions(SaveOptions), |
| 1815 |
} |
| 1816 |
|
| 1817 |
impl From<SaveOptions> for TextDocumentSyncSaveOptions { |
| 1818 |
fn from(from: SaveOptions) -> Self { |
| 1819 |
Self::SaveOptions(from) |
| 1820 |
} |
| 1821 |
} |
| 1822 |
|
| 1823 |
impl From<bool> for TextDocumentSyncSaveOptions { |
| 1824 |
fn from(from: bool) -> Self { |
| 1825 |
Self::Supported(from) |
| 1826 |
} |
| 1827 |
} |
| 1828 |
|
| 1829 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1830 |
#[serde(rename_all = "camelCase")] |
| 1831 |
pub struct TextDocumentSyncOptions { |
| 1832 |
|
| 1833 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1834 |
pub open_close: Option<bool>, |
| 1835 |
|
| 1836 |
|
| 1837 |
|
| 1838 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1839 |
pub change: Option<TextDocumentSyncKind>, |
| 1840 |
|
| 1841 |
|
| 1842 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1843 |
pub will_save: Option<bool>, |
| 1844 |
|
| 1845 |
|
| 1846 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1847 |
pub will_save_wait_until: Option<bool>, |
| 1848 |
|
| 1849 |
|
| 1850 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1851 |
pub save: Option<TextDocumentSyncSaveOptions>, |
| 1852 |
} |
| 1853 |
|
| 1854 |
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Clone, Deserialize, Serialize)] |
| 1855 |
#[serde(untagged)] |
| 1856 |
pub enum OneOf<A, B> { |
| 1857 |
Left(A), |
| 1858 |
Right(B), |
| 1859 |
} |
| 1860 |
|
| 1861 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 1862 |
#[serde(untagged)] |
| 1863 |
pub enum TextDocumentSyncCapability { |
| 1864 |
Kind(TextDocumentSyncKind), |
| 1865 |
Options(TextDocumentSyncOptions), |
| 1866 |
} |
| 1867 |
|
| 1868 |
impl From<TextDocumentSyncOptions> for TextDocumentSyncCapability { |
| 1869 |
fn from(from: TextDocumentSyncOptions) -> Self { |
| 1870 |
Self::Options(from) |
| 1871 |
} |
| 1872 |
} |
| 1873 |
|
| 1874 |
impl From<TextDocumentSyncKind> for TextDocumentSyncCapability { |
| 1875 |
fn from(from: TextDocumentSyncKind) -> Self { |
| 1876 |
Self::Kind(from) |
| 1877 |
} |
| 1878 |
} |
| 1879 |
|
| 1880 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 1881 |
#[serde(untagged)] |
| 1882 |
pub enum ImplementationProviderCapability { |
| 1883 |
Simple(bool), |
| 1884 |
Options(StaticTextDocumentRegistrationOptions), |
| 1885 |
} |
| 1886 |
|
| 1887 |
impl From<StaticTextDocumentRegistrationOptions> for ImplementationProviderCapability { |
| 1888 |
fn from(from: StaticTextDocumentRegistrationOptions) -> Self { |
| 1889 |
Self::Options(from) |
| 1890 |
} |
| 1891 |
} |
| 1892 |
|
| 1893 |
impl From<bool> for ImplementationProviderCapability { |
| 1894 |
fn from(from: bool) -> Self { |
| 1895 |
Self::Simple(from) |
| 1896 |
} |
| 1897 |
} |
| 1898 |
|
| 1899 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 1900 |
#[serde(untagged)] |
| 1901 |
pub enum TypeDefinitionProviderCapability { |
| 1902 |
Simple(bool), |
| 1903 |
Options(StaticTextDocumentRegistrationOptions), |
| 1904 |
} |
| 1905 |
|
| 1906 |
impl From<StaticTextDocumentRegistrationOptions> for TypeDefinitionProviderCapability { |
| 1907 |
fn from(from: StaticTextDocumentRegistrationOptions) -> Self { |
| 1908 |
Self::Options(from) |
| 1909 |
} |
| 1910 |
} |
| 1911 |
|
| 1912 |
impl From<bool> for TypeDefinitionProviderCapability { |
| 1913 |
fn from(from: bool) -> Self { |
| 1914 |
Self::Simple(from) |
| 1915 |
} |
| 1916 |
} |
| 1917 |
|
| 1918 |
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 1919 |
#[serde(rename_all = "camelCase")] |
| 1920 |
pub struct ServerCapabilities { |
| 1921 |
|
| 1922 |
|
| 1923 |
|
| 1924 |
|
| 1925 |
|
| 1926 |
|
| 1927 |
|
| 1928 |
|
| 1929 |
|
| 1930 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1931 |
pub position_encoding: Option<PositionEncodingKind>, |
| 1932 |
|
| 1933 |
|
| 1934 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1935 |
pub text_document_sync: Option<TextDocumentSyncCapability>, |
| 1936 |
|
| 1937 |
|
| 1938 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1939 |
pub selection_range_provider: Option<SelectionRangeProviderCapability>, |
| 1940 |
|
| 1941 |
|
| 1942 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1943 |
pub hover_provider: Option<HoverProviderCapability>, |
| 1944 |
|
| 1945 |
|
| 1946 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1947 |
pub completion_provider: Option<CompletionOptions>, |
| 1948 |
|
| 1949 |
|
| 1950 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1951 |
pub signature_help_provider: Option<SignatureHelpOptions>, |
| 1952 |
|
| 1953 |
|
| 1954 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1955 |
pub definition_provider: Option<OneOf<bool, DefinitionOptions>>, |
| 1956 |
|
| 1957 |
|
| 1958 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1959 |
pub type_definition_provider: Option<TypeDefinitionProviderCapability>, |
| 1960 |
|
| 1961 |
|
| 1962 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1963 |
pub implementation_provider: Option<ImplementationProviderCapability>, |
| 1964 |
|
| 1965 |
|
| 1966 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1967 |
pub references_provider: Option<OneOf<bool, ReferencesOptions>>, |
| 1968 |
|
| 1969 |
|
| 1970 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1971 |
pub document_highlight_provider: Option<OneOf<bool, DocumentHighlightOptions>>, |
| 1972 |
|
| 1973 |
|
| 1974 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1975 |
pub document_symbol_provider: Option<OneOf<bool, DocumentSymbolOptions>>, |
| 1976 |
|
| 1977 |
|
| 1978 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1979 |
pub workspace_symbol_provider: Option<OneOf<bool, WorkspaceSymbolOptions>>, |
| 1980 |
|
| 1981 |
|
| 1982 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1983 |
pub code_action_provider: Option<CodeActionProviderCapability>, |
| 1984 |
|
| 1985 |
|
| 1986 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1987 |
pub code_lens_provider: Option<CodeLensOptions>, |
| 1988 |
|
| 1989 |
|
| 1990 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1991 |
pub document_formatting_provider: Option<OneOf<bool, DocumentFormattingOptions>>, |
| 1992 |
|
| 1993 |
|
| 1994 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1995 |
pub document_range_formatting_provider: Option<OneOf<bool, DocumentRangeFormattingOptions>>, |
| 1996 |
|
| 1997 |
|
| 1998 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 1999 |
pub document_on_type_formatting_provider: Option<DocumentOnTypeFormattingOptions>, |
| 2000 |
|
| 2001 |
|
| 2002 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2003 |
pub rename_provider: Option<OneOf<bool, RenameOptions>>, |
| 2004 |
|
| 2005 |
|
| 2006 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2007 |
pub document_link_provider: Option<DocumentLinkOptions>, |
| 2008 |
|
| 2009 |
|
| 2010 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2011 |
pub color_provider: Option<ColorProviderCapability>, |
| 2012 |
|
| 2013 |
|
| 2014 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2015 |
pub folding_range_provider: Option<FoldingRangeProviderCapability>, |
| 2016 |
|
| 2017 |
|
| 2018 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2019 |
pub declaration_provider: Option<DeclarationCapability>, |
| 2020 |
|
| 2021 |
|
| 2022 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2023 |
pub execute_command_provider: Option<ExecuteCommandOptions>, |
| 2024 |
|
| 2025 |
|
| 2026 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2027 |
pub workspace: Option<WorkspaceServerCapabilities>, |
| 2028 |
|
| 2029 |
|
| 2030 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2031 |
pub call_hierarchy_provider: Option<CallHierarchyServerCapability>, |
| 2032 |
|
| 2033 |
|
| 2034 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2035 |
pub semantic_tokens_provider: Option<SemanticTokensServerCapabilities>, |
| 2036 |
|
| 2037 |
|
| 2038 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2039 |
pub moniker_provider: Option<OneOf<bool, MonikerServerCapabilities>>, |
| 2040 |
|
| 2041 |
|
| 2042 |
|
| 2043 |
|
| 2044 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2045 |
pub linked_editing_range_provider: Option<LinkedEditingRangeServerCapabilities>, |
| 2046 |
|
| 2047 |
|
| 2048 |
|
| 2049 |
|
| 2050 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2051 |
pub inline_value_provider: Option<OneOf<bool, InlineValueServerCapabilities>>, |
| 2052 |
|
| 2053 |
|
| 2054 |
|
| 2055 |
|
| 2056 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2057 |
pub inlay_hint_provider: Option<OneOf<bool, InlayHintServerCapabilities>>, |
| 2058 |
|
| 2059 |
|
| 2060 |
|
| 2061 |
|
| 2062 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2063 |
pub diagnostic_provider: Option<DiagnosticServerCapabilities>, |
| 2064 |
|
| 2065 |
|
| 2066 |
|
| 2067 |
|
| 2068 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2069 |
#[cfg(feature = "proposed")] |
| 2070 |
pub inline_completion_provider: Option<OneOf<bool, InlineCompletionOptions>>, |
| 2071 |
|
| 2072 |
|
| 2073 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2074 |
pub experimental: Option<Value>, |
| 2075 |
} |
| 2076 |
|
| 2077 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 2078 |
#[serde(rename_all = "camelCase")] |
| 2079 |
pub struct WorkspaceServerCapabilities { |
| 2080 |
|
| 2081 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2082 |
pub workspace_folders: Option<WorkspaceFoldersServerCapabilities>, |
| 2083 |
|
| 2084 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2085 |
pub file_operations: Option<WorkspaceFileOperationsServerCapabilities>, |
| 2086 |
} |
| 2087 |
|
| 2088 |
|
| 2089 |
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] |
| 2090 |
#[serde(rename_all = "camelCase")] |
| 2091 |
pub struct Registration { |
| 2092 |
|
| 2093 |
|
| 2094 |
pub id: String, |
| 2095 |
|
| 2096 |
|
| 2097 |
pub method: String, |
| 2098 |
|
| 2099 |
|
| 2100 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2101 |
pub register_options: Option<Value>, |
| 2102 |
} |
| 2103 |
|
| 2104 |
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] |
| 2105 |
pub struct RegistrationParams { |
| 2106 |
pub registrations: Vec<Registration>, |
| 2107 |
} |
| 2108 |
|
| 2109 |
|
| 2110 |
|
| 2111 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 2112 |
#[serde(rename_all = "camelCase")] |
| 2113 |
pub struct TextDocumentRegistrationOptions { |
| 2114 |
|
| 2115 |
|
| 2116 |
pub document_selector: Option<DocumentSelector>, |
| 2117 |
} |
| 2118 |
|
| 2119 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2120 |
#[serde(untagged)] |
| 2121 |
pub enum DeclarationCapability { |
| 2122 |
Simple(bool), |
| 2123 |
RegistrationOptions(DeclarationRegistrationOptions), |
| 2124 |
Options(DeclarationOptions), |
| 2125 |
} |
| 2126 |
|
| 2127 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2128 |
#[serde(rename_all = "camelCase")] |
| 2129 |
pub struct DeclarationRegistrationOptions { |
| 2130 |
#[serde(flatten)] |
| 2131 |
pub declaration_options: DeclarationOptions, |
| 2132 |
|
| 2133 |
#[serde(flatten)] |
| 2134 |
pub text_document_registration_options: TextDocumentRegistrationOptions, |
| 2135 |
|
| 2136 |
#[serde(flatten)] |
| 2137 |
pub static_registration_options: StaticRegistrationOptions, |
| 2138 |
} |
| 2139 |
|
| 2140 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2141 |
#[serde(rename_all = "camelCase")] |
| 2142 |
pub struct DeclarationOptions { |
| 2143 |
#[serde(flatten)] |
| 2144 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 2145 |
} |
| 2146 |
|
| 2147 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 2148 |
#[serde(rename_all = "camelCase")] |
| 2149 |
pub struct StaticRegistrationOptions { |
| 2150 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2151 |
pub id: Option<String>, |
| 2152 |
} |
| 2153 |
|
| 2154 |
#[derive(Debug, Default, Eq, PartialEq, Clone, Deserialize, Serialize, Copy)] |
| 2155 |
#[serde(rename_all = "camelCase")] |
| 2156 |
pub struct WorkDoneProgressOptions { |
| 2157 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2158 |
pub work_done_progress: Option<bool>, |
| 2159 |
} |
| 2160 |
|
| 2161 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 2162 |
#[serde(rename_all = "camelCase")] |
| 2163 |
pub struct DocumentFormattingOptions { |
| 2164 |
#[serde(flatten)] |
| 2165 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 2166 |
} |
| 2167 |
|
| 2168 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2169 |
#[serde(rename_all = "camelCase")] |
| 2170 |
pub struct DocumentRangeFormattingOptions { |
| 2171 |
#[serde(flatten)] |
| 2172 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 2173 |
} |
| 2174 |
|
| 2175 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2176 |
#[serde(rename_all = "camelCase")] |
| 2177 |
pub struct DefinitionOptions { |
| 2178 |
#[serde(flatten)] |
| 2179 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 2180 |
} |
| 2181 |
|
| 2182 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2183 |
#[serde(rename_all = "camelCase")] |
| 2184 |
pub struct DocumentSymbolOptions { |
| 2185 |
|
| 2186 |
|
| 2187 |
|
| 2188 |
|
| 2189 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2190 |
pub label: Option<String>, |
| 2191 |
|
| 2192 |
#[serde(flatten)] |
| 2193 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 2194 |
} |
| 2195 |
|
| 2196 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2197 |
#[serde(rename_all = "camelCase")] |
| 2198 |
pub struct ReferencesOptions { |
| 2199 |
#[serde(flatten)] |
| 2200 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 2201 |
} |
| 2202 |
|
| 2203 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2204 |
#[serde(rename_all = "camelCase")] |
| 2205 |
pub struct DocumentHighlightOptions { |
| 2206 |
#[serde(flatten)] |
| 2207 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 2208 |
} |
| 2209 |
|
| 2210 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2211 |
#[serde(rename_all = "camelCase")] |
| 2212 |
pub struct WorkspaceSymbolOptions { |
| 2213 |
#[serde(flatten)] |
| 2214 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 2215 |
|
| 2216 |
|
| 2217 |
|
| 2218 |
|
| 2219 |
|
| 2220 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2221 |
pub resolve_provider: Option<bool>, |
| 2222 |
} |
| 2223 |
|
| 2224 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2225 |
#[serde(rename_all = "camelCase")] |
| 2226 |
pub struct StaticTextDocumentRegistrationOptions { |
| 2227 |
|
| 2228 |
|
| 2229 |
pub document_selector: Option<DocumentSelector>, |
| 2230 |
|
| 2231 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2232 |
pub id: Option<String>, |
| 2233 |
} |
| 2234 |
|
| 2235 |
|
| 2236 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2237 |
pub struct Unregistration { |
| 2238 |
|
| 2239 |
|
| 2240 |
pub id: String, |
| 2241 |
|
| 2242 |
|
| 2243 |
pub method: String, |
| 2244 |
} |
| 2245 |
|
| 2246 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2247 |
pub struct UnregistrationParams { |
| 2248 |
pub unregisterations: Vec<Unregistration>, |
| 2249 |
} |
| 2250 |
|
| 2251 |
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] |
| 2252 |
pub struct DidChangeConfigurationParams { |
| 2253 |
|
| 2254 |
pub settings: Value, |
| 2255 |
} |
| 2256 |
|
| 2257 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2258 |
#[serde(rename_all = "camelCase")] |
| 2259 |
pub struct DidOpenTextDocumentParams { |
| 2260 |
|
| 2261 |
pub text_document: TextDocumentItem, |
| 2262 |
} |
| 2263 |
|
| 2264 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2265 |
#[serde(rename_all = "camelCase")] |
| 2266 |
pub struct DidChangeTextDocumentParams { |
| 2267 |
|
| 2268 |
|
| 2269 |
|
| 2270 |
pub text_document: VersionedTextDocumentIdentifier, |
| 2271 |
|
| 2272 |
pub content_changes: Vec<TextDocumentContentChangeEvent>, |
| 2273 |
} |
| 2274 |
|
| 2275 |
|
| 2276 |
|
| 2277 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2278 |
#[serde(rename_all = "camelCase")] |
| 2279 |
pub struct TextDocumentContentChangeEvent { |
| 2280 |
|
| 2281 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2282 |
pub range: Option<Range>, |
| 2283 |
|
| 2284 |
|
| 2285 |
|
| 2286 |
|
| 2287 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2288 |
pub range_length: Option<u32>, |
| 2289 |
|
| 2290 |
|
| 2291 |
pub text: String, |
| 2292 |
} |
| 2293 |
|
| 2294 |
|
| 2295 |
|
| 2296 |
|
| 2297 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2298 |
#[serde(rename_all = "camelCase")] |
| 2299 |
pub struct TextDocumentChangeRegistrationOptions { |
| 2300 |
|
| 2301 |
|
| 2302 |
pub document_selector: Option<DocumentSelector>, |
| 2303 |
|
| 2304 |
|
| 2305 |
|
| 2306 |
pub sync_kind: i32, |
| 2307 |
} |
| 2308 |
|
| 2309 |
|
| 2310 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2311 |
#[serde(rename_all = "camelCase")] |
| 2312 |
pub struct WillSaveTextDocumentParams { |
| 2313 |
|
| 2314 |
pub text_document: TextDocumentIdentifier, |
| 2315 |
|
| 2316 |
|
| 2317 |
pub reason: TextDocumentSaveReason, |
| 2318 |
} |
| 2319 |
|
| 2320 |
|
| 2321 |
#[derive(Copy, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2322 |
#[serde(transparent)] |
| 2323 |
pub struct TextDocumentSaveReason(i32); |
| 2324 |
lsp_enum! { |
| 2325 |
impl TextDocumentSaveReason { |
| 2326 |
|
| 2327 |
|
| 2328 |
pub const MANUAL: TextDocumentSaveReason = TextDocumentSaveReason(1); |
| 2329 |
|
| 2330 |
|
| 2331 |
pub const AFTER_DELAY: TextDocumentSaveReason = TextDocumentSaveReason(2); |
| 2332 |
|
| 2333 |
|
| 2334 |
pub const FOCUS_OUT: TextDocumentSaveReason = TextDocumentSaveReason(3); |
| 2335 |
} |
| 2336 |
} |
| 2337 |
|
| 2338 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2339 |
#[serde(rename_all = "camelCase")] |
| 2340 |
pub struct DidCloseTextDocumentParams { |
| 2341 |
|
| 2342 |
pub text_document: TextDocumentIdentifier, |
| 2343 |
} |
| 2344 |
|
| 2345 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2346 |
#[serde(rename_all = "camelCase")] |
| 2347 |
pub struct DidSaveTextDocumentParams { |
| 2348 |
|
| 2349 |
pub text_document: TextDocumentIdentifier, |
| 2350 |
|
| 2351 |
|
| 2352 |
|
| 2353 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2354 |
pub text: Option<String>, |
| 2355 |
} |
| 2356 |
|
| 2357 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2358 |
#[serde(rename_all = "camelCase")] |
| 2359 |
pub struct TextDocumentSaveRegistrationOptions { |
| 2360 |
|
| 2361 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2362 |
pub include_text: Option<bool>, |
| 2363 |
|
| 2364 |
#[serde(flatten)] |
| 2365 |
pub text_document_registration_options: TextDocumentRegistrationOptions, |
| 2366 |
} |
| 2367 |
|
| 2368 |
#[derive(Debug, Eq, PartialEq, Clone, Copy, Default, Deserialize, Serialize)] |
| 2369 |
#[serde(rename_all = "camelCase")] |
| 2370 |
pub struct DidChangeWatchedFilesClientCapabilities { |
| 2371 |
|
| 2372 |
|
| 2373 |
|
| 2374 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2375 |
pub dynamic_registration: Option<bool>, |
| 2376 |
|
| 2377 |
|
| 2378 |
|
| 2379 |
|
| 2380 |
|
| 2381 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2382 |
pub relative_pattern_support: Option<bool>, |
| 2383 |
} |
| 2384 |
|
| 2385 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2386 |
pub struct DidChangeWatchedFilesParams { |
| 2387 |
|
| 2388 |
pub changes: Vec<FileEvent>, |
| 2389 |
} |
| 2390 |
|
| 2391 |
|
| 2392 |
#[derive(Eq, PartialEq, Hash, Copy, Clone, Deserialize, Serialize)] |
| 2393 |
#[serde(transparent)] |
| 2394 |
pub struct FileChangeType(i32); |
| 2395 |
lsp_enum! { |
| 2396 |
impl FileChangeType { |
| 2397 |
|
| 2398 |
pub const CREATED: FileChangeType = FileChangeType(1); |
| 2399 |
|
| 2400 |
|
| 2401 |
pub const CHANGED: FileChangeType = FileChangeType(2); |
| 2402 |
|
| 2403 |
|
| 2404 |
pub const DELETED: FileChangeType = FileChangeType(3); |
| 2405 |
} |
| 2406 |
} |
| 2407 |
|
| 2408 |
|
| 2409 |
#[derive(Debug, Eq, Hash, PartialEq, Clone, Deserialize, Serialize)] |
| 2410 |
pub struct FileEvent { |
| 2411 |
|
| 2412 |
pub uri: Url, |
| 2413 |
|
| 2414 |
|
| 2415 |
#[serde(rename = "type")] |
| 2416 |
pub typ: FileChangeType, |
| 2417 |
} |
| 2418 |
|
| 2419 |
impl FileEvent { |
| 2420 |
pub fn new(uri: Url, typ: FileChangeType) -> FileEvent { |
| 2421 |
FileEvent { uri, typ } |
| 2422 |
} |
| 2423 |
} |
| 2424 |
|
| 2425 |
|
| 2426 |
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Deserialize, Serialize)] |
| 2427 |
pub struct DidChangeWatchedFilesRegistrationOptions { |
| 2428 |
|
| 2429 |
pub watchers: Vec<FileSystemWatcher>, |
| 2430 |
} |
| 2431 |
|
| 2432 |
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Deserialize, Serialize)] |
| 2433 |
#[serde(rename_all = "camelCase")] |
| 2434 |
pub struct FileSystemWatcher { |
| 2435 |
|
| 2436 |
|
| 2437 |
|
| 2438 |
|
| 2439 |
pub glob_pattern: GlobPattern, |
| 2440 |
|
| 2441 |
|
| 2442 |
|
| 2443 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2444 |
pub kind: Option<WatchKind>, |
| 2445 |
} |
| 2446 |
|
| 2447 |
|
| 2448 |
|
| 2449 |
|
| 2450 |
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Deserialize, Serialize)] |
| 2451 |
#[serde(untagged)] |
| 2452 |
pub enum GlobPattern { |
| 2453 |
String(Pattern), |
| 2454 |
Relative(RelativePattern), |
| 2455 |
} |
| 2456 |
|
| 2457 |
impl From<Pattern> for GlobPattern { |
| 2458 |
#[inline] |
| 2459 |
fn from(from: Pattern) -> Self { |
| 2460 |
Self::String(from) |
| 2461 |
} |
| 2462 |
} |
| 2463 |
|
| 2464 |
impl From<RelativePattern> for GlobPattern { |
| 2465 |
#[inline] |
| 2466 |
fn from(from: RelativePattern) -> Self { |
| 2467 |
Self::Relative(from) |
| 2468 |
} |
| 2469 |
} |
| 2470 |
|
| 2471 |
|
| 2472 |
|
| 2473 |
|
| 2474 |
|
| 2475 |
|
| 2476 |
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Deserialize, Serialize)] |
| 2477 |
#[serde(rename_all = "camelCase")] |
| 2478 |
pub struct RelativePattern { |
| 2479 |
|
| 2480 |
|
| 2481 |
pub base_uri: OneOf<WorkspaceFolder, Url>, |
| 2482 |
|
| 2483 |
|
| 2484 |
pub pattern: Pattern, |
| 2485 |
} |
| 2486 |
|
| 2487 |
|
| 2488 |
|
| 2489 |
|
| 2490 |
|
| 2491 |
|
| 2492 |
pt |
| 2493 |
|
| 2494 |
|
| 2495 |
…) |
| 2496 |
|
| 2497 |
|
| 2498 |
|
| 2499 |
|
| 2500 |
|
| 2501 |
pub type Pattern = String; |
| 2502 |
|
| 2503 |
bitflags! { |
| 2504 |
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] |
| 2505 |
pub struct WatchKind: u8 { |
| 2506 |
|
| 2507 |
const Create = 1; |
| 2508 |
|
| 2509 |
const Change = 2; |
| 2510 |
|
| 2511 |
const Delete = 4; |
| 2512 |
} |
| 2513 |
} |
| 2514 |
|
| 2515 |
impl<'de> serde::Deserialize<'de> for WatchKind { |
| 2516 |
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
| 2517 |
where |
| 2518 |
D: serde::Deserializer<'de>, |
| 2519 |
{ |
| 2520 |
let i = u8::deserialize(deserializer)?; |
| 2521 |
WatchKind::from_bits(i).ok_or_else(|| { |
| 2522 |
D::Error::invalid_value(de::Unexpected::Unsigned(u64::from(i)), &"Unknown flag") |
| 2523 |
}) |
| 2524 |
} |
| 2525 |
} |
| 2526 |
|
| 2527 |
impl serde::Serialize for WatchKind { |
| 2528 |
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> |
| 2529 |
where |
| 2530 |
S: serde::Serializer, |
| 2531 |
{ |
| 2532 |
serializer.serialize_u8(self.bits()) |
| 2533 |
} |
| 2534 |
} |
| 2535 |
|
| 2536 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2537 |
pub struct PublishDiagnosticsParams { |
| 2538 |
|
| 2539 |
pub uri: Url, |
| 2540 |
|
| 2541 |
|
| 2542 |
pub diagnostics: Vec<Diagnostic>, |
| 2543 |
|
| 2544 |
|
| 2545 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2546 |
pub version: Option<i32>, |
| 2547 |
} |
| 2548 |
|
| 2549 |
impl PublishDiagnosticsParams { |
| 2550 |
pub fn new( |
| 2551 |
uri: Url, |
| 2552 |
diagnostics: Vec<Diagnostic>, |
| 2553 |
version: Option<i32>, |
| 2554 |
) -> PublishDiagnosticsParams { |
| 2555 |
PublishDiagnosticsParams { |
| 2556 |
uri, |
| 2557 |
diagnostics, |
| 2558 |
version, |
| 2559 |
} |
| 2560 |
} |
| 2561 |
} |
| 2562 |
|
| 2563 |
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)] |
| 2564 |
#[serde(untagged)] |
| 2565 |
pub enum Documentation { |
| 2566 |
String(String), |
| 2567 |
MarkupContent(MarkupContent), |
| 2568 |
} |
| 2569 |
|
| 2570 |
|
| 2571 |
|
| 2572 |
|
| 2573 |
|
| 2574 |
|
| 2575 |
|
| 2576 |
|
| 2577 |
|
| 2578 |
|
| 2579 |
|
| 2580 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2581 |
#[serde(untagged)] |
| 2582 |
pub enum MarkedString { |
| 2583 |
String(String), |
| 2584 |
LanguageString(LanguageString), |
| 2585 |
} |
| 2586 |
|
| 2587 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2588 |
pub struct LanguageString { |
| 2589 |
pub language: String, |
| 2590 |
pub value: String, |
| 2591 |
} |
| 2592 |
|
| 2593 |
impl MarkedString { |
| 2594 |
pub fn from_markdown(markdown: String) -> MarkedString { |
| 2595 |
MarkedString::String(markdown) |
| 2596 |
} |
| 2597 |
|
| 2598 |
pub fn from_language_code(language: String, code_block: String) -> MarkedString { |
| 2599 |
MarkedString::LanguageString(LanguageString { |
| 2600 |
language, |
| 2601 |
value: code_block, |
| 2602 |
}) |
| 2603 |
} |
| 2604 |
} |
| 2605 |
|
| 2606 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2607 |
#[serde(rename_all = "camelCase")] |
| 2608 |
pub struct GotoDefinitionParams { |
| 2609 |
#[serde(flatten)] |
| 2610 |
pub text_document_position_params: TextDocumentPositionParams, |
| 2611 |
|
| 2612 |
#[serde(flatten)] |
| 2613 |
pub work_done_progress_params: WorkDoneProgressParams, |
| 2614 |
|
| 2615 |
#[serde(flatten)] |
| 2616 |
pub partial_result_params: PartialResultParams, |
| 2617 |
} |
| 2618 |
|
| 2619 |
|
| 2620 |
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] |
| 2621 |
#[serde(untagged)] |
| 2622 |
pub enum GotoDefinitionResponse { |
| 2623 |
Scalar(Location), |
| 2624 |
Array(Vec<Location>), |
| 2625 |
Link(Vec<LocationLink>), |
| 2626 |
} |
| 2627 |
|
| 2628 |
impl From<Location> for GotoDefinitionResponse { |
| 2629 |
fn from(location: Location) -> Self { |
| 2630 |
GotoDefinitionResponse::Scalar(location) |
| 2631 |
} |
| 2632 |
} |
| 2633 |
|
| 2634 |
impl From<Vec<Location>> for GotoDefinitionResponse { |
| 2635 |
fn from(locations: Vec<Location>) -> Self { |
| 2636 |
GotoDefinitionResponse::Array(locations) |
| 2637 |
} |
| 2638 |
} |
| 2639 |
|
| 2640 |
impl From<Vec<LocationLink>> for GotoDefinitionResponse { |
| 2641 |
fn from(locations: Vec<LocationLink>) -> Self { |
| 2642 |
GotoDefinitionResponse::Link(locations) |
| 2643 |
} |
| 2644 |
} |
| 2645 |
|
| 2646 |
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 2647 |
pub struct ExecuteCommandParams { |
| 2648 |
|
| 2649 |
pub command: String, |
| 2650 |
|
| 2651 |
#[serde(default)] |
| 2652 |
pub arguments: Vec<Value>, |
| 2653 |
|
| 2654 |
#[serde(flatten)] |
| 2655 |
pub work_done_progress_params: WorkDoneProgressParams, |
| 2656 |
} |
| 2657 |
|
| 2658 |
|
| 2659 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2660 |
pub struct ExecuteCommandRegistrationOptions { |
| 2661 |
|
| 2662 |
pub commands: Vec<String>, |
| 2663 |
|
| 2664 |
#[serde(flatten)] |
| 2665 |
pub execute_command_options: ExecuteCommandOptions, |
| 2666 |
} |
| 2667 |
|
| 2668 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2669 |
#[serde(rename_all = "camelCase")] |
| 2670 |
pub struct ApplyWorkspaceEditParams { |
| 2671 |
|
| 2672 |
|
| 2673 |
|
| 2674 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2675 |
pub label: Option<String>, |
| 2676 |
|
| 2677 |
|
| 2678 |
pub edit: WorkspaceEdit, |
| 2679 |
} |
| 2680 |
|
| 2681 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2682 |
#[serde(rename_all = "camelCase")] |
| 2683 |
pub struct ApplyWorkspaceEditResponse { |
| 2684 |
|
| 2685 |
pub applied: bool, |
| 2686 |
|
| 2687 |
|
| 2688 |
|
| 2689 |
|
| 2690 |
|
| 2691 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2692 |
pub failure_reason: Option<String>, |
| 2693 |
|
| 2694 |
|
| 2695 |
|
| 2696 |
|
| 2697 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2698 |
pub failed_change: Option<u32>, |
| 2699 |
} |
| 2700 |
|
| 2701 |
|
| 2702 |
|
| 2703 |
|
| 2704 |
|
| 2705 |
|
| 2706 |
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)] |
| 2707 |
#[serde(rename_all = "lowercase")] |
| 2708 |
pub enum MarkupKind { |
| 2709 |
|
| 2710 |
PlainText, |
| 2711 |
|
| 2712 |
Markdown, |
| 2713 |
} |
| 2714 |
|
| 2715 |
|
| 2716 |
|
| 2717 |
|
| 2718 |
|
| 2719 |
|
| 2720 |
|
| 2721 |
|
| 2722 |
|
| 2723 |
|
| 2724 |
|
| 2725 |
|
| 2726 |
|
| 2727 |
|
| 2728 |
|
| 2729 |
|
| 2730 |
|
| 2731 |
|
| 2732 |
|
| 2733 |
|
| 2734 |
|
| 2735 |
|
| 2736 |
|
| 2737 |
|
| 2738 |
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)] |
| 2739 |
pub struct MarkupContent { |
| 2740 |
pub kind: MarkupKind, |
| 2741 |
pub value: String, |
| 2742 |
} |
| 2743 |
|
| 2744 |
|
| 2745 |
#[derive(Debug, Eq, PartialEq, Default, Deserialize, Serialize, Clone)] |
| 2746 |
#[serde(rename_all = "camelCase")] |
| 2747 |
pub struct PartialResultParams { |
| 2748 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 2749 |
pub partial_result_token: Option<ProgressToken>, |
| 2750 |
} |
| 2751 |
|
| 2752 |
|
| 2753 |
|
| 2754 |
|
| 2755 |
#[derive(Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 2756 |
#[serde(transparent)] |
| 2757 |
pub struct SymbolTag(i32); |
| 2758 |
lsp_enum! { |
| 2759 |
impl SymbolTag { |
| 2760 |
|
| 2761 |
pub const DEPRECATED: SymbolTag = SymbolTag(1); |
| 2762 |
} |
| 2763 |
} |
| 2764 |
|
| 2765 |
#[cfg(test)] |
| 2766 |
mod tests { |
| 2767 |
use serde::{Deserialize, Serialize}; |
| 2768 |
|
| 2769 |
use super::*; |
| 2770 |
|
| 2771 |
pub(crate) fn test_serialization<SER>(ms: &SER, expected: &str) |
| 2772 |
where |
| 2773 |
SER: Serialize + for<'de> Deserialize<'de> + PartialEq + std::fmt::Debug, |
| 2774 |
{ |
| 2775 |
let json_str = serde_json::to_string(ms).unwrap(); |
| 2776 |
assert_eq!(&json_str, expected); |
| 2777 |
let deserialized: SER = serde_json::from_str(&json_str).unwrap(); |
| 2778 |
assert_eq!(&deserialized, ms); |
| 2779 |
} |
| 2780 |
|
| 2781 |
pub(crate) fn test_deserialization<T>(json: &str, expected: &T) |
| 2782 |
where |
| 2783 |
T: for<'de> Deserialize<'de> + PartialEq + std::fmt::Debug, |
| 2784 |
{ |
| 2785 |
let value = serde_json::from_str::<T>(json).unwrap(); |
| 2786 |
assert_eq!(&value, expected); |
| 2787 |
} |
| 2788 |
|
| 2789 |
#[test] |
| 2790 |
fn one_of() { |
| 2791 |
test_serialization(&OneOf::<bool, ()>::Left(true), r#"true"#); |
| 2792 |
test_serialization(&OneOf::<String, ()>::Left("abcd".into()), r#""abcd""#); |
| 2793 |
test_serialization( |
| 2794 |
&OneOf::<String, WorkDoneProgressOptions>::Right(WorkDoneProgressOptions { |
| 2795 |
work_done_progress: Some(false), |
| 2796 |
}), |
| 2797 |
r#"{"workDoneProgress":false}"#, |
| 2798 |
); |
| 2799 |
} |
| 2800 |
|
| 2801 |
#[test] |
| 2802 |
fn number_or_string() { |
| 2803 |
test_serialization(&NumberOrString::Number(123), r#"123"#); |
| 2804 |
|
| 2805 |
test_serialization(&NumberOrString::String("abcd".into()), r#""abcd""#); |
| 2806 |
} |
| 2807 |
|
| 2808 |
#[test] |
| 2809 |
fn marked_string() { |
| 2810 |
test_serialization(&MarkedString::from_markdown("xxx".into()), r#""xxx""#); |
| 2811 |
|
| 2812 |
test_serialization( |
| 2813 |
&MarkedString::from_language_code("lang".into(), "code".into()), |
| 2814 |
r#"{"language":"lang","value":"code"}"#, |
| 2815 |
); |
| 2816 |
} |
| 2817 |
|
| 2818 |
#[test] |
| 2819 |
fn language_string() { |
| 2820 |
test_serialization( |
| 2821 |
&LanguageString { |
| 2822 |
language: "LL".into(), |
| 2823 |
value: "VV".into(), |
| 2824 |
}, |
| 2825 |
r#"{"language":"LL","value":"VV"}"#, |
| 2826 |
); |
| 2827 |
} |
| 2828 |
|
| 2829 |
#[test] |
| 2830 |
fn workspace_edit() { |
| 2831 |
test_serialization( |
| 2832 |
&WorkspaceEdit { |
| 2833 |
changes: Some(vec![].into_iter().collect()), |
| 2834 |
document_changes: None, |
| 2835 |
..Default::default() |
| 2836 |
}, |
| 2837 |
r#"{"changes":{}}"#, |
| 2838 |
); |
| 2839 |
|
| 2840 |
test_serialization( |
| 2841 |
&WorkspaceEdit { |
| 2842 |
changes: None, |
| 2843 |
document_changes: None, |
| 2844 |
..Default::default() |
| 2845 |
}, |
| 2846 |
r#"{}"#, |
| 2847 |
); |
| 2848 |
|
| 2849 |
test_serialization( |
| 2850 |
&WorkspaceEdit { |
| 2851 |
changes: Some( |
| 2852 |
vec![(Url::parse("file://test").unwrap(), vec![])] |
| 2853 |
.into_iter() |
| 2854 |
.collect(), |
| 2855 |
), |
| 2856 |
document_changes: None, |
| 2857 |
..Default::default() |
| 2858 |
}, |
| 2859 |
|
| 2860 |
|
| 2861 |
r#"{"changes":{"file://test":[]}}"#, |
| 2862 |
); |
| 2863 |
} |
| 2864 |
|
| 2865 |
#[test] |
| 2866 |
fn root_uri_can_be_missing() { |
| 2867 |
serde_json::from_str::<InitializeParams>(r#"{ "capabilities": {} }"#).unwrap(); |
| 2868 |
} |
| 2869 |
|
| 2870 |
#[test] |
| 2871 |
fn test_watch_kind() { |
| 2872 |
test_serialization(&WatchKind::Create, "1"); |
| 2873 |
test_serialization(&(WatchKind::Create | WatchKind::Change), "3"); |
| 2874 |
test_serialization( |
| 2875 |
&(WatchKind::Create | WatchKind::Change | WatchKind::Delete), |
| 2876 |
"7", |
| 2877 |
); |
| 2878 |
} |
| 2879 |
|
| 2880 |
#[test] |
| 2881 |
fn test_resource_operation_kind() { |
| 2882 |
test_serialization( |
| 2883 |
&vec![ |
| 2884 |
ResourceOperationKind::Create, |
| 2885 |
ResourceOperationKind::Rename, |
| 2886 |
ResourceOperationKind::Delete, |
| 2887 |
], |
| 2888 |
r#"["create","rename","delete"]"#, |
| 2889 |
); |
| 2890 |
} |
| 2891 |
} |