| 1 |
use super::*; |
| 2 |
|
| 3 |
use serde::{de::DeserializeOwned, Serialize}; |
| 4 |
|
| 5 |
pub trait Request { |
| 6 |
type Params: DeserializeOwned + Serialize + Send + Sync + 'static; |
| 7 |
type Result: DeserializeOwned + Serialize + Send + Sync + 'static; |
| 8 |
const METHOD: &'static str; |
| 9 |
} |
| 10 |
|
| 11 |
#[macro_export] |
| 12 |
macro_rules! lsp_request { |
| 13 |
("initialize") => { |
| 14 |
$crate::request::Initialize |
| 15 |
}; |
| 16 |
("shutdown") => { |
| 17 |
$crate::request::Shutdown |
| 18 |
}; |
| 19 |
|
| 20 |
("window/showMessageRequest") => { |
| 21 |
$crate::request::ShowMessageRequest |
| 22 |
}; |
| 23 |
|
| 24 |
("client/registerCapability") => { |
| 25 |
$crate::request::RegisterCapability |
| 26 |
}; |
| 27 |
("client/unregisterCapability") => { |
| 28 |
$crate::request::UnregisterCapability |
| 29 |
}; |
| 30 |
|
| 31 |
("workspace/symbol") => { |
| 32 |
$crate::request::WorkspaceSymbolRequest |
| 33 |
}; |
| 34 |
("workspaceSymbol/resolve") => { |
| 35 |
$crate::request::WorkspaceSymbolResolve |
| 36 |
}; |
| 37 |
("workspace/executeCommand") => { |
| 38 |
$crate::request::ExecuteCommand |
| 39 |
}; |
| 40 |
|
| 41 |
("textDocument/willSaveWaitUntil") => { |
| 42 |
$crate::request::WillSaveWaitUntil |
| 43 |
}; |
| 44 |
|
| 45 |
("textDocument/completion") => { |
| 46 |
$crate::request::Completion |
| 47 |
}; |
| 48 |
("completionItem/resolve") => { |
| 49 |
$crate::request::ResolveCompletionItem |
| 50 |
}; |
| 51 |
("textDocument/hover") => { |
| 52 |
$crate::request::HoverRequest |
| 53 |
}; |
| 54 |
("textDocument/signatureHelp") => { |
| 55 |
$crate::request::SignatureHelpRequest |
| 56 |
}; |
| 57 |
("textDocument/declaration") => { |
| 58 |
$crate::request::GotoDeclaration |
| 59 |
}; |
| 60 |
("textDocument/definition") => { |
| 61 |
$crate::request::GotoDefinition |
| 62 |
}; |
| 63 |
("textDocument/references") => { |
| 64 |
$crate::request::References |
| 65 |
}; |
| 66 |
("textDocument/documentHighlight") => { |
| 67 |
$crate::request::DocumentHighlightRequest |
| 68 |
}; |
| 69 |
("textDocument/documentSymbol") => { |
| 70 |
$crate::request::DocumentSymbolRequest |
| 71 |
}; |
| 72 |
("textDocument/codeAction") => { |
| 73 |
$crate::request::CodeActionRequest |
| 74 |
}; |
| 75 |
("textDocument/codeLens") => { |
| 76 |
$crate::request::CodeLensRequest |
| 77 |
}; |
| 78 |
("codeLens/resolve") => { |
| 79 |
$crate::request::CodeLensResolve |
| 80 |
}; |
| 81 |
("textDocument/documentLink") => { |
| 82 |
$crate::request::DocumentLinkRequest |
| 83 |
}; |
| 84 |
("documentLink/resolve") => { |
| 85 |
$crate::request::DocumentLinkResolve |
| 86 |
}; |
| 87 |
("workspace/applyEdit") => { |
| 88 |
$crate::request::ApplyWorkspaceEdit |
| 89 |
}; |
| 90 |
("textDocument/rangeFormatting") => { |
| 91 |
$crate::request::RangeFormatting |
| 92 |
}; |
| 93 |
("textDocument/onTypeFormatting") => { |
| 94 |
$crate::request::OnTypeFormatting |
| 95 |
}; |
| 96 |
("textDocument/formatting") => { |
| 97 |
$crate::request::Formatting |
| 98 |
}; |
| 99 |
("textDocument/rename") => { |
| 100 |
$crate::request::Rename |
| 101 |
}; |
| 102 |
("textDocument/documentColor") => { |
| 103 |
$crate::request::DocumentColor |
| 104 |
}; |
| 105 |
("textDocument/colorPresentation") => { |
| 106 |
$crate::request::ColorPresentationRequest |
| 107 |
}; |
| 108 |
("textDocument/foldingRange") => { |
| 109 |
$crate::request::FoldingRangeRequest |
| 110 |
}; |
| 111 |
("textDocument/prepareRename") => { |
| 112 |
$crate::request::PrepareRenameRequest |
| 113 |
}; |
| 114 |
("textDocument/implementation") => { |
| 115 |
$crate::request::GotoImplementation |
| 116 |
}; |
| 117 |
("textDocument/typeDefinition") => { |
| 118 |
$crate::request::GotoTypeDefinition |
| 119 |
}; |
| 120 |
("textDocument/selectionRange") => { |
| 121 |
$crate::request::SelectionRangeRequest |
| 122 |
}; |
| 123 |
("workspace/workspaceFolders") => { |
| 124 |
$crate::request::WorkspaceFoldersRequest |
| 125 |
}; |
| 126 |
("workspace/configuration") => { |
| 127 |
$crate::request::WorkspaceConfiguration |
| 128 |
}; |
| 129 |
("window/workDoneProgress/create") => { |
| 130 |
$crate::request::WorkDoneProgressCreate |
| 131 |
}; |
| 132 |
("callHierarchy/incomingCalls") => { |
| 133 |
$crate::request::CallHierarchyIncomingCalls |
| 134 |
}; |
| 135 |
("callHierarchy/outgoingCalls") => { |
| 136 |
$crate::request::CallHierarchyOutgoingCalls |
| 137 |
}; |
| 138 |
("textDocument/moniker") => { |
| 139 |
$crate::request::MonikerRequest |
| 140 |
}; |
| 141 |
("textDocument/linkedEditingRange") => { |
| 142 |
$crate::request::LinkedEditingRange |
| 143 |
}; |
| 144 |
("textDocument/prepareCallHierarchy") => { |
| 145 |
$crate::request::CallHierarchyPrepare |
| 146 |
}; |
| 147 |
("textDocument/prepareTypeHierarchy") => { |
| 148 |
$crate::request::TypeHierarchyPrepare |
| 149 |
}; |
| 150 |
("textDocument/semanticTokens/full") => { |
| 151 |
$crate::request::SemanticTokensFullRequest |
| 152 |
}; |
| 153 |
("textDocument/semanticTokens/full/delta") => { |
| 154 |
$crate::request::SemanticTokensFullDeltaRequest |
| 155 |
}; |
| 156 |
("textDocument/semanticTokens/range") => { |
| 157 |
$crate::request::SemanticTokensRangeRequest |
| 158 |
}; |
| 159 |
("textDocument/inlayHint") => { |
| 160 |
$crate::request::InlayHintRequest |
| 161 |
}; |
| 162 |
("textDocument/inlineValue") => { |
| 163 |
$crate::request::InlineValueRequest |
| 164 |
}; |
| 165 |
("textDocument/diagnostic") => { |
| 166 |
$crate::request::DocumentDiagnosticRequest |
| 167 |
}; |
| 168 |
("workspace/diagnostic") => { |
| 169 |
$crate::request::WorkspaceDiagnosticRequest |
| 170 |
}; |
| 171 |
("workspace/diagnostic/refresh") => { |
| 172 |
$crate::request::WorkspaceDiagnosticRefresh |
| 173 |
}; |
| 174 |
("typeHierarchy/supertypes") => { |
| 175 |
$crate::request::TypeHierarchySupertypes |
| 176 |
}; |
| 177 |
("typeHierarchy/subtypes") => { |
| 178 |
$crate::request::TypeHierarchySubtypes |
| 179 |
}; |
| 180 |
("workspace/willCreateFiles") => { |
| 181 |
$crate::request::WillCreateFiles |
| 182 |
}; |
| 183 |
("workspace/willRenameFiles") => { |
| 184 |
$crate::request::WillRenameFiles |
| 185 |
}; |
| 186 |
("workspace/willDeleteFiles") => { |
| 187 |
$crate::request::WillDeleteFiles |
| 188 |
}; |
| 189 |
("workspace/semanticTokens/refresh") => { |
| 190 |
$crate::request::SemanticTokensRefresh |
| 191 |
}; |
| 192 |
("workspace/codeLens/refresh") => { |
| 193 |
$crate::request::CodeLensRefresh |
| 194 |
}; |
| 195 |
("workspace/inlayHint/refresh") => { |
| 196 |
$crate::request::InlayHintRefreshRequest |
| 197 |
}; |
| 198 |
("workspace/inlineValue/refresh") => { |
| 199 |
$crate::request::InlineValueRefreshRequest |
| 200 |
}; |
| 201 |
("codeAction/resolve") => { |
| 202 |
$crate::request::CodeActionResolveRequest |
| 203 |
}; |
| 204 |
("inlayHint/resolve") => { |
| 205 |
$crate::request::InlayHintResolveRequest |
| 206 |
}; |
| 207 |
("window/showDocument") => { |
| 208 |
$crate::request::ShowDocument |
| 209 |
}; |
| 210 |
} |
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
#[derive(Debug)] |
| 218 |
pub enum Initialize {} |
| 219 |
|
| 220 |
impl Request for Initialize { |
| 221 |
type Params = InitializeParams; |
| 222 |
type Result = InitializeResult; |
| 223 |
const METHOD: &'static str = "initialize"; |
| 224 |
} |
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
#[derive(Debug)] |
| 230 |
pub enum Shutdown {} |
| 231 |
|
| 232 |
impl Request for Shutdown { |
| 233 |
type Params = (); |
| 234 |
type Result = (); |
| 235 |
const METHOD: &'static str = "shutdown"; |
| 236 |
} |
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
#[derive(Debug)] |
| 242 |
pub enum ShowMessageRequest {} |
| 243 |
|
| 244 |
impl Request for ShowMessageRequest { |
| 245 |
type Params = ShowMessageRequestParams; |
| 246 |
type Result = Option<MessageActionItem>; |
| 247 |
const METHOD: &'static str = "window/showMessageRequest"; |
| 248 |
} |
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
#[derive(Debug)] |
| 254 |
pub enum RegisterCapability {} |
| 255 |
|
| 256 |
impl Request for RegisterCapability { |
| 257 |
type Params = RegistrationParams; |
| 258 |
type Result = (); |
| 259 |
const METHOD: &'static str = "client/registerCapability"; |
| 260 |
} |
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
#[derive(Debug)] |
| 265 |
pub enum UnregisterCapability {} |
| 266 |
|
| 267 |
impl Request for UnregisterCapability { |
| 268 |
type Params = UnregistrationParams; |
| 269 |
type Result = (); |
| 270 |
const METHOD: &'static str = "client/unregisterCapability"; |
| 271 |
} |
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
ms |
| 278 |
e’ |
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
#[derive(Debug)] |
| 284 |
pub enum Completion {} |
| 285 |
|
| 286 |
impl Request for Completion { |
| 287 |
type Params = CompletionParams; |
| 288 |
type Result = Option<CompletionResponse>; |
| 289 |
const METHOD: &'static str = "textDocument/completion"; |
| 290 |
} |
| 291 |
|
| 292 |
|
| 293 |
#[derive(Debug)] |
| 294 |
pub enum ResolveCompletionItem {} |
| 295 |
|
| 296 |
impl Request for ResolveCompletionItem { |
| 297 |
type Params = CompletionItem; |
| 298 |
type Result = CompletionItem; |
| 299 |
const METHOD: &'static str = "completionItem/resolve"; |
| 300 |
} |
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
#[derive(Debug)] |
| 305 |
pub enum HoverRequest {} |
| 306 |
|
| 307 |
impl Request for HoverRequest { |
| 308 |
type Params = HoverParams; |
| 309 |
type Result = Option<Hover>; |
| 310 |
const METHOD: &'static str = "textDocument/hover"; |
| 311 |
} |
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
#[derive(Debug)] |
| 316 |
pub enum SignatureHelpRequest {} |
| 317 |
|
| 318 |
impl Request for SignatureHelpRequest { |
| 319 |
type Params = SignatureHelpParams; |
| 320 |
type Result = Option<SignatureHelp>; |
| 321 |
const METHOD: &'static str = "textDocument/signatureHelp"; |
| 322 |
} |
| 323 |
|
| 324 |
#[derive(Debug)] |
| 325 |
pub enum GotoDeclaration {} |
| 326 |
pub type GotoDeclarationParams = GotoDefinitionParams; |
| 327 |
pub type GotoDeclarationResponse = GotoDefinitionResponse; |
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
impl Request for GotoDeclaration { |
| 332 |
type Params = GotoDeclarationParams; |
| 333 |
type Result = Option<GotoDeclarationResponse>; |
| 334 |
const METHOD: &'static str = "textDocument/declaration"; |
| 335 |
} |
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
#[derive(Debug)] |
| 340 |
pub enum GotoDefinition {} |
| 341 |
|
| 342 |
impl Request for GotoDefinition { |
| 343 |
type Params = GotoDefinitionParams; |
| 344 |
type Result = Option<GotoDefinitionResponse>; |
| 345 |
const METHOD: &'static str = "textDocument/definition"; |
| 346 |
} |
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
#[derive(Debug)] |
| 351 |
pub enum References {} |
| 352 |
|
| 353 |
impl Request for References { |
| 354 |
type Params = ReferenceParams; |
| 355 |
type Result = Option<Vec<Location>>; |
| 356 |
const METHOD: &'static str = "textDocument/references"; |
| 357 |
} |
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
#[derive(Debug)] |
| 363 |
pub enum GotoTypeDefinition {} |
| 364 |
|
| 365 |
pub type GotoTypeDefinitionParams = GotoDefinitionParams; |
| 366 |
pub type GotoTypeDefinitionResponse = GotoDefinitionResponse; |
| 367 |
|
| 368 |
impl Request for GotoTypeDefinition { |
| 369 |
type Params = GotoTypeDefinitionParams; |
| 370 |
type Result = Option<GotoTypeDefinitionResponse>; |
| 371 |
const METHOD: &'static str = "textDocument/typeDefinition"; |
| 372 |
} |
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
#[derive(Debug)] |
| 378 |
pub enum GotoImplementation {} |
| 379 |
|
| 380 |
pub type GotoImplementationParams = GotoTypeDefinitionParams; |
| 381 |
pub type GotoImplementationResponse = GotoDefinitionResponse; |
| 382 |
|
| 383 |
impl Request for GotoImplementation { |
| 384 |
type Params = GotoImplementationParams; |
| 385 |
type Result = Option<GotoImplementationResponse>; |
| 386 |
const METHOD: &'static str = "textDocument/implementation"; |
| 387 |
} |
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
#[derive(Debug)] |
| 397 |
pub enum DocumentHighlightRequest {} |
| 398 |
|
| 399 |
impl Request for DocumentHighlightRequest { |
| 400 |
type Params = DocumentHighlightParams; |
| 401 |
type Result = Option<Vec<DocumentHighlight>>; |
| 402 |
const METHOD: &'static str = "textDocument/documentHighlight"; |
| 403 |
} |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
#[derive(Debug)] |
| 408 |
pub enum DocumentSymbolRequest {} |
| 409 |
|
| 410 |
impl Request for DocumentSymbolRequest { |
| 411 |
type Params = DocumentSymbolParams; |
| 412 |
type Result = Option<DocumentSymbolResponse>; |
| 413 |
const METHOD: &'static str = "textDocument/documentSymbol"; |
| 414 |
} |
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
#[derive(Debug)] |
| 419 |
pub enum WorkspaceSymbolRequest {} |
| 420 |
|
| 421 |
impl Request for WorkspaceSymbolRequest { |
| 422 |
type Params = WorkspaceSymbolParams; |
| 423 |
type Result = Option<WorkspaceSymbolResponse>; |
| 424 |
const METHOD: &'static str = "workspace/symbol"; |
| 425 |
} |
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
#[derive(Debug)] |
| 430 |
pub enum WorkspaceSymbolResolve {} |
| 431 |
|
| 432 |
impl Request for WorkspaceSymbolResolve { |
| 433 |
type Params = WorkspaceSymbol; |
| 434 |
type Result = WorkspaceSymbol; |
| 435 |
const METHOD: &'static str = "workspaceSymbol/resolve"; |
| 436 |
} |
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
#[derive(Debug)] |
| 442 |
pub enum ExecuteCommand {} |
| 443 |
|
| 444 |
impl Request for ExecuteCommand { |
| 445 |
type Params = ExecuteCommandParams; |
| 446 |
type Result = Option<Value>; |
| 447 |
const METHOD: &'static str = "workspace/executeCommand"; |
| 448 |
} |
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
#[derive(Debug)] |
| 456 |
pub enum WillSaveWaitUntil {} |
| 457 |
|
| 458 |
impl Request for WillSaveWaitUntil { |
| 459 |
type Params = WillSaveTextDocumentParams; |
| 460 |
type Result = Option<Vec<TextEdit>>; |
| 461 |
const METHOD: &'static str = "textDocument/willSaveWaitUntil"; |
| 462 |
} |
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
#[derive(Debug)] |
| 467 |
pub enum ApplyWorkspaceEdit {} |
| 468 |
|
| 469 |
impl Request for ApplyWorkspaceEdit { |
| 470 |
type Params = ApplyWorkspaceEditParams; |
| 471 |
type Result = ApplyWorkspaceEditResponse; |
| 472 |
const METHOD: &'static str = "workspace/applyEdit"; |
| 473 |
} |
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
to |
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
a |
| 487 |
|
| 488 |
#[derive(Debug)] |
| 489 |
pub enum WorkspaceConfiguration {} |
| 490 |
|
| 491 |
impl Request for WorkspaceConfiguration { |
| 492 |
type Params = ConfigurationParams; |
| 493 |
type Result = Vec<Value>; |
| 494 |
const METHOD: &'static str = "workspace/configuration"; |
| 495 |
} |
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
#[derive(Debug)] |
| 501 |
pub enum CodeActionRequest {} |
| 502 |
|
| 503 |
impl Request for CodeActionRequest { |
| 504 |
type Params = CodeActionParams; |
| 505 |
type Result = Option<CodeActionResponse>; |
| 506 |
const METHOD: &'static str = "textDocument/codeAction"; |
| 507 |
} |
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
#[derive(Debug)] |
| 515 |
pub enum CodeActionResolveRequest {} |
| 516 |
|
| 517 |
impl Request for CodeActionResolveRequest { |
| 518 |
type Params = CodeAction; |
| 519 |
type Result = CodeAction; |
| 520 |
const METHOD: &'static str = "codeAction/resolve"; |
| 521 |
} |
| 522 |
|
| 523 |
|
| 524 |
#[derive(Debug)] |
| 525 |
pub enum CodeLensRequest {} |
| 526 |
|
| 527 |
impl Request for CodeLensRequest { |
| 528 |
type Params = CodeLensParams; |
| 529 |
type Result = Option<Vec<CodeLens>>; |
| 530 |
const METHOD: &'static str = "textDocument/codeLens"; |
| 531 |
} |
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
#[derive(Debug)] |
| 536 |
pub enum CodeLensResolve {} |
| 537 |
|
| 538 |
impl Request for CodeLensResolve { |
| 539 |
type Params = CodeLens; |
| 540 |
type Result = CodeLens; |
| 541 |
const METHOD: &'static str = "codeLens/resolve"; |
| 542 |
} |
| 543 |
|
| 544 |
|
| 545 |
#[derive(Debug)] |
| 546 |
pub enum DocumentLinkRequest {} |
| 547 |
|
| 548 |
impl Request for DocumentLinkRequest { |
| 549 |
type Params = DocumentLinkParams; |
| 550 |
type Result = Option<Vec<DocumentLink>>; |
| 551 |
const METHOD: &'static str = "textDocument/documentLink"; |
| 552 |
} |
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
#[derive(Debug)] |
| 557 |
pub enum DocumentLinkResolve {} |
| 558 |
|
| 559 |
impl Request for DocumentLinkResolve { |
| 560 |
type Params = DocumentLink; |
| 561 |
type Result = DocumentLink; |
| 562 |
const METHOD: &'static str = "documentLink/resolve"; |
| 563 |
} |
| 564 |
|
| 565 |
|
| 566 |
#[derive(Debug)] |
| 567 |
pub enum Formatting {} |
| 568 |
|
| 569 |
impl Request for Formatting { |
| 570 |
type Params = DocumentFormattingParams; |
| 571 |
type Result = Option<Vec<TextEdit>>; |
| 572 |
const METHOD: &'static str = "textDocument/formatting"; |
| 573 |
} |
| 574 |
|
| 575 |
|
| 576 |
#[derive(Debug)] |
| 577 |
pub enum RangeFormatting {} |
| 578 |
|
| 579 |
impl Request for RangeFormatting { |
| 580 |
type Params = DocumentRangeFormattingParams; |
| 581 |
type Result = Option<Vec<TextEdit>>; |
| 582 |
const METHOD: &'static str = "textDocument/rangeFormatting"; |
| 583 |
} |
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
#[derive(Debug)] |
| 588 |
pub enum OnTypeFormatting {} |
| 589 |
|
| 590 |
impl Request for OnTypeFormatting { |
| 591 |
type Params = DocumentOnTypeFormattingParams; |
| 592 |
type Result = Option<Vec<TextEdit>>; |
| 593 |
const METHOD: &'static str = "textDocument/onTypeFormatting"; |
| 594 |
} |
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
d. |
| 601 |
#[derive(Debug)] |
| 602 |
pub enum LinkedEditingRange {} |
| 603 |
|
| 604 |
impl Request for LinkedEditingRange { |
| 605 |
type Params = LinkedEditingRangeParams; |
| 606 |
type Result = Option<LinkedEditingRanges>; |
| 607 |
const METHOD: &'static str = "textDocument/linkedEditingRange"; |
| 608 |
} |
| 609 |
|
| 610 |
|
| 611 |
#[derive(Debug)] |
| 612 |
pub enum Rename {} |
| 613 |
|
| 614 |
impl Request for Rename { |
| 615 |
type Params = RenameParams; |
| 616 |
type Result = Option<WorkspaceEdit>; |
| 617 |
const METHOD: &'static str = "textDocument/rename"; |
| 618 |
} |
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
#[derive(Debug)] |
| 623 |
pub enum DocumentColor {} |
| 624 |
|
| 625 |
impl Request for DocumentColor { |
| 626 |
type Params = DocumentColorParams; |
| 627 |
type Result = Vec<ColorInformation>; |
| 628 |
const METHOD: &'static str = "textDocument/documentColor"; |
| 629 |
} |
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
#[derive(Debug)] |
| 634 |
pub enum ColorPresentationRequest {} |
| 635 |
|
| 636 |
impl Request for ColorPresentationRequest { |
| 637 |
type Params = ColorPresentationParams; |
| 638 |
type Result = Vec<ColorPresentation>; |
| 639 |
const METHOD: &'static str = "textDocument/colorPresentation"; |
| 640 |
} |
| 641 |
|
| 642 |
|
| 643 |
#[derive(Debug)] |
| 644 |
pub enum FoldingRangeRequest {} |
| 645 |
|
| 646 |
impl Request for FoldingRangeRequest { |
| 647 |
type Params = FoldingRangeParams; |
| 648 |
type Result = Option<Vec<FoldingRange>>; |
| 649 |
const METHOD: &'static str = "textDocument/foldingRange"; |
| 650 |
} |
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
#[derive(Debug)] |
| 655 |
pub enum PrepareRenameRequest {} |
| 656 |
|
| 657 |
impl Request for PrepareRenameRequest { |
| 658 |
type Params = TextDocumentPositionParams; |
| 659 |
type Result = Option<PrepareRenameResponse>; |
| 660 |
const METHOD: &'static str = "textDocument/prepareRename"; |
| 661 |
} |
| 662 |
|
| 663 |
#[derive(Debug)] |
| 664 |
#[cfg(feature = "proposed")] |
| 665 |
pub enum InlineCompletionRequest {} |
| 666 |
|
| 667 |
#[cfg(feature = "proposed")] |
| 668 |
impl Request for InlineCompletionRequest { |
| 669 |
type Params = InlineCompletionParams; |
| 670 |
type Result = Option<InlineCompletionResponse>; |
| 671 |
const METHOD: &'static str = "textDocument/inlineCompletion"; |
| 672 |
} |
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
#[derive(Debug)] |
| 678 |
pub enum WorkspaceFoldersRequest {} |
| 679 |
|
| 680 |
impl Request for WorkspaceFoldersRequest { |
| 681 |
type Params = (); |
| 682 |
type Result = Option<Vec<WorkspaceFolder>>; |
| 683 |
const METHOD: &'static str = "workspace/workspaceFolders"; |
| 684 |
} |
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
#[derive(Debug)] |
| 689 |
pub enum WorkDoneProgressCreate {} |
| 690 |
|
| 691 |
impl Request for WorkDoneProgressCreate { |
| 692 |
type Params = WorkDoneProgressCreateParams; |
| 693 |
type Result = (); |
| 694 |
const METHOD: &'static str = "window/workDoneProgress/create"; |
| 695 |
} |
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
pub enum SelectionRangeRequest {} |
| 707 |
|
| 708 |
impl Request for SelectionRangeRequest { |
| 709 |
type Params = SelectionRangeParams; |
| 710 |
type Result = Option<Vec<SelectionRange>>; |
| 711 |
const METHOD: &'static str = "textDocument/selectionRange"; |
| 712 |
} |
| 713 |
|
| 714 |
pub enum CallHierarchyPrepare {} |
| 715 |
|
| 716 |
impl Request for CallHierarchyPrepare { |
| 717 |
type Params = CallHierarchyPrepareParams; |
| 718 |
type Result = Option<Vec<CallHierarchyItem>>; |
| 719 |
const METHOD: &'static str = "textDocument/prepareCallHierarchy"; |
| 720 |
} |
| 721 |
|
| 722 |
pub enum CallHierarchyIncomingCalls {} |
| 723 |
|
| 724 |
impl Request for CallHierarchyIncomingCalls { |
| 725 |
type Params = CallHierarchyIncomingCallsParams; |
| 726 |
type Result = Option<Vec<CallHierarchyIncomingCall>>; |
| 727 |
const METHOD: &'static str = "callHierarchy/incomingCalls"; |
| 728 |
} |
| 729 |
|
| 730 |
pub enum CallHierarchyOutgoingCalls {} |
| 731 |
|
| 732 |
impl Request for CallHierarchyOutgoingCalls { |
| 733 |
type Params = CallHierarchyOutgoingCallsParams; |
| 734 |
type Result = Option<Vec<CallHierarchyOutgoingCall>>; |
| 735 |
const METHOD: &'static str = "callHierarchy/outgoingCalls"; |
| 736 |
} |
| 737 |
|
| 738 |
pub enum SemanticTokensFullRequest {} |
| 739 |
|
| 740 |
impl Request for SemanticTokensFullRequest { |
| 741 |
type Params = SemanticTokensParams; |
| 742 |
type Result = Option<SemanticTokensResult>; |
| 743 |
const METHOD: &'static str = "textDocument/semanticTokens/full"; |
| 744 |
} |
| 745 |
|
| 746 |
pub enum SemanticTokensFullDeltaRequest {} |
| 747 |
|
| 748 |
impl Request for SemanticTokensFullDeltaRequest { |
| 749 |
type Params = SemanticTokensDeltaParams; |
| 750 |
type Result = Option<SemanticTokensFullDeltaResult>; |
| 751 |
const METHOD: &'static str = "textDocument/semanticTokens/full/delta"; |
| 752 |
} |
| 753 |
|
| 754 |
pub enum SemanticTokensRangeRequest {} |
| 755 |
|
| 756 |
impl Request for SemanticTokensRangeRequest { |
| 757 |
type Params = SemanticTokensRangeParams; |
| 758 |
type Result = Option<SemanticTokensRangeResult>; |
| 759 |
const METHOD: &'static str = "textDocument/semanticTokens/range"; |
| 760 |
} |
| 761 |
|
| 762 |
|
| 763 |
|
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
pub enum SemanticTokensRefresh {} |
| 768 |
|
| 769 |
impl Request for SemanticTokensRefresh { |
| 770 |
type Params = (); |
| 771 |
type Result = (); |
| 772 |
const METHOD: &'static str = "workspace/semanticTokens/refresh"; |
| 773 |
} |
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
pub enum CodeLensRefresh {} |
| 781 |
|
| 782 |
impl Request for CodeLensRefresh { |
| 783 |
type Params = (); |
| 784 |
type Result = (); |
| 785 |
const METHOD: &'static str = "workspace/codeLens/refresh"; |
| 786 |
} |
| 787 |
|
| 788 |
|
| 789 |
pub enum WillCreateFiles {} |
| 790 |
|
| 791 |
impl Request for WillCreateFiles { |
| 792 |
type Params = CreateFilesParams; |
| 793 |
type Result = Option<WorkspaceEdit>; |
| 794 |
const METHOD: &'static str = "workspace/willCreateFiles"; |
| 795 |
} |
| 796 |
|
| 797 |
|
| 798 |
pub enum WillRenameFiles {} |
| 799 |
|
| 800 |
impl Request for WillRenameFiles { |
| 801 |
type Params = RenameFilesParams; |
| 802 |
type Result = Option<WorkspaceEdit>; |
| 803 |
const METHOD: &'static str = "workspace/willRenameFiles"; |
| 804 |
} |
| 805 |
|
| 806 |
|
| 807 |
pub enum WillDeleteFiles {} |
| 808 |
|
| 809 |
impl Request for WillDeleteFiles { |
| 810 |
type Params = DeleteFilesParams; |
| 811 |
type Result = Option<WorkspaceEdit>; |
| 812 |
const METHOD: &'static str = "workspace/willDeleteFiles"; |
| 813 |
} |
| 814 |
|
| 815 |
|
| 816 |
pub enum ShowDocument {} |
| 817 |
|
| 818 |
impl Request for ShowDocument { |
| 819 |
type Params = ShowDocumentParams; |
| 820 |
type Result = ShowDocumentResult; |
| 821 |
const METHOD: &'static str = "window/showDocument"; |
| 822 |
} |
| 823 |
|
| 824 |
pub enum MonikerRequest {} |
| 825 |
|
| 826 |
impl Request for MonikerRequest { |
| 827 |
type Params = MonikerParams; |
| 828 |
type Result = Option<Vec<Moniker>>; |
| 829 |
const METHOD: &'static str = "textDocument/moniker"; |
| 830 |
} |
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
pub enum InlayHintRequest {} |
| 835 |
|
| 836 |
impl Request for InlayHintRequest { |
| 837 |
type Params = InlayHintParams; |
| 838 |
type Result = Option<Vec<InlayHint>>; |
| 839 |
const METHOD: &'static str = "textDocument/inlayHint"; |
| 840 |
} |
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
he |
| 845 |
|
| 846 |
pub enum InlayHintResolveRequest {} |
| 847 |
|
| 848 |
impl Request for InlayHintResolveRequest { |
| 849 |
type Params = InlayHint; |
| 850 |
type Result = InlayHint; |
| 851 |
const METHOD: &'static str = "inlayHint/resolve"; |
| 852 |
} |
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
pub enum InlayHintRefreshRequest {} |
| 861 |
|
| 862 |
impl Request for InlayHintRefreshRequest { |
| 863 |
type Params = (); |
| 864 |
type Result = (); |
| 865 |
const METHOD: &'static str = "workspace/inlayHint/refresh"; |
| 866 |
} |
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
pub enum InlineValueRequest {} |
| 871 |
|
| 872 |
impl Request for InlineValueRequest { |
| 873 |
type Params = InlineValueParams; |
| 874 |
type Result = Option<InlineValue>; |
| 875 |
const METHOD: &'static str = "textDocument/inlineValue"; |
| 876 |
} |
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
pub enum InlineValueRefreshRequest {} |
| 885 |
|
| 886 |
impl Request for InlineValueRefreshRequest { |
| 887 |
type Params = (); |
| 888 |
type Result = (); |
| 889 |
const METHOD: &'static str = "workspace/inlineValue/refresh"; |
| 890 |
} |
| 891 |
|
| 892 |
|
| 893 |
|
| 894 |
|
| 895 |
#[derive(Debug)] |
| 896 |
pub enum DocumentDiagnosticRequest {} |
| 897 |
|
| 898 |
impl Request for DocumentDiagnosticRequest { |
| 899 |
type Params = DocumentDiagnosticParams; |
| 900 |
type Result = DocumentDiagnosticReportResult; |
| 901 |
const METHOD: &'static str = "textDocument/diagnostic"; |
| 902 |
} |
| 903 |
|
| 904 |
|
| 905 |
|
| 906 |
|
| 907 |
|
| 908 |
|
| 909 |
|
| 910 |
#[derive(Debug)] |
| 911 |
pub enum WorkspaceDiagnosticRequest {} |
| 912 |
|
| 913 |
impl Request for WorkspaceDiagnosticRequest { |
| 914 |
type Params = WorkspaceDiagnosticParams; |
| 915 |
const METHOD: &'static str = "workspace/diagnostic"; |
| 916 |
type Result = WorkspaceDiagnosticReportResult; |
| 917 |
} |
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
|
| 922 |
|
| 923 |
#[derive(Debug)] |
| 924 |
pub enum WorkspaceDiagnosticRefresh {} |
| 925 |
|
| 926 |
impl Request for WorkspaceDiagnosticRefresh { |
| 927 |
type Params = (); |
| 928 |
type Result = (); |
| 929 |
const METHOD: &'static str = "workspace/diagnostic/refresh"; |
| 930 |
} |
| 931 |
|
| 932 |
|
| 933 |
’t |
| 934 |
|
| 935 |
|
| 936 |
|
| 937 |
|
| 938 |
pub enum TypeHierarchyPrepare {} |
| 939 |
|
| 940 |
impl Request for TypeHierarchyPrepare { |
| 941 |
type Params = TypeHierarchyPrepareParams; |
| 942 |
type Result = Option<Vec<TypeHierarchyItem>>; |
| 943 |
const METHOD: &'static str = "textDocument/prepareTypeHierarchy"; |
| 944 |
} |
| 945 |
|
| 946 |
|
| 947 |
a |
| 948 |
er |
| 949 |
|
| 950 |
|
| 951 |
pub enum TypeHierarchySupertypes {} |
| 952 |
|
| 953 |
impl Request for TypeHierarchySupertypes { |
| 954 |
type Params = TypeHierarchySupertypesParams; |
| 955 |
type Result = Option<Vec<TypeHierarchyItem>>; |
| 956 |
const METHOD: &'static str = "typeHierarchy/supertypes"; |
| 957 |
} |
| 958 |
|
| 959 |
|
| 960 |
id |
| 961 |
s. |
| 962 |
|
| 963 |
pub enum TypeHierarchySubtypes {} |
| 964 |
|
| 965 |
impl Request for TypeHierarchySubtypes { |
| 966 |
type Params = TypeHierarchySubtypesParams; |
| 967 |
type Result = Option<Vec<TypeHierarchyItem>>; |
| 968 |
const METHOD: &'static str = "typeHierarchy/subtypes"; |
| 969 |
} |
| 970 |
|
| 971 |
#[cfg(test)] |
| 972 |
mod test { |
| 973 |
use super::*; |
| 974 |
|
| 975 |
fn fake_call<R>() |
| 976 |
where |
| 977 |
R: Request, |
| 978 |
R::Params: serde::Serialize, |
| 979 |
R::Result: serde::de::DeserializeOwned, |
| 980 |
{ |
| 981 |
} |
| 982 |
|
| 983 |
macro_rules! check_macro { |
| 984 |
($name:tt) => { |
| 985 |
|
| 986 |
assert_eq!(<lsp_request!($name) as Request>::METHOD, $name); |
| 987 |
|
| 988 |
fake_call::<lsp_request!($name)>(); |
| 989 |
}; |
| 990 |
} |
| 991 |
|
| 992 |
#[test] |
| 993 |
fn check_macro_definitions() { |
| 994 |
check_macro!("initialize"); |
| 995 |
check_macro!("shutdown"); |
| 996 |
|
| 997 |
check_macro!("window/showDocument"); |
| 998 |
check_macro!("window/showMessageRequest"); |
| 999 |
check_macro!("window/workDoneProgress/create"); |
| 1000 |
|
| 1001 |
check_macro!("client/registerCapability"); |
| 1002 |
check_macro!("client/unregisterCapability"); |
| 1003 |
|
| 1004 |
check_macro!("textDocument/willSaveWaitUntil"); |
| 1005 |
check_macro!("textDocument/completion"); |
| 1006 |
check_macro!("textDocument/hover"); |
| 1007 |
check_macro!("textDocument/signatureHelp"); |
| 1008 |
check_macro!("textDocument/declaration"); |
| 1009 |
check_macro!("textDocument/definition"); |
| 1010 |
check_macro!("textDocument/references"); |
| 1011 |
check_macro!("textDocument/documentHighlight"); |
| 1012 |
check_macro!("textDocument/documentSymbol"); |
| 1013 |
check_macro!("textDocument/codeAction"); |
| 1014 |
check_macro!("textDocument/codeLens"); |
| 1015 |
check_macro!("textDocument/documentLink"); |
| 1016 |
check_macro!("textDocument/rangeFormatting"); |
| 1017 |
check_macro!("textDocument/onTypeFormatting"); |
| 1018 |
check_macro!("textDocument/formatting"); |
| 1019 |
check_macro!("textDocument/rename"); |
| 1020 |
check_macro!("textDocument/documentColor"); |
| 1021 |
check_macro!("textDocument/colorPresentation"); |
| 1022 |
check_macro!("textDocument/foldingRange"); |
| 1023 |
check_macro!("textDocument/prepareRename"); |
| 1024 |
check_macro!("textDocument/implementation"); |
| 1025 |
check_macro!("textDocument/selectionRange"); |
| 1026 |
check_macro!("textDocument/typeDefinition"); |
| 1027 |
check_macro!("textDocument/moniker"); |
| 1028 |
check_macro!("textDocument/linkedEditingRange"); |
| 1029 |
check_macro!("textDocument/prepareCallHierarchy"); |
| 1030 |
check_macro!("textDocument/prepareTypeHierarchy"); |
| 1031 |
check_macro!("textDocument/semanticTokens/full"); |
| 1032 |
check_macro!("textDocument/semanticTokens/full/delta"); |
| 1033 |
check_macro!("textDocument/semanticTokens/range"); |
| 1034 |
check_macro!("textDocument/inlayHint"); |
| 1035 |
check_macro!("textDocument/inlineValue"); |
| 1036 |
check_macro!("textDocument/diagnostic"); |
| 1037 |
|
| 1038 |
check_macro!("workspace/applyEdit"); |
| 1039 |
check_macro!("workspace/symbol"); |
| 1040 |
check_macro!("workspace/executeCommand"); |
| 1041 |
check_macro!("workspace/configuration"); |
| 1042 |
check_macro!("workspace/diagnostic"); |
| 1043 |
check_macro!("workspace/diagnostic/refresh"); |
| 1044 |
check_macro!("workspace/willCreateFiles"); |
| 1045 |
check_macro!("workspace/willRenameFiles"); |
| 1046 |
check_macro!("workspace/willDeleteFiles"); |
| 1047 |
check_macro!("workspace/workspaceFolders"); |
| 1048 |
check_macro!("workspace/semanticTokens/refresh"); |
| 1049 |
check_macro!("workspace/codeLens/refresh"); |
| 1050 |
check_macro!("workspace/inlayHint/refresh"); |
| 1051 |
check_macro!("workspace/inlineValue/refresh"); |
| 1052 |
|
| 1053 |
check_macro!("callHierarchy/incomingCalls"); |
| 1054 |
check_macro!("callHierarchy/outgoingCalls"); |
| 1055 |
check_macro!("codeAction/resolve"); |
| 1056 |
check_macro!("codeLens/resolve"); |
| 1057 |
check_macro!("completionItem/resolve"); |
| 1058 |
check_macro!("documentLink/resolve"); |
| 1059 |
check_macro!("inlayHint/resolve"); |
| 1060 |
check_macro!("typeHierarchy/subtypes"); |
| 1061 |
check_macro!("typeHierarchy/supertypes"); |
| 1062 |
check_macro!("workspaceSymbol/resolve"); |
| 1063 |
} |
| 1064 |
|
| 1065 |
#[test] |
| 1066 |
#[cfg(feature = "proposed")] |
| 1067 |
fn check_proposed_macro_definitions() {} |
| 1068 |
} |