MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / goto_definition

Method goto_definition

src/server.rs:543–576  ·  view source on GitHub ↗
(
        &self,
        params: GotoDefinitionParams,
    )

Source from the content-addressed store, hash-verified

541 }
542
543 async fn goto_definition(
544 &self,
545 params: GotoDefinitionParams,
546 ) -> Result<Option<GotoDefinitionResponse>> {
547 let uri = params
548 .text_document_position_params
549 .text_document
550 .uri
551 .to_string();
552 let position = params.text_document_position_params.position;
553
554 let backend = self.clone_for_blocking();
555 let uri_clone = uri.clone();
556 tokio::task::spawn_blocking(move || {
557 backend.handle_with_position("goto_definition", &uri_clone, position, |content, pos| {
558 let locs = backend.resolve_definition(&uri_clone, content, pos);
559 if locs.is_empty() {
560 None
561 } else if locs.len() == 1 {
562 Some(GotoDefinitionResponse::Scalar(
563 backend.translate_location(locs[0].clone()),
564 ))
565 } else {
566 Some(GotoDefinitionResponse::Array(
567 locs.into_iter()
568 .map(|l| backend.translate_location(l))
569 .collect(),
570 ))
571 }
572 })
573 })
574 .await
575 .unwrap_or(Ok(None))
576 }
577
578 async fn goto_implementation(
579 &self,

Calls 8

clone_for_blockingMethod · 0.80
cloneMethod · 0.80
handle_with_positionMethod · 0.80
resolve_definitionMethod · 0.80
translate_locationMethod · 0.80
into_iterMethod · 0.80
is_emptyMethod · 0.45
mapMethod · 0.45