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

Function inlay_hints_for

tests/integration/inlay_hints.rs:8–36  ·  view source on GitHub ↗

Helper: open a file and request inlay hints for the entire file.

(backend: &phpantom_lsp::Backend, uri: &Url, text: &str)

Source from the content-addressed store, hash-verified

6
7/// Helper: open a file and request inlay hints for the entire file.
8async fn inlay_hints_for(backend: &phpantom_lsp::Backend, uri: &Url, text: &str) -> Vec<InlayHint> {
9 let open_params = DidOpenTextDocumentParams {
10 text_document: TextDocumentItem {
11 uri: uri.clone(),
12 language_id: "php".to_string(),
13 version: 1,
14 text: text.to_string(),
15 },
16 };
17 backend.did_open(open_params).await;
18
19 let line_count = text.lines().count() as u32;
20 let last_line_len = text.lines().last().map(|l| l.len() as u32).unwrap_or(0);
21
22 let range = Range {
23 start: Position {
24 line: 0,
25 character: 0,
26 },
27 end: Position {
28 line: line_count,
29 character: last_line_len,
30 },
31 };
32
33 backend
34 .handle_inlay_hints(uri.as_ref(), text, range)
35 .unwrap_or_default()
36}
37
38/// Extract the label string from an InlayHint.
39fn hint_label(hint: &InlayHint) -> String {

Calls 6

cloneMethod · 0.80
lastMethod · 0.80
handle_inlay_hintsMethod · 0.80
did_openMethod · 0.45
countMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected