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

Method hover

src/server.rs:669–703  ·  view source on GitHub ↗
(&self, params: HoverParams)

Source from the content-addressed store, hash-verified

667 }
668
669 async fn hover(&self, params: HoverParams) -> Result<Option<Hover>> {
670 let uri = params
671 .text_document_position_params
672 .text_document
673 .uri
674 .to_string();
675 let position = params.text_document_position_params.position;
676
677 let backend = self.clone_for_blocking();
678 let uri_clone = uri.clone();
679 tokio::task::spawn_blocking(move || {
680 // For Blade files, check if the cursor is on a `{{` or `{!!` echo
681 // delimiter. If so, return hover for `e()` (escaped echo) or a
682 // raw-echo explanation, rather than falling through to the virtual
683 // PHP content where the position maps into boilerplate.
684 if backend.is_blade_file(&uri_clone)
685 && let Some(hover) = backend.blade_echo_delimiter_hover(&uri_clone, position)
686 {
687 return Ok(Some(hover));
688 }
689
690 backend.handle_with_position("hover", &uri_clone, position, |content, pos| {
691 let mut hover = backend.handle_hover(&uri_clone, content, pos)?;
692 if backend.is_blade_file(&uri_clone)
693 && let Some(range) = &mut hover.range
694 {
695 range.start = backend.translate_php_to_blade(&uri_clone, range.start);
696 range.end = backend.translate_php_to_blade(&uri_clone, range.end);
697 }
698 Some(hover)
699 })
700 })
701 .await
702 .unwrap_or(Ok(None))
703 }
704
705 async fn completion(&self, params: CompletionParams) -> Result<Option<CompletionResponse>> {
706 self.handle_completion(params).await

Callers

nothing calls this directly

Calls 7

clone_for_blockingMethod · 0.80
cloneMethod · 0.80
is_blade_fileMethod · 0.80
handle_with_positionMethod · 0.80
handle_hoverMethod · 0.80

Tested by

no test coverage detected